diff --git a/AssetStudioCLI/Options/CLIOptions.cs b/AssetStudioCLI/Options/CLIOptions.cs index 4c22cd4..0075b04 100644 --- a/AssetStudioCLI/Options/CLIOptions.cs +++ b/AssetStudioCLI/Options/CLIOptions.cs @@ -115,8 +115,9 @@ namespace AssetStudioCLI.Options //live2d public static Option o_l2dGroupOption; public static Option o_l2dMotionMode; - public static Option f_l2dAssetSearchByFilename; public static Option f_l2dForceBezier; + public static Option f_l2dAssetSearchByFilename; + public static Option f_l2dFilterTextures; //fbx public static Option o_fbxScaleFactor; public static Option o_fbxBoneSize; @@ -365,18 +366,6 @@ namespace AssetStudioCLI.Options optionExample: "Example: \"--l2d-motion-mode animationClip\"\n", optionHelpGroup: HelpGroups.Live2D ); - f_l2dAssetSearchByFilename = new GroupedOption - ( - optionDefaultValue: false, - optionName: "--l2d-search-by-filename", - optionDescription: "(Flag) If specified, Studio will search for model-related Live2D assets by file name\n" + - "rather than by container\n" + - "(Preferred option if all l2d assets of a single model are stored in a single file\n" + - "or containers are obfuscated)\n", - optionExample: "", - optionHelpGroup: HelpGroups.Live2D, - isFlag: true - ); f_l2dForceBezier = new GroupedOption ( optionDefaultValue: false, @@ -387,6 +376,28 @@ namespace AssetStudioCLI.Options optionHelpGroup: HelpGroups.Live2D, isFlag: true ); + f_l2dAssetSearchByFilename = new GroupedOption + ( + optionDefaultValue: false, + optionName: "--l2d-search-by-filename", + optionDescription: "(Flag) If specified, Studio will search for model-related Live2D assets by file name\n" + + "rather than by container\n" + + "(Preferred option if all l2d assets of a single model are stored in a single file\n" + + "or containers are obfuscated)\n", + optionExample: "", + optionHelpGroup: HelpGroups.Live2D, + isFlag: true + ); + f_l2dFilterTextures = new GroupedOption + ( + optionDefaultValue: false, + optionName: "--l2d-filter-textures", + optionDescription: "(Flag) If specified, Studio will only export model textures with \"texture\"\nin their names\n" + + "(Only when \"--l2d-search-by-filename\" flag is used)", + optionExample: "", + optionHelpGroup: HelpGroups.Live2D, + isFlag: true + ); #endregion #region Init FBX Options @@ -785,6 +796,16 @@ namespace AssetStudioCLI.Options f_overwriteExisting.Value = true; flagIndexes.Add(i); break; + case "--l2d-smooth-motions": + if (o_workMode.Value != WorkMode.Live2D) + { + 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_l2dForceBezier.Value = true; + flagIndexes.Add(i); + break; case "--l2d-search-by-filename": if (o_workMode.Value != WorkMode.Live2D) { @@ -795,14 +816,14 @@ namespace AssetStudioCLI.Options f_l2dAssetSearchByFilename.Value = true; flagIndexes.Add(i); break; - case "--l2d-smooth-motions": + case "--l2d-filter-textures": if (o_workMode.Value != WorkMode.Live2D) { 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_l2dForceBezier.Value = true; + f_l2dFilterTextures.Value = true; flagIndexes.Add(i); break; case "--fbx-dump-mats": @@ -1621,6 +1642,7 @@ namespace AssetStudioCLI.Options sb.AppendLine($"# Filter Exclusion Mode: {f_filterExcludeMode}"); sb.AppendLine($"# Model Group Option: {o_l2dGroupOption}"); sb.AppendFormat("# Search Model-related Assets by: {0}\n", f_l2dAssetSearchByFilename.Value ? "FileName" : "Container"); + sb.AppendLine($"# Filter Textures: {f_l2dFilterTextures}"); sb.AppendLine($"# Motion Export Method: {o_l2dMotionMode}"); sb.AppendLine($"# Smooth Motions: {f_l2dForceBezier}"); sb.AppendLine($"# Assembly Path: \"{o_assemblyPath}\""); diff --git a/AssetStudioCLI/Studio.cs b/AssetStudioCLI/Studio.cs index ec1fc62..50adbb6 100644 --- a/AssetStudioCLI/Studio.cs +++ b/AssetStudioCLI/Studio.cs @@ -1193,6 +1193,7 @@ namespace AssetStudioCLI MotionMode = CLIOptions.o_l2dMotionMode.Value, ForceBezier = CLIOptions.f_l2dForceBezier.Value, SearchByFilename = CLIOptions.f_l2dAssetSearchByFilename.Value, + FilterTextures = CLIOptions.f_l2dFilterTextures.Value, }; if (l2dAssetsManager.ModelDict.Keys.First().serializedType?.m_Type == null && CLIOptions.o_assemblyPath.Value == "") { diff --git a/AssetStudioGUI/ExportOptionsForm.Designer.cs b/AssetStudioGUI/ExportOptionsForm.Designer.cs index 946b1d5..f99be89 100644 --- a/AssetStudioGUI/ExportOptionsForm.Designer.cs +++ b/AssetStudioGUI/ExportOptionsForm.Designer.cs @@ -80,6 +80,7 @@ this.exportAllNodes = new System.Windows.Forms.CheckBox(); this.eulerFilter = new System.Windows.Forms.CheckBox(); this.optionTooltip = new System.Windows.Forms.ToolTip(this.components); + this.l2dFilterTexturesCheckBox = new System.Windows.Forms.CheckBox(); this.optionsTabControl = new System.Windows.Forms.TabControl(); this.generalTabPage = new System.Windows.Forms.TabPage(); this.panel2 = new System.Windows.Forms.Panel(); @@ -399,6 +400,7 @@ this.optionTooltip.SetToolTip(this.l2dAssetSearchByFilenameCheckBox, "Preferred option if all l2d assets of a single model are stored in a single file " + "or containers are obfuscated"); this.l2dAssetSearchByFilenameCheckBox.UseVisualStyleBackColor = true; + this.l2dAssetSearchByFilenameCheckBox.CheckedChanged += new System.EventHandler(this.l2dAssetSearchByFilenameCheckBox_CheckedChanged); // // l2dModelGroupComboBox // @@ -765,6 +767,22 @@ this.eulerFilter.Text = "EulerFilter"; this.eulerFilter.UseVisualStyleBackColor = true; // + // l2dFilterTexturesCheckBox + // + this.l2dFilterTexturesCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.l2dFilterTexturesCheckBox.AutoSize = true; + this.l2dFilterTexturesCheckBox.Checked = true; + this.l2dFilterTexturesCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.l2dFilterTexturesCheckBox.Location = new System.Drawing.Point(7, 166); + this.l2dFilterTexturesCheckBox.Name = "l2dFilterTexturesCheckBox"; + this.l2dFilterTexturesCheckBox.Size = new System.Drawing.Size(146, 19); + this.l2dFilterTexturesCheckBox.TabIndex = 6; + this.l2dFilterTexturesCheckBox.Text = "Filter textures by name"; + this.optionTooltip.SetToolTip(this.l2dFilterTexturesCheckBox, "If specified, Studio will only export model textures with \"texture\" in their name" + + "s"); + this.l2dFilterTexturesCheckBox.UseVisualStyleBackColor = true; + // // optionsTabControl // this.optionsTabControl.Controls.Add(this.generalTabPage); @@ -881,6 +899,7 @@ // live2DTabPage // this.live2DTabPage.BackColor = System.Drawing.SystemColors.Menu; + this.live2DTabPage.Controls.Add(this.l2dFilterTexturesCheckBox); this.live2DTabPage.Controls.Add(this.l2dAssetSearchByFilenameCheckBox); this.live2DTabPage.Controls.Add(this.l2dModelGroupLabel); this.live2DTabPage.Controls.Add(this.l2dModelGroupComboBox); @@ -1013,5 +1032,6 @@ private System.Windows.Forms.Panel panel2; private System.Windows.Forms.CheckBox keepSpriteSizeCheckBox; private System.Windows.Forms.CheckBox dumpMaterialsCheckBox; + private System.Windows.Forms.CheckBox l2dFilterTexturesCheckBox; } } \ No newline at end of file diff --git a/AssetStudioGUI/ExportOptionsForm.cs b/AssetStudioGUI/ExportOptionsForm.cs index 4362858..53d5cac 100644 --- a/AssetStudioGUI/ExportOptionsForm.cs +++ b/AssetStudioGUI/ExportOptionsForm.cs @@ -33,10 +33,12 @@ namespace AssetStudioGUI rawByteArrayFromMono.Checked = Properties.Settings.Default.rawByteArrayFromMono; l2dModelGroupComboBox.SelectedIndex = (int)Properties.Settings.Default.l2dModelGroupOption; - l2dAssetSearchByFilenameCheckBox.Checked = Properties.Settings.Default.l2dAssetSearchByFilename; var defaultMotionMode = Properties.Settings.Default.l2dMotionMode.ToString(); ((RadioButton)l2dMotionExportMethodPanel.Controls.Cast().First(x => x.AccessibleName == defaultMotionMode)).Checked = true; l2dForceBezierCheckBox.Checked = Properties.Settings.Default.l2dForceBezier; + l2dAssetSearchByFilenameCheckBox.Checked = Properties.Settings.Default.l2dAssetSearchByFilename; + l2dFilterTexturesCheckBox.Checked = Properties.Settings.Default.l2dFilterTextures; + l2dFilterTexturesCheckBox.Enabled = l2dAssetSearchByFilenameCheckBox.Checked; SetFromFbxSettings(Exporter.FbxSettings); } @@ -59,10 +61,11 @@ namespace AssetStudioGUI Properties.Settings.Default.rawByteArrayFromMono = rawByteArrayFromMono.Checked; Properties.Settings.Default.l2dModelGroupOption = (CubismLive2DExtractor.Live2DModelGroupOption)l2dModelGroupComboBox.SelectedIndex; - Properties.Settings.Default.l2dAssetSearchByFilename = l2dAssetSearchByFilenameCheckBox.Checked; var checkedMotionMode = (RadioButton)l2dMotionExportMethodPanel.Controls.Cast().First(x => ((RadioButton)x).Checked); Properties.Settings.Default.l2dMotionMode = (CubismLive2DExtractor.Live2DMotionMode)Enum.Parse(typeof(CubismLive2DExtractor.Live2DMotionMode), checkedMotionMode.AccessibleName); Properties.Settings.Default.l2dForceBezier = l2dForceBezierCheckBox.Checked; + Properties.Settings.Default.l2dAssetSearchByFilename = l2dAssetSearchByFilenameCheckBox.Checked; + Properties.Settings.Default.l2dFilterTextures = l2dFilterTexturesCheckBox.Checked; Exporter.FbxSettings.EulerFilter = eulerFilter.Checked; Exporter.FbxSettings.FilterPrecision = (float)filterPrecision.Value; @@ -157,6 +160,11 @@ namespace AssetStudioGUI uvIndicesCheckedListBox_SelectedIndexChanged(sender, e); } + private void l2dAssetSearchByFilenameCheckBox_CheckedChanged(object sender, EventArgs e) + { + l2dFilterTexturesCheckBox.Enabled = l2dAssetSearchByFilenameCheckBox.Checked; + } + //highDpi workaround (net472/.net-win7) private void ExportOptions_Load(object sender, EventArgs e) { diff --git a/AssetStudioGUI/Properties/Settings.Designer.cs b/AssetStudioGUI/Properties/Settings.Designer.cs index 3f40ec4..d965712 100644 --- a/AssetStudioGUI/Properties/Settings.Designer.cs +++ b/AssetStudioGUI/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace AssetStudioGUI.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "18.5.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "18.7.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -394,5 +394,17 @@ namespace AssetStudioGUI.Properties { this["keepSpriteSize"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool l2dFilterTextures { + get { + return ((bool)(this["l2dFilterTextures"])); + } + set { + this["l2dFilterTextures"] = value; + } + } } } diff --git a/AssetStudioGUI/Properties/Settings.settings b/AssetStudioGUI/Properties/Settings.settings index 729f2d0..f43fc41 100644 --- a/AssetStudioGUI/Properties/Settings.settings +++ b/AssetStudioGUI/Properties/Settings.settings @@ -95,5 +95,8 @@ True + + True + \ No newline at end of file diff --git a/AssetStudioGUI/Studio.cs b/AssetStudioGUI/Studio.cs index 825784e..27d42c1 100644 --- a/AssetStudioGUI/Studio.cs +++ b/AssetStudioGUI/Studio.cs @@ -1168,6 +1168,7 @@ namespace AssetStudioGUI MotionMode = Properties.Settings.Default.l2dMotionMode, ForceBezier = Properties.Settings.Default.l2dForceBezier, SearchByFilename = Properties.Settings.Default.l2dAssetSearchByFilename, + FilterTextures = Properties.Settings.Default.l2dFilterTextures, }; if (selClipMotions != null) extractorOptions.MotionMode = Live2DMotionMode.AnimationClipV2; diff --git a/AssetStudioUtility/CubismLive2DExtractor/Live2DExtractor.cs b/AssetStudioUtility/CubismLive2DExtractor/Live2DExtractor.cs index a1dffb4..200ba37 100644 --- a/AssetStudioUtility/CubismLive2DExtractor/Live2DExtractor.cs +++ b/AssetStudioUtility/CubismLive2DExtractor/Live2DExtractor.cs @@ -256,7 +256,7 @@ namespace CubismLive2DExtractor { Texture2Ds = renderTextureSet.ToList(); } - else if (Options.SearchByFilename) + else if (Options.SearchByFilename && Options.FilterTextures) { Texture2Ds = Texture2Ds.Where(x => x.m_Name.ToLower().Contains("texture")).ToList(); } diff --git a/AssetStudioUtility/CubismLive2DExtractor/Live2DExtractorOptions.cs b/AssetStudioUtility/CubismLive2DExtractor/Live2DExtractorOptions.cs index 4b9d7e3..74fc1c7 100644 --- a/AssetStudioUtility/CubismLive2DExtractor/Live2DExtractorOptions.cs +++ b/AssetStudioUtility/CubismLive2DExtractor/Live2DExtractorOptions.cs @@ -11,5 +11,6 @@ namespace CubismLive2DExtractor public Live2DMotionMode MotionMode { get; set; } = Live2DMotionMode.MonoBehaviour; public bool ForceBezier { get; set; } public bool SearchByFilename { get; set; } + public bool FilterTextures { get; set; } } }