Ability to preview/export non-exportable assets when possible.
This commit is contained in:
@@ -77,26 +77,6 @@ namespace AssetStudioCLI
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ExportAssetBundle(AssetItem item, string exportPath)
|
||||
{
|
||||
if (!TryExportFile(exportPath, item, ".json", out var exportFullPath))
|
||||
return false;
|
||||
var m_AssetBundle = (AssetBundle)item.Asset;
|
||||
var str = JsonConvert.SerializeObject(m_AssetBundle, Formatting.Indented);
|
||||
File.WriteAllText(exportFullPath, str);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ExportIndexObject(AssetItem item, string exportPath)
|
||||
{
|
||||
if (!TryExportFile(exportPath, item, ".json", out var exportFullPath))
|
||||
return false;
|
||||
var m_IndexObject = (IndexObject)item.Asset;
|
||||
var str = JsonConvert.SerializeObject(m_IndexObject, Formatting.Indented);
|
||||
File.WriteAllText(exportFullPath, str);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ExportMiHoYoBinData(AssetItem item, string exportPath)
|
||||
{
|
||||
string exportFullPath;
|
||||
@@ -271,14 +251,20 @@ namespace AssetStudioCLI
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool ExportMaterial(AssetItem item, string exportPath)
|
||||
public static bool ExportJsonFile(AssetItem item, string exportPath)
|
||||
{
|
||||
if (!TryExportFile(exportPath, item, ".json", out var exportFullPath))
|
||||
return false;
|
||||
var m_Material = (Material)item.Asset;
|
||||
var str = JsonConvert.SerializeObject(m_Material, Formatting.Indented);
|
||||
File.WriteAllText(exportFullPath, str);
|
||||
return true;
|
||||
var str = JsonConvert.SerializeObject(item.Asset, Formatting.Indented);
|
||||
if (!string.IsNullOrEmpty(str) && str != "{}")
|
||||
{
|
||||
File.WriteAllText(exportFullPath, str);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ExportRawFile(item, exportPath);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ExportRawFile(AssetItem item, string exportPath)
|
||||
@@ -354,20 +340,14 @@ namespace AssetStudioCLI
|
||||
return ExportMovieTexture(item, exportPath);
|
||||
case ClassIDType.Sprite:
|
||||
return ExportSprite(item, exportPath);
|
||||
case ClassIDType.Material:
|
||||
return ExportMaterial(item, exportPath);
|
||||
case ClassIDType.Animator:
|
||||
return false;
|
||||
case ClassIDType.AnimationClip:
|
||||
return ExportAnimationClip(item, exportPath);
|
||||
case ClassIDType.AssetBundle:
|
||||
return ExportAssetBundle(item, exportPath);
|
||||
case ClassIDType.IndexObject:
|
||||
return ExportIndexObject(item, exportPath);
|
||||
case ClassIDType.MiHoYoBinData:
|
||||
return ExportMiHoYoBinData(item, exportPath);
|
||||
default:
|
||||
return ExportRawFile(item, exportPath);
|
||||
return ExportJsonFile(item, exportPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user