mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-07-18 03:24:15 -04:00
Merge branch 'pr/10' into AssetStudioMod
This commit is contained in:
@ -12,6 +12,7 @@ namespace AssetStudioCLI.Options
|
||||
General,
|
||||
Convert,
|
||||
Logger,
|
||||
FBX,
|
||||
Advanced,
|
||||
}
|
||||
|
||||
@ -22,6 +23,7 @@ namespace AssetStudioCLI.Options
|
||||
Dump,
|
||||
Info,
|
||||
ExportLive2D,
|
||||
SplitObjects,
|
||||
}
|
||||
|
||||
internal enum AssetGroupOption
|
||||
@ -79,6 +81,9 @@ namespace AssetStudioCLI.Options
|
||||
public static bool convertTexture;
|
||||
public static Option<ImageFormat> o_imageFormat;
|
||||
public static Option<AudioFormat> o_audioFormat;
|
||||
//fbx
|
||||
public static Option<float> o_fbxScaleFactor;
|
||||
public static Option<int> o_fbxBoneSize;
|
||||
//advanced
|
||||
public static Option<ExportListType> o_exportAssetList;
|
||||
public static Option<List<string>> o_filterByName;
|
||||
@ -152,12 +157,13 @@ namespace AssetStudioCLI.Options
|
||||
optionDefaultValue: WorkMode.Export,
|
||||
optionName: "-m, --mode <value>",
|
||||
optionDescription: "Specify working mode\n" +
|
||||
"<Value: export(default) | exportRaw | dump | info | live2d>\n" +
|
||||
"<Value: export(default) | exportRaw | dump | info | live2d | splitObjects>\n" +
|
||||
"Export - Exports converted assets\n" +
|
||||
"ExportRaw - Exports raw data\n" +
|
||||
"Dump - Makes asset dumps\n" +
|
||||
"Info - Loads file(s), shows the number of available for export assets and exits\n" +
|
||||
"Live2D - Exports Live2D Cubism 3 models\n" +
|
||||
"SplitObjects - Export split objects (fbx)\n" +
|
||||
"Example: \"-m info\"\n",
|
||||
optionHelpGroup: HelpGroups.General
|
||||
);
|
||||
@ -249,6 +255,27 @@ namespace AssetStudioCLI.Options
|
||||
);
|
||||
#endregion
|
||||
|
||||
#region Init FBX Options
|
||||
o_fbxScaleFactor = new GroupedOption<float>
|
||||
(
|
||||
optionDefaultValue: 1f,
|
||||
optionName: "--fbx-scale-factor <value>",
|
||||
optionDescription: "Specify the FBX Scale Factor\n" +
|
||||
"<Value: float number from 0 to 100 (default=1)\n" +
|
||||
"Example: \"--fbx-scale-factor 50\"\n",
|
||||
optionHelpGroup: HelpGroups.FBX
|
||||
);
|
||||
o_fbxBoneSize = new GroupedOption<int>
|
||||
(
|
||||
optionDefaultValue: 10,
|
||||
optionName: "--fbx-bone-size <value>",
|
||||
optionDescription: "Specify the FBX Bone Size\n" +
|
||||
"<Value: integer number from 0 to 100 (default=10)\n" +
|
||||
"Example: \"--fbx-bone-size 10\"",
|
||||
optionHelpGroup: HelpGroups.FBX
|
||||
);
|
||||
#endregion
|
||||
|
||||
#region Init Advanced Options
|
||||
o_exportAssetList = new GroupedOption<ExportListType>
|
||||
(
|
||||
@ -344,7 +371,7 @@ namespace AssetStudioCLI.Options
|
||||
$"Specified file or folder was not found. The input path must be specified as the first argument.");
|
||||
return;
|
||||
}
|
||||
o_outputFolder.Value = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ASExport");
|
||||
o_outputFolder.Value = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"ASExport{Path.DirectorySeparatorChar}");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -421,6 +448,19 @@ namespace AssetStudioCLI.Options
|
||||
ClassIDType.Transform,
|
||||
};
|
||||
break;
|
||||
case "splitobjects":
|
||||
o_workMode.Value = WorkMode.SplitObjects;
|
||||
o_exportAssetTypes.Value = new List<ClassIDType>()
|
||||
{
|
||||
ClassIDType.GameObject,
|
||||
ClassIDType.Texture2D,
|
||||
ClassIDType.Material,
|
||||
ClassIDType.Transform,
|
||||
ClassIDType.Mesh,
|
||||
ClassIDType.MeshRenderer,
|
||||
ClassIDType.MeshFilter
|
||||
};
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine($"{"Error".Color(brightRed)} during parsing [{option}] option. Unsupported working mode: [{value.Color(brightRed)}].\n");
|
||||
Console.WriteLine(o_workMode.Description);
|
||||
@ -429,7 +469,7 @@ namespace AssetStudioCLI.Options
|
||||
break;
|
||||
case "-t":
|
||||
case "--asset-type":
|
||||
if (o_workMode.Value == WorkMode.ExportLive2D)
|
||||
if (o_workMode.Value == WorkMode.ExportLive2D || o_workMode.Value == WorkMode.SplitObjects)
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
@ -517,6 +557,10 @@ namespace AssetStudioCLI.Options
|
||||
{
|
||||
Directory.CreateDirectory(value);
|
||||
}
|
||||
if (!value.EndsWith($"{Path.DirectorySeparatorChar}"))
|
||||
{
|
||||
value += Path.DirectorySeparatorChar;
|
||||
}
|
||||
o_outputFolder.Value = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -617,6 +661,32 @@ namespace AssetStudioCLI.Options
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case "--fbx-scale-factor":
|
||||
var isFloat = float.TryParse(value, out float floatValue);
|
||||
if (isFloat && floatValue >= 0 && floatValue <= 100)
|
||||
{
|
||||
o_fbxScaleFactor.Value = floatValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"{"Error".Color(brightRed)} during parsing [{option}] option. Unsupported scale factor value: [{value.Color(brightRed)}].\n");
|
||||
Console.WriteLine(o_fbxScaleFactor.Description);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case "--fbx-bone-size":
|
||||
var isInt = int.TryParse(value, out int intValue);
|
||||
if (isInt && intValue >= 0 && intValue <= 100)
|
||||
{
|
||||
o_fbxBoneSize.Value = intValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"{"Error".Color(brightRed)} during parsing [{option}] option. Unsupported bone size value: [{value.Color(brightRed)}].\n");
|
||||
Console.WriteLine(o_fbxBoneSize.Description);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case "--export-asset-list":
|
||||
switch (value.ToLower())
|
||||
{
|
||||
@ -802,6 +872,7 @@ namespace AssetStudioCLI.Options
|
||||
sb.AppendLine(ShowCurrentFilter());
|
||||
sb.AppendLine($"# Unity Version: \"{o_unityVersion}\"");
|
||||
break;
|
||||
case WorkMode.SplitObjects:
|
||||
case WorkMode.ExportLive2D:
|
||||
sb.AppendLine($"# Output Path: \"{o_outputFolder}\"");
|
||||
sb.AppendLine($"# Log Level: {o_logLevel}");
|
||||
|
Reference in New Issue
Block a user