Update asset export logic

- Disabled saving files with a unique id if they already exist. A unique id will only be added to files with identical names during export.
- Added an option to overwrite exisisting files.
- Fixed support of multiple model export using "Export selected objects (split)" option. (#43)
This commit is contained in:
VaDiM
2025-08-17 11:23:07 +03:00
parent 52b0a21181
commit f0a69025fe
11 changed files with 149 additions and 46 deletions

View File

@ -93,6 +93,7 @@ namespace AssetStudioCLI.Options
public static Option<AssetGroupOption> o_groupAssetsBy;
public static Option<FilenameFormat> o_filenameFormat;
public static Option<string> o_outputFolder;
public static Option<bool> f_overwriteExisting;
public static Option<bool> o_displayHelp;
//logger
public static Option<LoggerEvent> o_logLevel;
@ -254,6 +255,15 @@ namespace AssetStudioCLI.Options
optionExample: "",
optionHelpGroup: HelpGroups.General
);
f_overwriteExisting = new GroupedOption<bool>
(
optionDefaultValue: false,
optionName: "-r, --overwrite-existing",
optionDescription: "(Flag) If specified, Studio will overwrite existing files during asset export/dump\n",
optionExample: "",
optionHelpGroup: HelpGroups.General,
isFlag: true
);
o_displayHelp = new GroupedOption<bool>
(
optionDefaultValue: false,
@ -678,6 +688,11 @@ namespace AssetStudioCLI.Options
switch (flag)
{
case "-r":
case "--overwrite-existing":
f_overwriteExisting.Value = true;
flagIndexes.Add(i);
break;
case "--l2d-search-by-filename":
if (o_workMode.Value != WorkMode.Live2D)
{
@ -1403,7 +1418,8 @@ namespace AssetStudioCLI.Options
if (o_workMode.Value != WorkMode.Info)
{
sb.AppendLine($"# Asset Group Option: {o_groupAssetsBy}");
sb.AppendLine($"# Filename format: {o_filenameFormat}");
sb.AppendLine($"# Filename Format: {o_filenameFormat}");
sb.AppendLine($"# Overwrite Existing Files: {f_overwriteExisting}");
}
if (o_workMode.Value == WorkMode.Export)
{