[CLI] Fix asset filter

- Fixed sprite export in sprite only mode
This commit is contained in:
VaDiM 2023-08-14 00:25:53 +03:00
parent 4e41caf203
commit 94c8b355fe

View File

@ -12,7 +12,7 @@ namespace AssetStudio
{ {
public string SpecifyUnityVersion; public string SpecifyUnityVersion;
public List<SerializedFile> assetsFileList = new List<SerializedFile>(); public List<SerializedFile> assetsFileList = new List<SerializedFile>();
private List<ClassIDType> filteredAssetTypesList = new List<ClassIDType>(); private HashSet<ClassIDType> filteredAssetTypesList = new HashSet<ClassIDType>();
internal Dictionary<string, int> assetsFileIndexCache = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase); internal Dictionary<string, int> assetsFileIndexCache = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
internal Dictionary<string, BinaryReader> resourceFileReaders = new Dictionary<string, BinaryReader>(StringComparer.OrdinalIgnoreCase); internal Dictionary<string, BinaryReader> resourceFileReaders = new Dictionary<string, BinaryReader>(StringComparer.OrdinalIgnoreCase);
@ -22,35 +22,32 @@ namespace AssetStudio
private HashSet<string> noexistFiles = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private HashSet<string> noexistFiles = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
private HashSet<string> assetsFileListHash = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private HashSet<string> assetsFileListHash = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
public void SetAssetFilter(ClassIDType classIDType) public void SetAssetFilter(params ClassIDType[] classIDTypes)
{ {
if (filteredAssetTypesList.Count == 0) if (filteredAssetTypesList.Count == 0)
{ {
filteredAssetTypesList.AddRange(new List<ClassIDType> filteredAssetTypesList.UnionWith(new HashSet<ClassIDType>
{ {
ClassIDType.AssetBundle, ClassIDType.AssetBundle,
ClassIDType.ResourceManager, ClassIDType.ResourceManager,
}); });
} }
if (classIDType == ClassIDType.MonoBehaviour) if (classIDTypes.Contains(ClassIDType.MonoBehaviour))
{ {
filteredAssetTypesList.AddRange(new List<ClassIDType> filteredAssetTypesList.Add(ClassIDType.MonoScript);
{
ClassIDType.MonoScript,
ClassIDType.MonoBehaviour
});
} }
else if (classIDTypes.Contains(ClassIDType.Sprite))
{ {
filteredAssetTypesList.Add(classIDType); filteredAssetTypesList.Add(ClassIDType.Texture2D);
} }
filteredAssetTypesList.UnionWith(classIDTypes);
} }
public void SetAssetFilter(List<ClassIDType> classIDTypeList) public void SetAssetFilter(List<ClassIDType> classIDTypeList)
{ {
foreach (ClassIDType classIDType in classIDTypeList) SetAssetFilter(classIDTypeList.ToArray());
SetAssetFilter(classIDType);
} }
public void LoadFilesAndFolders(params string[] path) public void LoadFilesAndFolders(params string[] path)