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