From a0d8691331d95afa6ef32e91f72da44de392fb57 Mon Sep 17 00:00:00 2001 From: Razmoth <32140579+Razmoth@users.noreply.github.com> Date: Sun, 28 Jan 2024 21:50:59 +0400 Subject: [PATCH] - [GUI] Add option to reset settings. - [GUI] Fix bug with texture mapping in `Export Options`. --- AssetStudio.CLI/App.config | 2 +- AssetStudio.GUI/App.config | 12 +-- AssetStudio.GUI/ExportOptions.Designer.cs | 91 ++++++++++++++----- AssetStudio.GUI/ExportOptions.cs | 71 +++++++++++++-- AssetStudio.GUI/ExportOptions.resx | 8 +- AssetStudio.GUI/Exporter.cs | 6 +- AssetStudio.GUI/MainForm.cs | 11 ++- .../Properties/Settings.Designer.cs | 24 ++--- AssetStudio.GUI/Properties/Settings.settings | 6 +- AssetStudio.Utility/ModelConverter.cs | 7 +- 10 files changed, 164 insertions(+), 74 deletions(-) diff --git a/AssetStudio.CLI/App.config b/AssetStudio.CLI/App.config index e82a742..89578f6 100644 --- a/AssetStudio.CLI/App.config +++ b/AssetStudio.CLI/App.config @@ -21,8 +21,8 @@ + - \ No newline at end of file diff --git a/AssetStudio.GUI/App.config b/AssetStudio.GUI/App.config index 6295852..87366b3 100644 --- a/AssetStudio.GUI/App.config +++ b/AssetStudio.GUI/App.config @@ -106,21 +106,21 @@ True - - {"0": "", "1": "", "2": "", "3": "", "4": "", "5": "", "6": "", "7": ""} - {"UV0":{"Item1":true,"Item2":0},"UV1":{"Item1":true,"Item2":1},"UV2":{"Item1":false,"Item2":0},"UV3":{"Item1":false,"Item2":0},"UV4":{"Item1":false,"Item2":0},"UV5":{"Item1":false,"Item2":0},"UV6":{"Item1":false,"Item2":0},"UV7":{"Item1":false,"Item2":0}} - - {"Animation":{"Item1":true,"Item2":false},"AnimationClip":{"Item1":true,"Item2":true},"Animator":{"Item1":true,"Item2":true},"AnimatorController":{"Item1":true,"Item2":false},"AnimatorOverrideController":{"Item1":true,"Item2":false},"AssetBundle":{"Item1":true,"Item2":false},"AudioClip":{"Item1":true,"Item2":true},"Avatar":{"Item1":true,"Item2":false},"Font":{"Item1":true,"Item2":true},"GameObject":{"Item1":true,"Item2":false},"IndexObject":{"Item1":true,"Item2":false},"Material":{"Item1":true,"Item2":true},"Mesh":{"Item1":true,"Item2":true},"MeshFilter":{"Item1":true,"Item2":false},"MeshRenderer":{"Item1":true,"Item2":false},"MiHoYoBinData":{"Item1":true,"Item2":true},"MonoBehaviour":{"Item1":true,"Item2":true},"MonoScript":{"Item1":true,"Item2":false},"MovieTexture":{"Item1":true,"Item2":true},"PlayerSettings":{"Item1":true,"Item2":false},"RectTransform":{"Item1":true,"Item2":false},"Shader":{"Item1":true,"Item2":true},"SkinnedMeshRenderer":{"Item1":true,"Item2":false},"Sprite":{"Item1":true,"Item2":true},"SpriteAtlas":{"Item1":true,"Item2":false},"TextAsset":{"Item1":true,"Item2":true},"Texture2D":{"Item1":true,"Item2":true},"Transform":{"Item1":true,"Item2":false},"VideoClip":{"Item1":true,"Item2":true},"ResourceManager":{"Item1":true,"Item2":false}} - False 30 + + {"Animation":{"Item1":true,"Item2":false},"AnimationClip":{"Item1":true,"Item2":true},"Animator":{"Item1":true,"Item2":true},"AnimatorController":{"Item1":true,"Item2":false},"AnimatorOverrideController":{"Item1":true,"Item2":false},"AssetBundle":{"Item1":true,"Item2":false},"AudioClip":{"Item1":true,"Item2":true},"Avatar":{"Item1":true,"Item2":false},"Font":{"Item1":true,"Item2":true},"GameObject":{"Item1":true,"Item2":false},"IndexObject":{"Item1":true,"Item2":false},"Material":{"Item1":true,"Item2":true},"Mesh":{"Item1":true,"Item2":true},"MeshFilter":{"Item1":true,"Item2":false},"MeshRenderer":{"Item1":true,"Item2":false},"MiHoYoBinData":{"Item1":true,"Item2":true},"MonoBehaviour":{"Item1":true,"Item2":true},"MonoScript":{"Item1":true,"Item2":false},"MovieTexture":{"Item1":true,"Item2":true},"PlayerSettings":{"Item1":true,"Item2":false},"RectTransform":{"Item1":true,"Item2":false},"Shader":{"Item1":true,"Item2":true},"SkinnedMeshRenderer":{"Item1":true,"Item2":false},"Sprite":{"Item1":true,"Item2":true},"SpriteAtlas":{"Item1":true,"Item2":false},"TextAsset":{"Item1":true,"Item2":true},"Texture2D":{"Item1":true,"Item2":true},"Transform":{"Item1":true,"Item2":false},"VideoClip":{"Item1":true,"Item2":true},"ResourceManager":{"Item1":true,"Item2":false}} + + + + \ No newline at end of file diff --git a/AssetStudio.GUI/ExportOptions.Designer.cs b/AssetStudio.GUI/ExportOptions.Designer.cs index 61e88e6..7773ad9 100644 --- a/AssetStudio.GUI/ExportOptions.Designer.cs +++ b/AssetStudio.GUI/ExportOptions.Designer.cs @@ -37,7 +37,9 @@ namespace AssetStudio.GUI OKbutton = new Button(); Cancel = new Button(); groupBox1 = new GroupBox(); - texNameTextBox = new TextBox(); + removeTexNameButton = new Button(); + addTexNameButton = new Button(); + texNameComboBox = new ComboBox(); label10 = new Label(); texTypeComboBox = new ComboBox(); uvTypesComboBox = new ComboBox(); @@ -81,6 +83,7 @@ namespace AssetStudio.GUI exportAllNodes = new CheckBox(); eulerFilter = new CheckBox(); toolTip = new ToolTip(components); + Reset = new Button(); groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)key).BeginInit(); panel1.SuspendLayout(); @@ -116,7 +119,9 @@ namespace AssetStudio.GUI // groupBox1 // groupBox1.AutoSize = true; - groupBox1.Controls.Add(texNameTextBox); + groupBox1.Controls.Add(removeTexNameButton); + groupBox1.Controls.Add(addTexNameButton); + groupBox1.Controls.Add(texNameComboBox); groupBox1.Controls.Add(label10); groupBox1.Controls.Add(texTypeComboBox); groupBox1.Controls.Add(uvTypesComboBox); @@ -141,23 +146,44 @@ namespace AssetStudio.GUI groupBox1.Margin = new Padding(4); groupBox1.Name = "groupBox1"; groupBox1.Padding = new Padding(4); - groupBox1.Size = new System.Drawing.Size(271, 420); + groupBox1.Size = new System.Drawing.Size(271, 433); groupBox1.TabIndex = 9; groupBox1.TabStop = false; groupBox1.Text = "Export"; // - // texNameTextBox + // removeTexNameButton // - texNameTextBox.Location = new System.Drawing.Point(119, 374); - texNameTextBox.Name = "texNameTextBox"; - texNameTextBox.Size = new System.Drawing.Size(141, 23); - texNameTextBox.TabIndex = 37; - texNameTextBox.LostFocus += TexNameTextBox_LostFocus; + removeTexNameButton.Location = new System.Drawing.Point(186, 387); + removeTexNameButton.Name = "removeTexNameButton"; + removeTexNameButton.Size = new System.Drawing.Size(71, 23); + removeTexNameButton.TabIndex = 41; + removeTexNameButton.Text = "Remove"; + removeTexNameButton.UseVisualStyleBackColor = true; + removeTexNameButton.Click += RemoveTexNameButton_Click; + // + // addTexNameButton + // + addTexNameButton.Location = new System.Drawing.Point(199, 358); + addTexNameButton.Name = "addTexNameButton"; + addTexNameButton.Size = new System.Drawing.Size(42, 23); + addTexNameButton.TabIndex = 13; + addTexNameButton.Text = "Add"; + addTexNameButton.UseVisualStyleBackColor = true; + addTexNameButton.Click += AddTexNameButton_Click; + // + // texNameComboBox + // + texNameComboBox.FormattingEnabled = true; + texNameComboBox.Location = new System.Drawing.Point(8, 373); + texNameComboBox.Name = "texNameComboBox"; + texNameComboBox.Size = new System.Drawing.Size(81, 23); + texNameComboBox.TabIndex = 38; + texNameComboBox.SelectedIndexChanged += TexNameComboBox_SelectedIndexChanged; // // label10 // label10.AutoSize = true; - label10.Location = new System.Drawing.Point(7, 356); + label10.Location = new System.Drawing.Point(9, 355); label10.Margin = new Padding(4, 0, 4, 0); label10.Name = "label10"; label10.Size = new System.Drawing.Size(142, 15); @@ -169,9 +195,9 @@ namespace AssetStudio.GUI texTypeComboBox.DropDownStyle = ComboBoxStyle.DropDownList; texTypeComboBox.FormattingEnabled = true; texTypeComboBox.Items.AddRange(new object[] { "Diffuse", "NormalMap", "Specular", "Bump", "Ambient", "Emissive", "Reflection", "Displacement" }); - texTypeComboBox.Location = new System.Drawing.Point(7, 374); + texTypeComboBox.Location = new System.Drawing.Point(95, 373); texTypeComboBox.Name = "texTypeComboBox"; - texTypeComboBox.Size = new System.Drawing.Size(106, 23); + texTypeComboBox.Size = new System.Drawing.Size(79, 23); texTypeComboBox.TabIndex = 35; texTypeComboBox.SelectedIndexChanged += TexTypeComboBox_SelectedIndexChanged; texTypeComboBox.MouseHover += TexTypeComboBox_MouseHover; @@ -181,7 +207,7 @@ namespace AssetStudio.GUI uvTypesComboBox.DropDownStyle = ComboBoxStyle.DropDownList; uvTypesComboBox.FormattingEnabled = true; uvTypesComboBox.Items.AddRange(new object[] { "Diffuse", "NormalMap", "Specular", "Bump", "Ambient", "Emissive", "Reflection", "Displacement" }); - uvTypesComboBox.Location = new System.Drawing.Point(88, 330); + uvTypesComboBox.Location = new System.Drawing.Point(89, 329); uvTypesComboBox.Name = "uvTypesComboBox"; uvTypesComboBox.Size = new System.Drawing.Size(106, 23); uvTypesComboBox.TabIndex = 34; @@ -190,7 +216,7 @@ namespace AssetStudio.GUI // uvEnabledCheckBox // uvEnabledCheckBox.AutoSize = true; - uvEnabledCheckBox.Location = new System.Drawing.Point(200, 334); + uvEnabledCheckBox.Location = new System.Drawing.Point(201, 333); uvEnabledCheckBox.Name = "uvEnabledCheckBox"; uvEnabledCheckBox.Size = new System.Drawing.Size(60, 19); uvEnabledCheckBox.TabIndex = 33; @@ -203,7 +229,7 @@ namespace AssetStudio.GUI uvsComboBox.DropDownStyle = ComboBoxStyle.DropDownList; uvsComboBox.FormattingEnabled = true; uvsComboBox.Items.AddRange(new object[] { "UV0", "UV1", "UV2", "UV3", "UV4", "UV5", "UV6", "UV7" }); - uvsComboBox.Location = new System.Drawing.Point(7, 330); + uvsComboBox.Location = new System.Drawing.Point(8, 329); uvsComboBox.Name = "uvsComboBox"; uvsComboBox.Size = new System.Drawing.Size(75, 23); uvsComboBox.TabIndex = 32; @@ -213,7 +239,7 @@ namespace AssetStudio.GUI // canExportCheckBox // canExportCheckBox.AutoSize = true; - canExportCheckBox.Location = new System.Drawing.Point(200, 290); + canExportCheckBox.Location = new System.Drawing.Point(200, 287); canExportCheckBox.Name = "canExportCheckBox"; canExportCheckBox.Size = new System.Drawing.Size(60, 19); canExportCheckBox.TabIndex = 31; @@ -224,7 +250,7 @@ namespace AssetStudio.GUI // label8 // label8.AutoSize = true; - label8.Location = new System.Drawing.Point(7, 268); + label8.Location = new System.Drawing.Point(8, 267); label8.Margin = new Padding(4, 0, 4, 0); label8.Name = "label8"; label8.Size = new System.Drawing.Size(132, 15); @@ -234,7 +260,7 @@ namespace AssetStudio.GUI // canParseCheckBox // canParseCheckBox.AutoSize = true; - canParseCheckBox.Location = new System.Drawing.Point(140, 290); + canParseCheckBox.Location = new System.Drawing.Point(140, 287); canParseCheckBox.Name = "canParseCheckBox"; canParseCheckBox.Size = new System.Drawing.Size(54, 19); canParseCheckBox.TabIndex = 29; @@ -247,7 +273,7 @@ namespace AssetStudio.GUI typesComboBox.DropDownStyle = ComboBoxStyle.DropDownList; typesComboBox.FormattingEnabled = true; typesComboBox.Items.AddRange(new object[] { ClassIDType.Animation, ClassIDType.AnimationClip, ClassIDType.Animator, ClassIDType.AnimatorController, ClassIDType.AnimatorOverrideController, ClassIDType.AssetBundle, ClassIDType.AudioClip, ClassIDType.Avatar, ClassIDType.Font, ClassIDType.GameObject, ClassIDType.IndexObject, ClassIDType.Material, ClassIDType.Mesh, ClassIDType.MeshFilter, ClassIDType.MeshRenderer, ClassIDType.MiHoYoBinData, ClassIDType.MonoBehaviour, ClassIDType.MonoScript, ClassIDType.MovieTexture, ClassIDType.PlayerSettings, ClassIDType.RectTransform, ClassIDType.Shader, ClassIDType.SkinnedMeshRenderer, ClassIDType.Sprite, ClassIDType.SpriteAtlas, ClassIDType.TextAsset, ClassIDType.Texture2D, ClassIDType.Transform, ClassIDType.VideoClip, ClassIDType.ResourceManager }); - typesComboBox.Location = new System.Drawing.Point(7, 286); + typesComboBox.Location = new System.Drawing.Point(7, 285); typesComboBox.Name = "typesComboBox"; typesComboBox.Size = new System.Drawing.Size(127, 23); typesComboBox.TabIndex = 28; @@ -257,7 +283,7 @@ namespace AssetStudio.GUI // label6 // label6.AutoSize = true; - label6.Location = new System.Drawing.Point(9, 312); + label6.Location = new System.Drawing.Point(7, 311); label6.Margin = new Padding(4, 0, 4, 0); label6.Name = "label6"; label6.Size = new System.Drawing.Size(119, 15); @@ -279,7 +305,7 @@ namespace AssetStudio.GUI assetGroupOptions.DropDownStyle = ComboBoxStyle.DropDownList; assetGroupOptions.FormattingEnabled = true; assetGroupOptions.Items.AddRange(new object[] { "type name", "container path", "source file name", "do not group" }); - assetGroupOptions.Location = new System.Drawing.Point(8, 241); + assetGroupOptions.Location = new System.Drawing.Point(7, 240); assetGroupOptions.Margin = new Padding(4); assetGroupOptions.Name = "assetGroupOptions"; assetGroupOptions.Size = new System.Drawing.Size(173, 23); @@ -288,7 +314,7 @@ namespace AssetStudio.GUI // label7 // label7.AutoSize = true; - label7.Location = new System.Drawing.Point(8, 222); + label7.Location = new System.Drawing.Point(8, 221); label7.Margin = new Padding(4, 0, 4, 0); label7.Name = "label7"; label7.Size = new System.Drawing.Size(140, 15); @@ -364,7 +390,7 @@ namespace AssetStudio.GUI panel1.Controls.Add(tojpg); panel1.Controls.Add(topng); panel1.Controls.Add(tobmp); - panel1.Location = new System.Drawing.Point(18, 180); + panel1.Location = new System.Drawing.Point(24, 174); panel1.Margin = new Padding(4); panel1.Name = "panel1"; panel1.Size = new System.Drawing.Size(236, 38); @@ -651,11 +677,22 @@ namespace AssetStudio.GUI eulerFilter.Text = "EulerFilter"; eulerFilter.UseVisualStyleBackColor = true; // - // typesToolTip + // toolTip // + toolTip.AutomaticDelay = 1000; toolTip.UseAnimation = false; toolTip.UseFading = false; // + // Reset + // + Reset.Location = new System.Drawing.Point(300, 428); + Reset.Name = "Reset"; + Reset.Size = new System.Drawing.Size(88, 26); + Reset.TabIndex = 12; + Reset.Text = "Reset"; + Reset.UseVisualStyleBackColor = true; + Reset.Click += Reset_Click; + // // ExportOptions // AcceptButton = OKbutton; @@ -663,6 +700,7 @@ namespace AssetStudio.GUI AutoScaleMode = AutoScaleMode.Font; CancelButton = Cancel; ClientSize = new System.Drawing.Size(677, 467); + Controls.Add(Reset); Controls.Add(groupBox2); Controls.Add(groupBox1); Controls.Add(Cancel); @@ -737,7 +775,10 @@ namespace AssetStudio.GUI private ComboBox uvsComboBox; private Label label10; private ComboBox texTypeComboBox; - private TextBox texNameTextBox; private ToolTip toolTip; + private Button Reset; + private ComboBox texNameComboBox; + private Button addTexNameButton; + private Button removeTexNameButton; } } diff --git a/AssetStudio.GUI/ExportOptions.cs b/AssetStudio.GUI/ExportOptions.cs index 3665706..98cea48 100644 --- a/AssetStudio.GUI/ExportOptions.cs +++ b/AssetStudio.GUI/ExportOptions.cs @@ -9,9 +9,10 @@ namespace AssetStudio.GUI { public partial class ExportOptions : Form { + public bool Resetted = false; private Dictionary types = new Dictionary(); private Dictionary uvs = new Dictionary(); - private Dictionary texs = new Dictionary(); + private Dictionary texs = new Dictionary(); public ExportOptions() { InitializeComponent(); @@ -46,10 +47,22 @@ namespace AssetStudio.GUI minimalAssetMap.Checked = Properties.Settings.Default.minimalAssetMap; types = JsonConvert.DeserializeObject>(Properties.Settings.Default.types); uvs = JsonConvert.DeserializeObject>(Properties.Settings.Default.uvs); - texs = JsonConvert.DeserializeObject>(Properties.Settings.Default.texs); + + texTypeComboBox.SelectedIndex = 0; + + if (!string.IsNullOrEmpty(Properties.Settings.Default.texs)) + { + texs = JsonConvert.DeserializeObject>(Properties.Settings.Default.texs); + if (texs.Count > 0 ) + { + texNameComboBox.Items.AddRange(texs.Keys.ToArray()); + texNameComboBox.SelectedIndex = 0; + texTypeComboBox.SelectedIndex = texs.ElementAt(0).Value; + } + } + typesComboBox.SelectedIndex = 0; uvsComboBox.SelectedIndex = 0; - texTypeComboBox.SelectedIndex = 0; } private void OKbutton_Click(object sender, EventArgs e) @@ -148,19 +161,49 @@ namespace AssetStudio.GUI } } - private void TexTypeComboBox_SelectedIndexChanged(object sender, EventArgs e) + private void TexNameComboBox_SelectedIndexChanged(object sender, EventArgs e) { - if (sender is ComboBox comboBox && texs.TryGetValue(comboBox.SelectedIndex, out var name)) + if (!string.IsNullOrEmpty(texNameComboBox.SelectedItem?.ToString()) && texs.TryGetValue(texNameComboBox.SelectedItem?.ToString(), out var type)) { - texNameTextBox.Text = name; + texTypeComboBox.SelectedIndex = type; } } - private void TexNameTextBox_LostFocus(object sender, EventArgs e) + private void AddTexNameButton_Click(object sender, EventArgs e) { - if (sender is TextBox textBox && texs.ContainsKey(texTypeComboBox.SelectedIndex)) + if (!string.IsNullOrEmpty(texNameComboBox.Text) && !texs.ContainsKey(texNameComboBox.Text)) { - texs[texTypeComboBox.SelectedIndex] = textBox.Text; + texs[texNameComboBox.Text] = texTypeComboBox.SelectedIndex; + texNameComboBox.Items.Add(texNameComboBox.Text); + texNameComboBox.SelectedIndex = texNameComboBox.Items.Count - 1; + ActiveControl = null; + } + } + + private void RemoveTexNameButton_Click(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(texNameComboBox.SelectedItem?.ToString()) && texs.ContainsKey(texNameComboBox.SelectedItem?.ToString())) + { + texs.Remove(texNameComboBox.SelectedItem?.ToString()); + texNameComboBox.Items.Remove(texNameComboBox.SelectedItem?.ToString()); + ActiveControl = null; + if (texNameComboBox.Items.Count > 0) + { + texNameComboBox.SelectedIndex = 0; + } + else + { + texNameComboBox.Text = ""; + texTypeComboBox.SelectedIndex = 0; + } + } + } + + private void TexTypeComboBox_SelectedIndexChanged(object sender, EventArgs e) + { + if (sender is ComboBox comboBox && !string.IsNullOrEmpty(texNameComboBox.SelectedItem?.ToString()) && texs.ContainsKey(texNameComboBox.SelectedItem?.ToString())) + { + texs[texNameComboBox.SelectedItem?.ToString()] = comboBox.SelectedIndex; } } @@ -193,7 +236,7 @@ namespace AssetStudio.GUI var sb = new StringBuilder(); foreach (var tex in texs) { - sb.Append($"{texTypeComboBox.Items[tex.Key]}: {tex.Value}\n"); + sb.Append($"{tex.Key}: {texTypeComboBox.Items[tex.Value]}\n"); } toolTip.ToolTipTitle = "Texture options status:"; @@ -206,6 +249,14 @@ namespace AssetStudio.GUI toolTip.SetToolTip(key, "Key in Hex"); } + private void Reset_Click(object sender, EventArgs e) + { + Properties.Settings.Default.Reset(); + DialogResult = DialogResult.Cancel; + Resetted = true; + Close(); + } + private void Cancel_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; diff --git a/AssetStudio.GUI/ExportOptions.resx b/AssetStudio.GUI/ExportOptions.resx index 89e9704..28816d7 100644 --- a/AssetStudio.GUI/ExportOptions.resx +++ b/AssetStudio.GUI/ExportOptions.resx @@ -117,15 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17 - - 162, 17 - - - 272, 17 - 57 diff --git a/AssetStudio.GUI/Exporter.cs b/AssetStudio.GUI/Exporter.cs index 740766b..29086d6 100644 --- a/AssetStudio.GUI/Exporter.cs +++ b/AssetStudio.GUI/Exporter.cs @@ -365,7 +365,7 @@ namespace AssetStudio.GUI game = Studio.Game, collectAnimations = Properties.Settings.Default.collectAnimations, uvs = JsonConvert.DeserializeObject>(Properties.Settings.Default.uvs), - texs = JsonConvert.DeserializeObject>(Properties.Settings.Default.texs), + texs = JsonConvert.DeserializeObject>(Properties.Settings.Default.texs), }; var convert = animationList != null ? new ModelConverter(m_Animator, options, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) @@ -391,7 +391,7 @@ namespace AssetStudio.GUI game = Studio.Game, collectAnimations = Properties.Settings.Default.collectAnimations, uvs = JsonConvert.DeserializeObject>(Properties.Settings.Default.uvs), - texs = JsonConvert.DeserializeObject>(Properties.Settings.Default.texs), + texs = JsonConvert.DeserializeObject>(Properties.Settings.Default.texs), }; var convert = animationList != null ? new ModelConverter(gameObject, options, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) @@ -416,7 +416,7 @@ namespace AssetStudio.GUI game = Studio.Game, collectAnimations = Properties.Settings.Default.collectAnimations, uvs = JsonConvert.DeserializeObject>(Properties.Settings.Default.uvs), - texs = JsonConvert.DeserializeObject>(Properties.Settings.Default.texs), + texs = JsonConvert.DeserializeObject>(Properties.Settings.Default.texs), }; var convert = animationList != null ? new ModelConverter(rootName, gameObject, options, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) diff --git a/AssetStudio.GUI/MainForm.cs b/AssetStudio.GUI/MainForm.cs index d5c8def..0847454 100644 --- a/AssetStudio.GUI/MainForm.cs +++ b/AssetStudio.GUI/MainForm.cs @@ -550,7 +550,12 @@ namespace AssetStudio.GUI private void showExpOpt_Click(object sender, EventArgs e) { var exportOpt = new ExportOptions(); - exportOpt.ShowDialog(this); + if (exportOpt.ShowDialog(this) == DialogResult.OK && exportOpt.Resetted) + { + InitializeExportOptions(); + InitializeLogger(); + InitalizeOptions(); + } } private void assetListView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) @@ -1308,7 +1313,7 @@ namespace AssetStudio.GUI game = Studio.Game, collectAnimations = Properties.Settings.Default.collectAnimations, uvs = JsonConvert.DeserializeObject>(Properties.Settings.Default.uvs), - texs = JsonConvert.DeserializeObject>(Properties.Settings.Default.texs), + texs = JsonConvert.DeserializeObject>(Properties.Settings.Default.texs), }; var model = new ModelConverter(m_GameObject, options, Array.Empty()); PreviewModel(model); @@ -1321,7 +1326,7 @@ namespace AssetStudio.GUI game = Studio.Game, collectAnimations = Properties.Settings.Default.collectAnimations, uvs = JsonConvert.DeserializeObject>(Properties.Settings.Default.uvs), - texs = JsonConvert.DeserializeObject>(Properties.Settings.Default.texs), + texs = JsonConvert.DeserializeObject>(Properties.Settings.Default.texs), }; var model = new ModelConverter(m_Animator, options, Array.Empty()); PreviewModel(model); diff --git a/AssetStudio.GUI/Properties/Settings.Designer.cs b/AssetStudio.GUI/Properties/Settings.Designer.cs index d3cd12d..46bc747 100644 --- a/AssetStudio.GUI/Properties/Settings.Designer.cs +++ b/AssetStudio.GUI/Properties/Settings.Designer.cs @@ -431,18 +431,6 @@ namespace AssetStudio.GUI.Properties { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("{}")] - public string texs { - get { - return ((string)(this["texs"])); - } - set { - this["texs"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("{\"UV0\":{\"Item1\":true,\"Item2\":0},\"UV1\":{\"Item1\":true,\"Item2\":1},\"UV2\":{\"Item1\":fal" + @@ -493,5 +481,17 @@ namespace AssetStudio.GUI.Properties { this["types"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string texs { + get { + return ((string)(this["texs"])); + } + set { + this["texs"] = value; + } + } } } diff --git a/AssetStudio.GUI/Properties/Settings.settings b/AssetStudio.GUI/Properties/Settings.settings index c149645..af433a5 100644 --- a/AssetStudio.GUI/Properties/Settings.settings +++ b/AssetStudio.GUI/Properties/Settings.settings @@ -104,9 +104,6 @@ True - - {} - {"UV0":{"Item1":true,"Item2":0},"UV1":{"Item1":true,"Item2":1},"UV2":{"Item1":false,"Item2":0},"UV3":{"Item1":false,"Item2":0},"UV4":{"Item1":false,"Item2":0},"UV5":{"Item1":false,"Item2":0},"UV6":{"Item1":false,"Item2":0},"UV7":{"Item1":false,"Item2":0}} @@ -119,5 +116,8 @@ {"Animation":{"Item1":true,"Item2":false},"AnimationClip":{"Item1":true,"Item2":true},"Animator":{"Item1":true,"Item2":true},"AnimatorController":{"Item1":true,"Item2":false},"AnimatorOverrideController":{"Item1":true,"Item2":false},"AssetBundle":{"Item1":true,"Item2":false},"AudioClip":{"Item1":true,"Item2":true},"Avatar":{"Item1":true,"Item2":false},"Font":{"Item1":true,"Item2":true},"GameObject":{"Item1":true,"Item2":false},"IndexObject":{"Item1":true,"Item2":false},"Material":{"Item1":true,"Item2":true},"Mesh":{"Item1":true,"Item2":true},"MeshFilter":{"Item1":true,"Item2":false},"MeshRenderer":{"Item1":true,"Item2":false},"MiHoYoBinData":{"Item1":true,"Item2":true},"MonoBehaviour":{"Item1":true,"Item2":true},"MonoScript":{"Item1":true,"Item2":false},"MovieTexture":{"Item1":true,"Item2":true},"PlayerSettings":{"Item1":true,"Item2":false},"RectTransform":{"Item1":true,"Item2":false},"Shader":{"Item1":true,"Item2":true},"SkinnedMeshRenderer":{"Item1":true,"Item2":false},"Sprite":{"Item1":true,"Item2":true},"SpriteAtlas":{"Item1":true,"Item2":false},"TextAsset":{"Item1":true,"Item2":true},"Texture2D":{"Item1":true,"Item2":true},"Transform":{"Item1":true,"Item2":false},"VideoClip":{"Item1":true,"Item2":true},"ResourceManager":{"Item1":true,"Item2":false}} + + + \ No newline at end of file diff --git a/AssetStudio.Utility/ModelConverter.cs b/AssetStudio.Utility/ModelConverter.cs index 8a542c5..61c3ba7 100644 --- a/AssetStudio.Utility/ModelConverter.cs +++ b/AssetStudio.Utility/ModelConverter.cs @@ -712,9 +712,8 @@ namespace AssetStudio iMat.Textures.Add(texture); int dest = -1; - var entry = options.texs.FirstOrDefault(x => x.Value == texEnv.Key); - if (!entry.Equals(default)) - dest = entry.Key; + if (options.texs.TryGetValue(texEnv.Key, out var target)) + dest = target; else if (texEnv.Key == "_MainTex") dest = 0; else if (texEnv.Key == "_BumpMap") @@ -1174,7 +1173,7 @@ namespace AssetStudio public Game game; public bool collectAnimations; public Dictionary uvs; - public Dictionary texs; + public Dictionary texs; } } }