From 190cb68b07c8315a8a61e8f8da61d04eccfda39e Mon Sep 17 00:00:00 2001 From: VaDiM Date: Mon, 31 Mar 2025 20:14:33 +0300 Subject: [PATCH] [CLI] Add flag to export all UVs as diffuse maps --- AssetStudioCLI/Exporter.cs | 1 + AssetStudioCLI/Options/CLIOptions.cs | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/AssetStudioCLI/Exporter.cs b/AssetStudioCLI/Exporter.cs index 0b2761b..cfad746 100644 --- a/AssetStudioCLI/Exporter.cs +++ b/AssetStudioCLI/Exporter.cs @@ -144,6 +144,7 @@ namespace AssetStudioCLI { BoneSize = CLIOptions.o_fbxBoneSize.Value, ScaleFactor = CLIOptions.o_fbxScaleFactor.Value, + ExportAllUvsAsDiffuseMaps = CLIOptions.f_fbxUvsAsDiffuseMaps.Value, }; ModelExporter.ExportFbx(exportPath, convert, fbxSettings); } diff --git a/AssetStudioCLI/Options/CLIOptions.cs b/AssetStudioCLI/Options/CLIOptions.cs index 78996a2..f50fb25 100644 --- a/AssetStudioCLI/Options/CLIOptions.cs +++ b/AssetStudioCLI/Options/CLIOptions.cs @@ -108,6 +108,7 @@ namespace AssetStudioCLI.Options //fbx public static Option o_fbxScaleFactor; public static Option o_fbxBoneSize; + public static Option f_fbxUvsAsDiffuseMaps; //filter public static Option> o_filterByName; public static Option> o_filterByContainer; @@ -368,7 +369,17 @@ namespace AssetStudioCLI.Options optionName: "--fbx-bone-size ", optionDescription: "Specify the FBX Bone Size\n" + "\n", - optionExample: "Example: \"--fbx-bone-size 10\"", + optionExample: "Example: \"--fbx-bone-size 10\"\n", + optionHelpGroup: HelpGroups.FBX + ); + f_fbxUvsAsDiffuseMaps = new GroupedOption + ( + optionDefaultValue: false, + optionName: "--fbx-uvs-as-diffuse", + optionDescription: "(Flag) If specified, Studio will export all UVs as Diffuse maps.\n" + + "Сan be useful if you cannot find some UVs after exporting (e.g. in Blender)\n" + + "(But can also cause some bugs with UVs)", + optionExample: "", optionHelpGroup: HelpGroups.FBX ); #endregion @@ -408,7 +419,7 @@ namespace AssetStudioCLI.Options optionDescription: "Specify the text by which assets should be filtered\n" + "Looks for assets that contain the specified text in their names or containers\n" + "*To specify multiple values write them separated by ',' or ';' without spaces\n", - optionExample: "Example: \"--filter-by-text portrait\" or \"--filter-by-text portrait,art\"\n", + optionExample: "Example: \"--filter-by-text portrait\" or \"--filter-by-text portrait,art\"", optionHelpGroup: HelpGroups.Filter ); #endregion @@ -627,6 +638,16 @@ namespace AssetStudioCLI.Options f_l2dForceBezier.Value = true; resplittedArgs.RemoveAt(i); break; + case "--fbx-uvs-as-diffuse": + if (o_workMode.Value != WorkMode.SplitObjects) + { + Console.WriteLine($"{"Error".Color(brightRed)} during parsing [{flag.Color(brightYellow)}] flag. This flag is not suitable for the current working mode [{o_workMode.Value}].\n"); + ShowOptionDescription(o_workMode); + return; + } + f_fbxUvsAsDiffuseMaps.Value = true; + resplittedArgs.RemoveAt(i); + break; case "--not-restore-extension": f_notRestoreExtensionName.Value = true; resplittedArgs.RemoveAt(i); @@ -1273,6 +1294,9 @@ namespace AssetStudioCLI.Options { sb.AppendLine($"# Export Image Format: {o_imageFormat}"); sb.AppendLine($"# Filter by Name(s): \"{string.Join("\", \"", o_filterByName.Value)}\""); + sb.AppendLine($"# FBX Scale Factor: {o_fbxScaleFactor}"); + sb.AppendLine($"# FBX Bone Size: {o_fbxBoneSize}"); + sb.AppendLine($"# FBX UVs as Diffuse Maps: {f_fbxUvsAsDiffuseMaps}"); } else {