Skip to content

Commit 190cb68

Browse files
committed
[CLI] Add flag to export all UVs as diffuse maps
1 parent 3fa2ef1 commit 190cb68

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

AssetStudioCLI/Exporter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ private static void ExportFbx(IImported convert, string exportPath)
144144
{
145145
BoneSize = CLIOptions.o_fbxBoneSize.Value,
146146
ScaleFactor = CLIOptions.o_fbxScaleFactor.Value,
147+
ExportAllUvsAsDiffuseMaps = CLIOptions.f_fbxUvsAsDiffuseMaps.Value,
147148
};
148149
ModelExporter.ExportFbx(exportPath, convert, fbxSettings);
149150
}

AssetStudioCLI/Options/CLIOptions.cs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ internal static class CLIOptions
108108
//fbx
109109
public static Option<float> o_fbxScaleFactor;
110110
public static Option<int> o_fbxBoneSize;
111+
public static Option<bool> f_fbxUvsAsDiffuseMaps;
111112
//filter
112113
public static Option<List<string>> o_filterByName;
113114
public static Option<List<string>> o_filterByContainer;
@@ -368,7 +369,17 @@ private static void InitOptions()
368369
optionName: "--fbx-bone-size <value>",
369370
optionDescription: "Specify the FBX Bone Size\n" +
370371
"<Value: integer number from 0 to 100 (default=10)>\n",
371-
optionExample: "Example: \"--fbx-bone-size 10\"",
372+
optionExample: "Example: \"--fbx-bone-size 10\"\n",
373+
optionHelpGroup: HelpGroups.FBX
374+
);
375+
f_fbxUvsAsDiffuseMaps = new GroupedOption<bool>
376+
(
377+
optionDefaultValue: false,
378+
optionName: "--fbx-uvs-as-diffuse",
379+
optionDescription: "(Flag) If specified, Studio will export all UVs as Diffuse maps.\n" +
380+
"Сan be useful if you cannot find some UVs after exporting (e.g. in Blender)\n" +
381+
"(But can also cause some bugs with UVs)",
382+
optionExample: "",
372383
optionHelpGroup: HelpGroups.FBX
373384
);
374385
#endregion
@@ -408,7 +419,7 @@ private static void InitOptions()
408419
optionDescription: "Specify the text by which assets should be filtered\n" +
409420
"Looks for assets that contain the specified text in their names or containers\n" +
410421
"*To specify multiple values write them separated by ',' or ';' without spaces\n",
411-
optionExample: "Example: \"--filter-by-text portrait\" or \"--filter-by-text portrait,art\"\n",
422+
optionExample: "Example: \"--filter-by-text portrait\" or \"--filter-by-text portrait,art\"",
412423
optionHelpGroup: HelpGroups.Filter
413424
);
414425
#endregion
@@ -627,6 +638,16 @@ public static void ParseArgs(string[] args)
627638
f_l2dForceBezier.Value = true;
628639
resplittedArgs.RemoveAt(i);
629640
break;
641+
case "--fbx-uvs-as-diffuse":
642+
if (o_workMode.Value != WorkMode.SplitObjects)
643+
{
644+
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");
645+
ShowOptionDescription(o_workMode);
646+
return;
647+
}
648+
f_fbxUvsAsDiffuseMaps.Value = true;
649+
resplittedArgs.RemoveAt(i);
650+
break;
630651
case "--not-restore-extension":
631652
f_notRestoreExtensionName.Value = true;
632653
resplittedArgs.RemoveAt(i);
@@ -1273,6 +1294,9 @@ public static void ShowCurrentOptions()
12731294
{
12741295
sb.AppendLine($"# Export Image Format: {o_imageFormat}");
12751296
sb.AppendLine($"# Filter by Name(s): \"{string.Join("\", \"", o_filterByName.Value)}\"");
1297+
sb.AppendLine($"# FBX Scale Factor: {o_fbxScaleFactor}");
1298+
sb.AppendLine($"# FBX Bone Size: {o_fbxBoneSize}");
1299+
sb.AppendLine($"# FBX UVs as Diffuse Maps: {f_fbxUvsAsDiffuseMaps}");
12761300
}
12771301
else
12781302
{

0 commit comments

Comments
 (0)