mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
Add grouping option with full container path
* [GUI] - "container path full (with name)" * [CLI] - "containerFull" (https://github.com/Perfare/AssetStudio/issues/815)
This commit is contained in:
parent
02e46eaa0d
commit
c7356875f9
@ -28,6 +28,7 @@ namespace AssetStudioCLI.Options
|
|||||||
None,
|
None,
|
||||||
TypeName,
|
TypeName,
|
||||||
ContainerPath,
|
ContainerPath,
|
||||||
|
ContainerPathFull,
|
||||||
SourceFileName,
|
SourceFileName,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,10 +156,11 @@ namespace AssetStudioCLI.Options
|
|||||||
optionDefaultValue: AssetGroupOption.ContainerPath,
|
optionDefaultValue: AssetGroupOption.ContainerPath,
|
||||||
optionName: "-g, --group-option <value>",
|
optionName: "-g, --group-option <value>",
|
||||||
optionDescription: "Specify the way in which exported assets should be grouped\n" +
|
optionDescription: "Specify the way in which exported assets should be grouped\n" +
|
||||||
"<Value: none | type | container(default) | filename>\n" +
|
"<Value: none | type | container(default) | containerFull | filename>\n" +
|
||||||
"None - Do not group exported assets\n" +
|
"None - Do not group exported assets\n" +
|
||||||
"Type - Group exported assets by type name\n" +
|
"Type - Group exported assets by type name\n" +
|
||||||
"Container - Group exported assets by container path\n" +
|
"Container - Group exported assets by container path\n" +
|
||||||
|
"ContainerFull - Group exported assets by full container path (e.g. with prefab name)\n" +
|
||||||
"Filename - Group exported assets by source file name\n" +
|
"Filename - Group exported assets by source file name\n" +
|
||||||
"Example: \"-g container\"\n",
|
"Example: \"-g container\"\n",
|
||||||
optionHelpGroup: HelpGroups.General
|
optionHelpGroup: HelpGroups.General
|
||||||
@ -475,6 +477,9 @@ namespace AssetStudioCLI.Options
|
|||||||
case "container":
|
case "container":
|
||||||
o_groupAssetsBy.Value = AssetGroupOption.ContainerPath;
|
o_groupAssetsBy.Value = AssetGroupOption.ContainerPath;
|
||||||
break;
|
break;
|
||||||
|
case "containerfull":
|
||||||
|
o_groupAssetsBy.Value = AssetGroupOption.ContainerPathFull;
|
||||||
|
break;
|
||||||
case "filename":
|
case "filename":
|
||||||
o_groupAssetsBy.Value = AssetGroupOption.SourceFileName;
|
o_groupAssetsBy.Value = AssetGroupOption.SourceFileName;
|
||||||
break;
|
break;
|
||||||
@ -734,7 +739,7 @@ namespace AssetStudioCLI.Options
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine($"# {appAssembly.Name}\n# Based on AssetStudio Mod v{appAssembly.Version}\n");
|
Console.WriteLine($"# {appAssembly.Name}\n# Based on AssetStudioMod v{appAssembly.Version}\n");
|
||||||
Console.WriteLine($"{usage}\n\n{helpMessage}");
|
Console.WriteLine($"{usage}\n\n{helpMessage}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,18 +261,24 @@ namespace AssetStudioCLI
|
|||||||
var toExportCount = parsedAssetsList.Count;
|
var toExportCount = parsedAssetsList.Count;
|
||||||
var exportedCount = 0;
|
var exportedCount = 0;
|
||||||
|
|
||||||
|
var groupOption = options.o_groupAssetsBy.Value;
|
||||||
foreach (var asset in parsedAssetsList)
|
foreach (var asset in parsedAssetsList)
|
||||||
{
|
{
|
||||||
string exportPath;
|
string exportPath;
|
||||||
switch (options.o_groupAssetsBy.Value)
|
switch (groupOption)
|
||||||
{
|
{
|
||||||
case AssetGroupOption.TypeName:
|
case AssetGroupOption.TypeName:
|
||||||
exportPath = Path.Combine(savePath, asset.TypeString);
|
exportPath = Path.Combine(savePath, asset.TypeString);
|
||||||
break;
|
break;
|
||||||
case AssetGroupOption.ContainerPath:
|
case AssetGroupOption.ContainerPath:
|
||||||
|
case AssetGroupOption.ContainerPathFull:
|
||||||
if (!string.IsNullOrEmpty(asset.Container))
|
if (!string.IsNullOrEmpty(asset.Container))
|
||||||
{
|
{
|
||||||
exportPath = Path.Combine(savePath, Path.GetDirectoryName(asset.Container));
|
exportPath = Path.Combine(savePath, Path.GetDirectoryName(asset.Container));
|
||||||
|
if (groupOption == AssetGroupOption.ContainerPathFull)
|
||||||
|
{
|
||||||
|
exportPath = Path.Combine(exportPath, Path.GetFileNameWithoutExtension(asset.Container));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
3
AssetStudioGUI/ExportOptions.Designer.cs
generated
3
AssetStudioGUI/ExportOptions.Designer.cs
generated
@ -154,11 +154,12 @@
|
|||||||
this.assetGroupOptions.Items.AddRange(new object[] {
|
this.assetGroupOptions.Items.AddRange(new object[] {
|
||||||
"type name",
|
"type name",
|
||||||
"container path",
|
"container path",
|
||||||
|
"container path full (with name)",
|
||||||
"source file name",
|
"source file name",
|
||||||
"do not group"});
|
"do not group"});
|
||||||
this.assetGroupOptions.Location = new System.Drawing.Point(6, 35);
|
this.assetGroupOptions.Location = new System.Drawing.Point(6, 35);
|
||||||
this.assetGroupOptions.Name = "assetGroupOptions";
|
this.assetGroupOptions.Name = "assetGroupOptions";
|
||||||
this.assetGroupOptions.Size = new System.Drawing.Size(149, 21);
|
this.assetGroupOptions.Size = new System.Drawing.Size(165, 21);
|
||||||
this.assetGroupOptions.TabIndex = 8;
|
this.assetGroupOptions.TabIndex = 8;
|
||||||
//
|
//
|
||||||
// label6
|
// label6
|
||||||
|
@ -32,6 +32,14 @@ namespace AssetStudioGUI
|
|||||||
XML
|
XML
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal enum AssetGroupOption
|
||||||
|
{
|
||||||
|
TypeName,
|
||||||
|
ContainerPath,
|
||||||
|
ContainerPathFull,
|
||||||
|
SourceFileName
|
||||||
|
}
|
||||||
|
|
||||||
internal enum ListSearchFilterMode
|
internal enum ListSearchFilterMode
|
||||||
{
|
{
|
||||||
Include,
|
Include,
|
||||||
@ -389,25 +397,31 @@ namespace AssetStudioGUI
|
|||||||
int exportedCount = 0;
|
int exportedCount = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Progress.Reset();
|
Progress.Reset();
|
||||||
|
var groupOption = (AssetGroupOption)Properties.Settings.Default.assetGroupOption;
|
||||||
foreach (var asset in toExportAssets)
|
foreach (var asset in toExportAssets)
|
||||||
{
|
{
|
||||||
string exportPath;
|
string exportPath;
|
||||||
switch (Properties.Settings.Default.assetGroupOption)
|
switch (groupOption)
|
||||||
{
|
{
|
||||||
case 0: //type name
|
case AssetGroupOption.TypeName:
|
||||||
exportPath = Path.Combine(savePath, asset.TypeString);
|
exportPath = Path.Combine(savePath, asset.TypeString);
|
||||||
break;
|
break;
|
||||||
case 1: //container path
|
case AssetGroupOption.ContainerPath:
|
||||||
|
case AssetGroupOption.ContainerPathFull:
|
||||||
if (!string.IsNullOrEmpty(asset.Container))
|
if (!string.IsNullOrEmpty(asset.Container))
|
||||||
{
|
{
|
||||||
exportPath = Path.Combine(savePath, Path.GetDirectoryName(asset.Container));
|
exportPath = Path.Combine(savePath, Path.GetDirectoryName(asset.Container));
|
||||||
|
if (groupOption == AssetGroupOption.ContainerPathFull)
|
||||||
|
{
|
||||||
|
exportPath = Path.Combine(exportPath, Path.GetFileNameWithoutExtension(asset.Container));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
exportPath = savePath;
|
exportPath = savePath;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: //source file
|
case AssetGroupOption.SourceFileName:
|
||||||
if (string.IsNullOrEmpty(asset.SourceFile.originalPath))
|
if (string.IsNullOrEmpty(asset.SourceFile.originalPath))
|
||||||
{
|
{
|
||||||
exportPath = Path.Combine(savePath, asset.SourceFile.fileName + "_export");
|
exportPath = Path.Combine(savePath, asset.SourceFile.fileName + "_export");
|
||||||
|
Loading…
Reference in New Issue
Block a user