mirror of https://github.com/tuyoogame/YooAsset
Update AssetBundleWindow
修复了非主动收集的着色器没有打进统一的着色器资源包的问题。 修复了单个收集的资源对象没有设置依赖资源列表的问题。 资源打包的过滤文件列表增加cginc格式。pull/4/head
parent
09807901c0
commit
533f96361a
|
@ -31,6 +31,11 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public bool IsCollectAsset { private set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为着色器资源
|
||||
/// </summary>
|
||||
public bool IsShaderAsset { private set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 被依赖次数
|
||||
/// </summary>
|
||||
|
@ -54,6 +59,12 @@ namespace YooAsset.Editor
|
|||
IsRawAsset = isRawAsset;
|
||||
NotWriteToAssetList = notWriteToAssetList;
|
||||
IsCollectAsset = true;
|
||||
|
||||
System.Type assetType = UnityEditor.AssetDatabase.GetMainAssetTypeAtPath(assetPath);
|
||||
if (assetType == typeof(UnityEngine.Shader))
|
||||
IsShaderAsset = true;
|
||||
else
|
||||
IsShaderAsset = false;
|
||||
}
|
||||
public BuildAssetInfo(string assetPath)
|
||||
{
|
||||
|
@ -61,6 +72,12 @@ namespace YooAsset.Editor
|
|||
IsRawAsset = false;
|
||||
NotWriteToAssetList = true;
|
||||
IsCollectAsset = false;
|
||||
|
||||
System.Type assetType = UnityEditor.AssetDatabase.GetMainAssetTypeAtPath(assetPath);
|
||||
if (assetType == typeof(UnityEngine.Shader))
|
||||
IsShaderAsset = true;
|
||||
else
|
||||
IsShaderAsset = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -78,6 +78,13 @@ namespace YooAsset.Editor
|
|||
var buildAssetInfo = pair.Value;
|
||||
if (buildAssetInfo.IsCollectAsset)
|
||||
continue;
|
||||
|
||||
if (AssetBundleGrouperSettingData.Setting.AutoCollectShaders)
|
||||
{
|
||||
if (buildAssetInfo.IsShaderAsset)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (buildAssetInfo.DependCount == 0)
|
||||
removeList.Add(buildAssetInfo);
|
||||
}
|
||||
|
@ -92,12 +99,20 @@ namespace YooAsset.Editor
|
|||
{
|
||||
var buildAssetInfo = pair.Value;
|
||||
if (buildAssetInfo.BundleNameIsValid() == false)
|
||||
{
|
||||
string shaderBundleName = AssetBundleCollector.CollectShaderBundleName(buildAssetInfo.AssetPath);
|
||||
if (string.IsNullOrEmpty(shaderBundleName) == false)
|
||||
{
|
||||
buildAssetInfo.SetBundleName(shaderBundleName);
|
||||
}
|
||||
else
|
||||
{
|
||||
string bundleName = defaultPackRule.GetBundleName(new PackRuleData(buildAssetInfo.AssetPath));
|
||||
bundleName = AssetBundleCollector.RevisedBundleName(bundleName, false);
|
||||
bundleName = AssetBundleCollector.CorrectBundleName(bundleName, false);
|
||||
buildAssetInfo.SetBundleName(bundleName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 7. 构建资源包
|
||||
var allBuildAssets = buildAssetDic.Values.ToList();
|
||||
|
|
|
@ -94,6 +94,7 @@ namespace YooAsset.Editor
|
|||
string bundleName = GetBundleName(grouper, assetPath, isRawAsset);
|
||||
List<string> assetTags = GetAssetTags(grouper);
|
||||
var collectAssetInfo = new CollectAssetInfo(bundleName, assetPath, assetTags, isRawAsset, NotWriteToAssetList);
|
||||
collectAssetInfo.DependAssets = GetAllDependencies(assetPath);
|
||||
result.Add(assetPath, collectAssetInfo);
|
||||
}
|
||||
else
|
||||
|
@ -120,7 +121,7 @@ namespace YooAsset.Editor
|
|||
return false;
|
||||
|
||||
string ext = System.IO.Path.GetExtension(assetPath);
|
||||
if (ext == "" || ext == ".dll" || ext == ".cs" || ext == ".js" || ext == ".boo" || ext == ".meta")
|
||||
if (ext == "" || ext == ".dll" || ext == ".cs" || ext == ".js" || ext == ".boo" || ext == ".meta" || ext == ".cginc")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -141,22 +142,15 @@ namespace YooAsset.Editor
|
|||
}
|
||||
private string GetBundleName(AssetBundleGrouper grouper, string assetPath, bool isRawAsset)
|
||||
{
|
||||
// 如果收集全路径着色器
|
||||
if (AssetBundleGrouperSettingData.Setting.AutoCollectShaders)
|
||||
{
|
||||
System.Type assetType = AssetDatabase.GetMainAssetTypeAtPath(assetPath);
|
||||
if (assetType == typeof(UnityEngine.Shader))
|
||||
{
|
||||
string bundleName = AssetBundleGrouperSettingData.Setting.ShadersBundleName;
|
||||
return RevisedBundleName(bundleName, false);
|
||||
}
|
||||
}
|
||||
string shaderBundleName = CollectShaderBundleName(assetPath);
|
||||
if (string.IsNullOrEmpty(shaderBundleName) == false)
|
||||
return shaderBundleName;
|
||||
|
||||
// 根据规则设置获取资源包名称
|
||||
{
|
||||
IPackRule packRuleInstance = AssetBundleGrouperSettingData.GetPackRuleInstance(PackRuleName);
|
||||
string bundleName = packRuleInstance.GetBundleName(new PackRuleData(assetPath, CollectPath, grouper.GrouperName));
|
||||
return RevisedBundleName(bundleName, isRawAsset);
|
||||
return CorrectBundleName(bundleName, isRawAsset);
|
||||
}
|
||||
}
|
||||
private List<string> GetAssetTags(AssetBundleGrouper grouper)
|
||||
|
@ -182,11 +176,28 @@ namespace YooAsset.Editor
|
|||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 收集着色器的资源包名称
|
||||
/// </summary>
|
||||
public static string CollectShaderBundleName(string assetPath)
|
||||
{
|
||||
// 如果自动收集所有的着色器
|
||||
if (AssetBundleGrouperSettingData.Setting.AutoCollectShaders)
|
||||
{
|
||||
System.Type assetType = AssetDatabase.GetMainAssetTypeAtPath(assetPath);
|
||||
if (assetType == typeof(UnityEngine.Shader))
|
||||
{
|
||||
string bundleName = AssetBundleGrouperSettingData.Setting.ShadersBundleName;
|
||||
return CorrectBundleName(bundleName, false);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修正资源包名
|
||||
/// 修正资源包名称
|
||||
/// </summary>
|
||||
public static string RevisedBundleName(string bundleName, bool isRawBundle)
|
||||
public static string CorrectBundleName(string bundleName, bool isRawBundle)
|
||||
{
|
||||
if (isRawBundle)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue