diff --git a/AssetStudio.CLI/Exporter.cs b/AssetStudio.CLI/Exporter.cs index d7a6501..d651649 100644 --- a/AssetStudio.CLI/Exporter.cs +++ b/AssetStudio.CLI/Exporter.cs @@ -336,8 +336,8 @@ namespace AssetStudio.CLI } var m_Animator = (Animator)item.Asset; var convert = animationList != null - ? new ModelConverter(m_Animator, Properties.Settings.Default.convertType, Studio.Game, Properties.Settings.Default.collectAnimations, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) - : new ModelConverter(m_Animator, Properties.Settings.Default.convertType, Studio.Game, Properties.Settings.Default.collectAnimations); + ? new ModelConverter(m_Animator, Properties.Settings.Default.convertType, Properties.Settings.Default.texs, Properties.Settings.Default.uvs, Studio.Game, Properties.Settings.Default.collectAnimations, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) + : new ModelConverter(m_Animator, Properties.Settings.Default.convertType, Properties.Settings.Default.texs, Properties.Settings.Default.uvs, Studio.Game, Properties.Settings.Default.collectAnimations); ExportFbx(convert, exportFullPath); return true; } @@ -352,8 +352,8 @@ namespace AssetStudio.CLI public static bool ExportGameObject(GameObject gameObject, string exportPath, List animationList = null) { var convert = animationList != null - ? new ModelConverter(gameObject, Properties.Settings.Default.convertType, Studio.Game, Properties.Settings.Default.collectAnimations, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) - : new ModelConverter(gameObject, Properties.Settings.Default.convertType, Studio.Game, Properties.Settings.Default.collectAnimations); + ? new ModelConverter(gameObject, Properties.Settings.Default.convertType, Properties.Settings.Default.texs, Properties.Settings.Default.uvs, Studio.Game, Properties.Settings.Default.collectAnimations, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) + : new ModelConverter(gameObject, Properties.Settings.Default.convertType, Properties.Settings.Default.texs, Properties.Settings.Default.uvs, Studio.Game, Properties.Settings.Default.collectAnimations); if (convert.MeshList.Count == 0) { @@ -377,8 +377,6 @@ namespace AssetStudio.CLI exportBlendShape = Properties.Settings.Default.exportBlendShape, castToBone = Properties.Settings.Default.castToBone, boneSize = (int)Properties.Settings.Default.boneSize, - exportAllUvsAsDiffuseMaps = Properties.Settings.Default.exportAllUvsAsDiffuseMaps, - exportUV0UV1 = Properties.Settings.Default.exportUV0UV1, scaleFactor = (float)Properties.Settings.Default.scaleFactor, fbxVersion = Properties.Settings.Default.fbxVersion, fbxFormat = Properties.Settings.Default.fbxFormat diff --git a/AssetStudio.CLI/Program.cs b/AssetStudio.CLI/Program.cs index f08128e..4700eaa 100644 --- a/AssetStudio.CLI/Program.cs +++ b/AssetStudio.CLI/Program.cs @@ -43,9 +43,6 @@ namespace AssetStudio.CLI Logger.Default = new ConsoleLogger(); Logger.FileLogging = Settings.Default.enableFileLogging; AssetsHelper.Minimal = Settings.Default.minimalAssetMap; - Shader.Parsable = !Settings.Default.disableShader; - Renderer.Parsable = !Settings.Default.disableRenderer; - AnimationClip.Parsable = !Settings.Default.disableAnimationClip; AssetsHelper.SetUnityVersion(o.UnityVersion); assetsManager.Silent = o.Silent; diff --git a/AssetStudio.CLI/Settings.cs b/AssetStudio.CLI/Settings.cs index dbf3682..d5f6f88 100644 --- a/AssetStudio.CLI/Settings.cs +++ b/AssetStudio.CLI/Settings.cs @@ -57,8 +57,6 @@ namespace AssetStudio.CLI.Properties { public bool exportBlendShape => AppSettings.Get("exportBlendShape", true); public bool castToBone => AppSettings.Get("castToBone", false); public bool restoreExtensionName => AppSettings.Get("restoreExtensionName", true); - public bool exportAllUvsAsDiffuseMaps => AppSettings.Get("exportAllUvsAsDiffuseMaps", false); - public bool exportUV0UV1 => AppSettings.Get("exportUV0UV1", false); public bool encrypted => AppSettings.Get("encrypted", true); public byte key => AppSettings.Get("key", (byte)0x93); public int selectedGame => AppSettings.Get("selectedGame", 0); @@ -66,11 +64,10 @@ namespace AssetStudio.CLI.Properties { public int selectedCNUnityKey => AppSettings.Get("selectedCNUnityKey", 0); public int selectedAssetMapType => AppSettings.Get("selectedAssetMapType", 0); public bool exportMiHoYoBinData => AppSettings.Get("exportMiHoYoBinData", true); - public bool disableShader => AppSettings.Get("disableShader", false); - public bool disableRenderer => AppSettings.Get("disableRenderer", false); - public bool disableAnimationClip => AppSettings.Get("disableAnimationClip", false); public bool enableFileLogging => AppSettings.Get("enableFileLogging", false); public bool minimalAssetMap => AppSettings.Get("minimalAssetMap", true); + public string texs => AppSettings.Get("texs", string.Empty); + public string uvs => AppSettings.Get("uvs", string.Empty); } } diff --git a/AssetStudio.CLI/Studio.cs b/AssetStudio.CLI/Studio.cs index 1c7b281..7910bf5 100644 --- a/AssetStudio.CLI/Studio.cs +++ b/AssetStudio.CLI/Studio.cs @@ -332,13 +332,13 @@ namespace AssetStudio.CLI break; case Mesh _: case TextAsset _: - case AnimationClip _ when AnimationClip.Parsable: + case AnimationClip _: case Font _: case MovieTexture _: case Sprite _: case Material _: case MiHoYoBinData _: - case Shader _ when Shader.Parsable: + case Shader _: case Animator _: exportable = !ModelOnly; break; diff --git a/AssetStudio.FBXNative/api.cpp b/AssetStudio.FBXNative/api.cpp index 2353d7a..a7f73fc 100644 --- a/AssetStudio.FBXNative/api.cpp +++ b/AssetStudio.FBXNative/api.cpp @@ -370,6 +370,18 @@ AS_API(void) AsFbxLinkTexture(int32_t dest, FbxFileTexture* pTexture, FbxSurface case 3: pProp = &pMaterial->Bump; break; + case 4: + pProp = &pMaterial->Ambient; + break; + case 5: + pProp = &pMaterial->Emissive; + break; + case 6: + pProp = &pMaterial->Reflection; + break; + case 7: + pProp = &pMaterial->DisplacementColor; + break; default: pProp = nullptr; break; @@ -462,26 +474,45 @@ AS_API(void) AsFbxMeshCreateElementNormal(FbxMesh* pMesh) pNormal->SetReferenceMode(FbxGeometryElement::eDirect); } -AS_API(void) AsFbxMeshCreateDiffuseUV(FbxMesh* pMesh, int32_t uv) +AS_API(void) AsFbxMeshCreateUV(FbxMesh* pMesh, int32_t uv, int32_t uvType) { if (pMesh == nullptr) { return; } - auto pUV = pMesh->CreateElementUV(FbxString("UV") + FbxString(uv), FbxLayerElement::eTextureDiffuse); - pUV->SetMappingMode(FbxGeometryElement::eByControlPoint); - pUV->SetReferenceMode(FbxGeometryElement::eDirect); -} - -AS_API(void) AsFbxMeshCreateNormalMapUV(FbxMesh* pMesh, int32_t uv) -{ - if (pMesh == nullptr) - { - return; + FbxLayerElement::EType type; + switch (uvType) { + case 0: + type = FbxLayerElement::eTextureDiffuse; + break; + case 1: + type = FbxLayerElement::eTextureNormalMap; + break; + case 2: + type = FbxLayerElement::eTextureSpecular; + break; + case 3: + type = FbxLayerElement::eTextureBump; + break; + case 4: + type = FbxLayerElement::eTextureAmbient; + break; + case 5: + type = FbxLayerElement::eTextureEmissive; + break; + case 6: + type = FbxLayerElement::eTextureReflection; + break; + case 7: + type = FbxLayerElement::eTextureDisplacement; + break; + default: + type = FbxLayerElement::eTextureDiffuse; + break; } - auto pUV = pMesh->CreateElementUV(FbxString("UV") + FbxString(uv), FbxLayerElement::eTextureNormalMap); + auto pUV = pMesh->CreateElementUV(FbxString("UV") + FbxString(uv), type); pUV->SetMappingMode(FbxGeometryElement::eByControlPoint); pUV->SetReferenceMode(FbxGeometryElement::eDirect); } diff --git a/AssetStudio.FBXWrapper/Fbx.cs b/AssetStudio.FBXWrapper/Fbx.cs index d86e5e9..10f04c0 100644 --- a/AssetStudio.FBXWrapper/Fbx.cs +++ b/AssetStudio.FBXWrapper/Fbx.cs @@ -62,8 +62,6 @@ namespace AssetStudio public bool exportBlendShape; public bool castToBone; public int boneSize; - public bool exportAllUvsAsDiffuseMaps; - public bool exportUV0UV1; public float scaleFactor; public int fbxVersion; public int fbxFormat; diff --git a/AssetStudio.FBXWrapper/FbxExporterContext.PInvoke.cs b/AssetStudio.FBXWrapper/FbxExporterContext.PInvoke.cs index 28bef4e..bb5322a 100644 --- a/AssetStudio.FBXWrapper/FbxExporterContext.PInvoke.cs +++ b/AssetStudio.FBXWrapper/FbxExporterContext.PInvoke.cs @@ -76,10 +76,7 @@ namespace AssetStudio.FbxInterop private static extern void AsFbxMeshCreateElementNormal(IntPtr mesh); [DllImport(FbxDll.DllName)] - private static extern void AsFbxMeshCreateDiffuseUV(IntPtr mesh, int uv); - - [DllImport(FbxDll.DllName)] - private static extern void AsFbxMeshCreateNormalMapUV(IntPtr mesh, int uv); + private static extern void AsFbxMeshCreateUV(IntPtr mesh, int uv, int uvType); [DllImport(FbxDll.DllName)] private static extern void AsFbxMeshCreateElementTangent(IntPtr mesh); diff --git a/AssetStudio.FBXWrapper/FbxExporterContext.cs b/AssetStudio.FBXWrapper/FbxExporterContext.cs index d47765b..7bcae0d 100644 --- a/AssetStudio.FBXWrapper/FbxExporterContext.cs +++ b/AssetStudio.FBXWrapper/FbxExporterContext.cs @@ -256,39 +256,12 @@ namespace AssetStudio.FbxInterop AsFbxMeshCreateElementNormal(mesh); } - if (_exportOptions.exportUV0UV1) + for (int i = 0; i < importedMesh.hasUV.Length; i++) { - if (importedMesh.hasUV[0]) - { - AsFbxMeshCreateDiffuseUV(mesh, 0); - } - if (importedMesh.hasUV[1]) - { - if (_exportOptions.exportAllUvsAsDiffuseMaps) - { - AsFbxMeshCreateDiffuseUV(mesh, 1); - } - else - { - AsFbxMeshCreateNormalMapUV(mesh, 1); - } - } - } - else - { - for (int i = 0; i < importedMesh.hasUV.Length; i++) - { - if (!importedMesh.hasUV[i]) { continue; } + if (!importedMesh.hasUV[i]) { continue; } - if (i == 1 && !_exportOptions.exportAllUvsAsDiffuseMaps) - { - AsFbxMeshCreateNormalMapUV(mesh, 1); - } - else - { - AsFbxMeshCreateDiffuseUV(mesh, i); - } - } + var type = importedMesh.uvType[i]; + AsFbxMeshCreateUV(mesh, i, type); } if (importedMesh.hasTangent) @@ -391,7 +364,7 @@ namespace AssetStudio.FbxInterop AsFbxMeshElementNormalAdd(mesh, 0, normal.X, normal.Y, normal.Z); } - var uvSize = _exportOptions.exportUV0UV1 ? 2 : importedMesh.hasUV.Length; + var uvSize = importedMesh.hasUV.Length; for (var uvIndex = 0; uvIndex < uvSize; uvIndex += 1) { if (importedMesh.hasUV[uvIndex]) diff --git a/AssetStudio.GUI/App.config b/AssetStudio.GUI/App.config index 257108c..cb0d069 100644 --- a/AssetStudio.GUI/App.config +++ b/AssetStudio.GUI/App.config @@ -64,9 +64,6 @@ True - - False - 147 @@ -91,15 +88,6 @@ False - - False - - - False - - - False - True @@ -115,15 +103,18 @@ - - False - True False + + {"UV0":{"Item1":true,"Item2":0},"UV1":{"Item1":false,"Item2":1},"UV2":{"Item1":true,"Item2":0},"UV3":{"Item1":false,"Item2":0},"UV4":{"Item1":false,"Item2":0},"UV5":{"Item1":false,"Item2":0},"UV6":{"Item1":true,"Item2":0},"UV7":{"Item1":true,"Item2":0}} + + + {} + \ No newline at end of file diff --git a/AssetStudio.GUI/AssetBrowser.cs b/AssetStudio.GUI/AssetBrowser.cs index 42e59cd..8eb298f 100644 --- a/AssetStudio.GUI/AssetBrowser.cs +++ b/AssetStudio.GUI/AssetBrowser.cs @@ -23,6 +23,8 @@ namespace AssetStudio.GUI { InitializeComponent(); _parent = form; + _assetEntries = new List(); + _columnNames = new List(); } private async void loadAssetMap_Click(object sender, EventArgs e) @@ -37,8 +39,11 @@ namespace AssetStudio.GUI await Task.Run(() => ResourceMap.FromFile(path)); _sortedColumn = null; - _columnNames = typeof(AssetEntry).GetProperties().Select(x => x.Name).ToList(); - _assetEntries = ResourceMap.GetEntries(); + _columnNames.Clear(); + _columnNames.AddRange(typeof(AssetEntry).GetProperties().Select(x => x.Name).ToList()); + + _assetEntries.Clear(); + _assetEntries.AddRange(ResourceMap.GetEntries()); assetDataGridView.Columns.Clear(); assetDataGridView.Columns.AddRange(_columnNames.Select(x => new DataGridViewTextBoxColumn() { Name = x, HeaderText = x, SortMode = DataGridViewColumnSortMode.Programmatic }).ToArray()); @@ -96,9 +101,9 @@ namespace AssetStudio.GUI filters[name] = new Regex(regex, RegexOptions.IgnoreCase); } - _assetEntries = ResourceMap.GetEntries().FindAll(x => x.Matches(filters)); + _assetEntries.Clear(); + _assetEntries.AddRange(ResourceMap.GetEntries().FindAll(x => x.Matches(filters))); - assetDataGridView.CurrentCell = assetDataGridView[0, 0]; assetDataGridView.Rows.Clear(); assetDataGridView.RowCount = _assetEntries.Count; assetDataGridView.Refresh(); @@ -158,7 +163,8 @@ namespace AssetStudio.GUI _ => x => "" }; - _assetEntries = direction == ListSortDirection.Ascending ? _assetEntries.OrderBy(keySelector).ToList() : _assetEntries.OrderByDescending(keySelector).ToList(); + _assetEntries.Clear(); + _assetEntries.AddRange(direction == ListSortDirection.Ascending ? _assetEntries.OrderBy(keySelector).ToList() : _assetEntries.OrderByDescending(keySelector).ToList()); assetDataGridView.CurrentCell = assetDataGridView[0, 0]; assetDataGridView.Rows.Clear(); diff --git a/AssetStudio.GUI/ExportOptions.Designer.cs b/AssetStudio.GUI/ExportOptions.Designer.cs index 2023f68..67f3f67 100644 --- a/AssetStudio.GUI/ExportOptions.Designer.cs +++ b/AssetStudio.GUI/ExportOptions.Designer.cs @@ -1,5 +1,7 @@ using System; using System.Linq; +using System.Windows.Forms; +using System.Xml.Linq; namespace AssetStudio.GUI { @@ -32,64 +34,75 @@ namespace AssetStudio.GUI private void InitializeComponent() { components = new System.ComponentModel.Container(); - OKbutton = new System.Windows.Forms.Button(); - Cancel = new System.Windows.Forms.Button(); - groupBox1 = new System.Windows.Forms.GroupBox(); - assetGroupOptions = new System.Windows.Forms.ComboBox(); - label7 = new System.Windows.Forms.Label(); - openAfterExport = new System.Windows.Forms.CheckBox(); - restoreExtensionName = new System.Windows.Forms.CheckBox(); - label6 = new System.Windows.Forms.Label(); - convertAudio = new System.Windows.Forms.CheckBox(); - panel1 = new System.Windows.Forms.Panel(); - totga = new System.Windows.Forms.RadioButton(); - tojpg = new System.Windows.Forms.RadioButton(); - topng = new System.Windows.Forms.RadioButton(); - tobmp = new System.Windows.Forms.RadioButton(); - converttexture = new System.Windows.Forms.CheckBox(); - collectAnimations = new System.Windows.Forms.CheckBox(); - groupBox2 = new System.Windows.Forms.GroupBox(); - exportUV0UV1 = new System.Windows.Forms.CheckBox(); - exportAllUvsAsDiffuseMaps = new System.Windows.Forms.CheckBox(); - exportBlendShape = new System.Windows.Forms.CheckBox(); - exportAnimations = new System.Windows.Forms.CheckBox(); - scaleFactor = new System.Windows.Forms.NumericUpDown(); - label5 = new System.Windows.Forms.Label(); - fbxFormat = new System.Windows.Forms.ComboBox(); - label4 = new System.Windows.Forms.Label(); - fbxVersion = new System.Windows.Forms.ComboBox(); - label3 = new System.Windows.Forms.Label(); - boneSize = new System.Windows.Forms.NumericUpDown(); - label2 = new System.Windows.Forms.Label(); - exportSkins = new System.Windows.Forms.CheckBox(); - label1 = new System.Windows.Forms.Label(); - filterPrecision = new System.Windows.Forms.NumericUpDown(); - castToBone = new System.Windows.Forms.CheckBox(); - exportAllNodes = new System.Windows.Forms.CheckBox(); - eulerFilter = new System.Windows.Forms.CheckBox(); - exportUvsTooltip = new System.Windows.Forms.ToolTip(components); - encrypted = new System.Windows.Forms.CheckBox(); - key = new System.Windows.Forms.NumericUpDown(); - keyToolTip = new System.Windows.Forms.ToolTip(components); - groupBox4 = new System.Windows.Forms.GroupBox(); - disableAnimationClip = new System.Windows.Forms.CheckBox(); - minimalAssetMap = new System.Windows.Forms.CheckBox(); - disableShader = new System.Windows.Forms.CheckBox(); - disableRenderer = new System.Windows.Forms.CheckBox(); + DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle(); + DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle(); + DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle(); + DataGridViewCellStyle dataGridViewCellStyle6 = new DataGridViewCellStyle(); + DataGridViewCellStyle dataGridViewCellStyle7 = new DataGridViewCellStyle(); + DataGridViewCellStyle dataGridViewCellStyle8 = new DataGridViewCellStyle(); + DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle(); + DataGridViewCellStyle dataGridViewCellStyle5 = new DataGridViewCellStyle(); + OKbutton = new Button(); + Cancel = new Button(); + groupBox1 = new GroupBox(); + label6 = new Label(); + uvsGridView = new DataGridView(); + UVName = new DataGridViewTextBoxColumn(); + UVEnabled = new DataGridViewCheckBoxColumn(); + UVType = new DataGridViewComboBoxColumn(); + minimalAssetMap = new CheckBox(); + assetGroupOptions = new ComboBox(); + label7 = new Label(); + openAfterExport = new CheckBox(); + restoreExtensionName = new CheckBox(); + key = new NumericUpDown(); + encrypted = new CheckBox(); + convertAudio = new CheckBox(); + panel1 = new Panel(); + totga = new RadioButton(); + tojpg = new RadioButton(); + topng = new RadioButton(); + tobmp = new RadioButton(); + converttexture = new CheckBox(); + collectAnimations = new CheckBox(); + groupBox2 = new GroupBox(); + label9 = new Label(); + texsGridView = new DataGridView(); + TexName = new DataGridViewTextBoxColumn(); + TexType = new DataGridViewComboBoxColumn(); + exportBlendShape = new CheckBox(); + exportAnimations = new CheckBox(); + scaleFactor = new NumericUpDown(); + label5 = new Label(); + fbxFormat = new ComboBox(); + label4 = new Label(); + fbxVersion = new ComboBox(); + label3 = new Label(); + boneSize = new NumericUpDown(); + label2 = new Label(); + exportSkins = new CheckBox(); + label1 = new Label(); + filterPrecision = new NumericUpDown(); + castToBone = new CheckBox(); + exportAllNodes = new CheckBox(); + eulerFilter = new CheckBox(); + exportUvsTooltip = new ToolTip(components); + keyToolTip = new ToolTip(components); groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)uvsGridView).BeginInit(); + ((System.ComponentModel.ISupportInitialize)key).BeginInit(); panel1.SuspendLayout(); groupBox2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)texsGridView).BeginInit(); ((System.ComponentModel.ISupportInitialize)scaleFactor).BeginInit(); ((System.ComponentModel.ISupportInitialize)boneSize).BeginInit(); ((System.ComponentModel.ISupportInitialize)filterPrecision).BeginInit(); - ((System.ComponentModel.ISupportInitialize)key).BeginInit(); - groupBox4.SuspendLayout(); SuspendLayout(); // // OKbutton // - OKbutton.Location = new System.Drawing.Point(371, 439); - OKbutton.Margin = new System.Windows.Forms.Padding(4); + OKbutton.Location = new System.Drawing.Point(480, 439); + OKbutton.Margin = new Padding(4); OKbutton.Name = "OKbutton"; OKbutton.Size = new System.Drawing.Size(88, 26); OKbutton.TabIndex = 6; @@ -99,9 +112,9 @@ namespace AssetStudio.GUI // // Cancel // - Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - Cancel.Location = new System.Drawing.Point(465, 439); - Cancel.Margin = new System.Windows.Forms.Padding(4); + Cancel.DialogResult = DialogResult.Cancel; + Cancel.Location = new System.Drawing.Point(576, 439); + Cancel.Margin = new Padding(4); Cancel.Name = "Cancel"; Cancel.Size = new System.Drawing.Size(88, 26); Cancel.TabIndex = 7; @@ -112,30 +125,90 @@ namespace AssetStudio.GUI // groupBox1 // groupBox1.AutoSize = true; + groupBox1.Controls.Add(label6); + groupBox1.Controls.Add(uvsGridView); + groupBox1.Controls.Add(minimalAssetMap); groupBox1.Controls.Add(assetGroupOptions); groupBox1.Controls.Add(label7); groupBox1.Controls.Add(openAfterExport); groupBox1.Controls.Add(restoreExtensionName); - groupBox1.Controls.Add(label6); + groupBox1.Controls.Add(key); + groupBox1.Controls.Add(encrypted); groupBox1.Controls.Add(convertAudio); groupBox1.Controls.Add(panel1); groupBox1.Controls.Add(converttexture); groupBox1.Location = new System.Drawing.Point(14, 15); - groupBox1.Margin = new System.Windows.Forms.Padding(4); + groupBox1.Margin = new Padding(4); groupBox1.Name = "groupBox1"; - groupBox1.Padding = new System.Windows.Forms.Padding(4); - groupBox1.Size = new System.Drawing.Size(271, 273); + groupBox1.Padding = new Padding(4); + groupBox1.Size = new System.Drawing.Size(271, 419); groupBox1.TabIndex = 9; groupBox1.TabStop = false; groupBox1.Text = "Export"; // + // label6 + // + label6.AutoSize = true; + label6.Location = new System.Drawing.Point(101, 275); + label6.Margin = new Padding(4, 0, 4, 0); + label6.Name = "label6"; + label6.Size = new System.Drawing.Size(73, 15); + label6.TabIndex = 27; + label6.Text = "UV Mapping"; + // + // uvsGridView + // + uvsGridView.AllowUserToAddRows = false; + uvsGridView.AllowUserToDeleteRows = false; + uvsGridView.AllowUserToResizeRows = false; + uvsGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + uvsGridView.Columns.AddRange(new DataGridViewColumn[] { UVName, UVEnabled, UVType }); + uvsGridView.Location = new System.Drawing.Point(8, 293); + uvsGridView.Name = "uvsGridView"; + uvsGridView.RowHeadersVisible = false; + dataGridViewCellStyle1.Alignment = DataGridViewContentAlignment.MiddleCenter; + uvsGridView.RowsDefaultCellStyle = dataGridViewCellStyle1; + uvsGridView.RowTemplate.Height = 25; + uvsGridView.Size = new System.Drawing.Size(255, 103); + uvsGridView.TabIndex = 18; + // + // UVName + // + UVName.HeaderText = "Name"; + UVName.Name = "UVName"; + UVName.ReadOnly = true; + UVName.Width = 50; + // + // UVEnabled + // + UVEnabled.HeaderText = "Enabled"; + UVEnabled.Name = "UVEnabled"; + UVEnabled.Width = 60; + // + // UVType + // + UVType.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + UVType.HeaderText = "Type"; + UVType.Name = "UVType"; + UVType.Items.AddRange(typeMap.Values.ToArray()); + // + // minimalAssetMap + // + minimalAssetMap.AutoSize = true; + minimalAssetMap.Location = new System.Drawing.Point(7, 129); + minimalAssetMap.Name = "minimalAssetMap"; + minimalAssetMap.Size = new System.Drawing.Size(125, 19); + minimalAssetMap.TabIndex = 17; + minimalAssetMap.Text = "Minimal AssetMap"; + minimalAssetMap.UseVisualStyleBackColor = true; + // // assetGroupOptions // - assetGroupOptions.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + 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(7, 83); - assetGroupOptions.Margin = new System.Windows.Forms.Padding(4); + assetGroupOptions.Location = new System.Drawing.Point(8, 241); + assetGroupOptions.Margin = new Padding(4); assetGroupOptions.Name = "assetGroupOptions"; assetGroupOptions.Size = new System.Drawing.Size(173, 23); assetGroupOptions.TabIndex = 12; @@ -143,8 +216,8 @@ namespace AssetStudio.GUI // label7 // label7.AutoSize = true; - label7.Location = new System.Drawing.Point(7, 64); - label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label7.Location = new System.Drawing.Point(8, 222); + label7.Margin = new Padding(4, 0, 4, 0); label7.Name = "label7"; label7.Size = new System.Drawing.Size(140, 15); label7.TabIndex = 11; @@ -154,9 +227,9 @@ namespace AssetStudio.GUI // openAfterExport.AutoSize = true; openAfterExport.Checked = true; - openAfterExport.CheckState = System.Windows.Forms.CheckState.Checked; - openAfterExport.Location = new System.Drawing.Point(8, 230); - openAfterExport.Margin = new System.Windows.Forms.Padding(4); + openAfterExport.CheckState = CheckState.Checked; + openAfterExport.Location = new System.Drawing.Point(7, 78); + openAfterExport.Margin = new Padding(4); openAfterExport.Name = "openAfterExport"; openAfterExport.Size = new System.Drawing.Size(153, 19); openAfterExport.TabIndex = 10; @@ -167,32 +240,46 @@ namespace AssetStudio.GUI // restoreExtensionName.AutoSize = true; restoreExtensionName.Checked = true; - restoreExtensionName.CheckState = System.Windows.Forms.CheckState.Checked; - restoreExtensionName.Location = new System.Drawing.Point(7, 109); - restoreExtensionName.Margin = new System.Windows.Forms.Padding(4); + restoreExtensionName.CheckState = CheckState.Checked; + restoreExtensionName.Location = new System.Drawing.Point(7, 24); + restoreExtensionName.Margin = new Padding(4); restoreExtensionName.Name = "restoreExtensionName"; restoreExtensionName.Size = new System.Drawing.Size(204, 19); restoreExtensionName.TabIndex = 9; restoreExtensionName.Text = "Restore TextAsset extension name"; restoreExtensionName.UseVisualStyleBackColor = true; // - // label6 + // key // - label6.AutoSize = true; - label6.Location = new System.Drawing.Point(7, 21); - label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - label6.Name = "label6"; - label6.Size = new System.Drawing.Size(80, 15); - label6.TabIndex = 7; - label6.Text = "Group exported assets by"; + key.Hexadecimal = true; + key.Location = new System.Drawing.Point(186, 103); + key.Margin = new Padding(4, 3, 4, 3); + key.Maximum = new decimal(new int[] { 255, 0, 0, 0 }); + key.Name = "key"; + key.Size = new System.Drawing.Size(55, 23); + key.TabIndex = 8; + keyToolTip.SetToolTip(key, "Key in hex"); + // + // encrypted + // + encrypted.AutoSize = true; + encrypted.Checked = true; + encrypted.CheckState = CheckState.Checked; + encrypted.Location = new System.Drawing.Point(7, 104); + encrypted.Margin = new Padding(4, 3, 4, 3); + encrypted.Name = "encrypted"; + encrypted.Size = new System.Drawing.Size(166, 19); + encrypted.TabIndex = 12; + encrypted.Text = "Encrypted MiHoYoBinData\r\n"; + encrypted.UseVisualStyleBackColor = true; // // convertAudio // convertAudio.AutoSize = true; convertAudio.Checked = true; - convertAudio.CheckState = System.Windows.Forms.CheckState.Checked; - convertAudio.Location = new System.Drawing.Point(7, 204); - convertAudio.Margin = new System.Windows.Forms.Padding(4); + convertAudio.CheckState = CheckState.Checked; + convertAudio.Location = new System.Drawing.Point(7, 51); + convertAudio.Margin = new Padding(4); convertAudio.Name = "convertAudio"; convertAudio.Size = new System.Drawing.Size(200, 19); convertAudio.TabIndex = 6; @@ -205,8 +292,8 @@ namespace AssetStudio.GUI panel1.Controls.Add(tojpg); panel1.Controls.Add(topng); panel1.Controls.Add(tobmp); - panel1.Location = new System.Drawing.Point(23, 164); - panel1.Margin = new System.Windows.Forms.Padding(4); + panel1.Location = new System.Drawing.Point(18, 180); + panel1.Margin = new Padding(4); panel1.Name = "panel1"; panel1.Size = new System.Drawing.Size(236, 38); panel1.TabIndex = 5; @@ -215,7 +302,7 @@ namespace AssetStudio.GUI // totga.AutoSize = true; totga.Location = new System.Drawing.Point(175, 8); - totga.Margin = new System.Windows.Forms.Padding(4); + totga.Margin = new Padding(4); totga.Name = "totga"; totga.Size = new System.Drawing.Size(43, 19); totga.TabIndex = 2; @@ -226,7 +313,7 @@ namespace AssetStudio.GUI // tojpg.AutoSize = true; tojpg.Location = new System.Drawing.Point(113, 8); - tojpg.Margin = new System.Windows.Forms.Padding(4); + tojpg.Margin = new Padding(4); tojpg.Name = "tojpg"; tojpg.Size = new System.Drawing.Size(49, 19); tojpg.TabIndex = 4; @@ -238,7 +325,7 @@ namespace AssetStudio.GUI topng.AutoSize = true; topng.Checked = true; topng.Location = new System.Drawing.Point(58, 8); - topng.Margin = new System.Windows.Forms.Padding(4); + topng.Margin = new Padding(4); topng.Name = "topng"; topng.Size = new System.Drawing.Size(46, 19); topng.TabIndex = 3; @@ -250,7 +337,7 @@ namespace AssetStudio.GUI // tobmp.AutoSize = true; tobmp.Location = new System.Drawing.Point(4, 8); - tobmp.Margin = new System.Windows.Forms.Padding(4); + tobmp.Margin = new Padding(4); tobmp.Name = "tobmp"; tobmp.Size = new System.Drawing.Size(50, 19); tobmp.TabIndex = 2; @@ -261,9 +348,9 @@ namespace AssetStudio.GUI // converttexture.AutoSize = true; converttexture.Checked = true; - converttexture.CheckState = System.Windows.Forms.CheckState.Checked; - converttexture.Location = new System.Drawing.Point(7, 136); - converttexture.Margin = new System.Windows.Forms.Padding(4); + converttexture.CheckState = CheckState.Checked; + converttexture.Location = new System.Drawing.Point(7, 153); + converttexture.Margin = new Padding(4); converttexture.Name = "converttexture"; converttexture.Size = new System.Drawing.Size(123, 19); converttexture.TabIndex = 1; @@ -274,9 +361,9 @@ namespace AssetStudio.GUI // collectAnimations.AutoSize = true; collectAnimations.Checked = true; - collectAnimations.CheckState = System.Windows.Forms.CheckState.Checked; - collectAnimations.Location = new System.Drawing.Point(8, 113); - collectAnimations.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + collectAnimations.CheckState = CheckState.Checked; + collectAnimations.Location = new System.Drawing.Point(8, 43); + collectAnimations.Margin = new Padding(4, 3, 4, 3); collectAnimations.Name = "collectAnimations"; collectAnimations.Size = new System.Drawing.Size(125, 19); collectAnimations.TabIndex = 24; @@ -286,9 +373,9 @@ namespace AssetStudio.GUI // groupBox2 // groupBox2.AutoSize = true; - groupBox2.Controls.Add(exportUV0UV1); + groupBox2.Controls.Add(label9); + groupBox2.Controls.Add(texsGridView); groupBox2.Controls.Add(collectAnimations); - groupBox2.Controls.Add(exportAllUvsAsDiffuseMaps); groupBox2.Controls.Add(exportBlendShape); groupBox2.Controls.Add(exportAnimations); groupBox2.Controls.Add(scaleFactor); @@ -306,47 +393,90 @@ namespace AssetStudio.GUI groupBox2.Controls.Add(exportAllNodes); groupBox2.Controls.Add(eulerFilter); groupBox2.Location = new System.Drawing.Point(292, 15); - groupBox2.Margin = new System.Windows.Forms.Padding(4); + groupBox2.Margin = new Padding(4); groupBox2.Name = "groupBox2"; - groupBox2.Padding = new System.Windows.Forms.Padding(4); - groupBox2.Size = new System.Drawing.Size(261, 418); + groupBox2.Padding = new Padding(4); + groupBox2.Size = new System.Drawing.Size(379, 419); groupBox2.TabIndex = 11; groupBox2.TabStop = false; groupBox2.Text = "Fbx"; // - // exportUV0UV1 + // label9 // - exportUV0UV1.AccessibleDescription = ""; - exportUV0UV1.AutoSize = true; - exportUV0UV1.Location = new System.Drawing.Point(8, 243); - exportUV0UV1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - exportUV0UV1.Name = "exportUV0UV1"; - exportUV0UV1.Size = new System.Drawing.Size(124, 19); - exportUV0UV1.TabIndex = 25; - exportUV0UV1.Text = "Export UV 0/1 only"; - exportUvsTooltip.SetToolTip(exportUV0UV1, "Unchecked: Export UV0/UV1 only. Check this if your facing issues with vertex color/tangent."); - exportUV0UV1.UseVisualStyleBackColor = true; + label9.AutoSize = true; + label9.Location = new System.Drawing.Point(133, 230); + label9.Margin = new Padding(4, 0, 4, 0); + label9.Name = "label9"; + label9.Size = new System.Drawing.Size(96, 15); + label9.TabIndex = 28; + label9.Text = "Texture Mapping"; // - // exportAllUvsAsDiffuseMaps + // texsGridView // - exportAllUvsAsDiffuseMaps.AccessibleDescription = ""; - exportAllUvsAsDiffuseMaps.AutoSize = true; - exportAllUvsAsDiffuseMaps.Location = new System.Drawing.Point(8, 217); - exportAllUvsAsDiffuseMaps.Margin = new System.Windows.Forms.Padding(4); - exportAllUvsAsDiffuseMaps.Name = "exportAllUvsAsDiffuseMaps"; - exportAllUvsAsDiffuseMaps.Size = new System.Drawing.Size(183, 19); - exportAllUvsAsDiffuseMaps.TabIndex = 23; - exportAllUvsAsDiffuseMaps.Text = "Export all UVs as diffuse maps"; - exportUvsTooltip.SetToolTip(exportAllUvsAsDiffuseMaps, "Unchecked: UV1 exported as normal map. Check this if your export is missing a UV map."); - exportAllUvsAsDiffuseMaps.UseVisualStyleBackColor = true; + texsGridView.AllowUserToResizeColumns = false; + texsGridView.AllowUserToResizeRows = false; + dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleCenter; + texsGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle3.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle3.WrapMode = DataGridViewTriState.True; + texsGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3; + texsGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + texsGridView.Columns.AddRange(new DataGridViewColumn[] { TexName, TexType }); + dataGridViewCellStyle6.Alignment = DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle6.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle6.WrapMode = DataGridViewTriState.False; + texsGridView.DefaultCellStyle = dataGridViewCellStyle6; + texsGridView.Location = new System.Drawing.Point(7, 248); + texsGridView.Name = "texsGridView"; + dataGridViewCellStyle7.Alignment = DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle7.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle7.WrapMode = DataGridViewTriState.True; + texsGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle7; + texsGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing; + dataGridViewCellStyle8.Alignment = DataGridViewContentAlignment.MiddleCenter; + texsGridView.RowsDefaultCellStyle = dataGridViewCellStyle8; + texsGridView.RowTemplate.Height = 25; + texsGridView.Size = new System.Drawing.Size(365, 148); + texsGridView.TabIndex = 27; + // + // TexName + // + TexName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridViewCellStyle4.Alignment = DataGridViewContentAlignment.MiddleCenter; + TexName.DefaultCellStyle = dataGridViewCellStyle4; + TexName.HeaderText = "Name"; + TexName.Name = "TexName"; + TexName.Resizable = DataGridViewTriState.False; + // + // TexType + // + dataGridViewCellStyle5.Alignment = DataGridViewContentAlignment.MiddleCenter; + TexType.DefaultCellStyle = dataGridViewCellStyle5; + TexType.HeaderText = "Type"; + TexType.Name = "TexType"; + TexType.Items.AddRange(typeMap.Values.ToArray()); + TexType.Resizable = DataGridViewTriState.False; // // exportBlendShape // exportBlendShape.AutoSize = true; exportBlendShape.Checked = true; - exportBlendShape.CheckState = System.Windows.Forms.CheckState.Checked; - exportBlendShape.Location = new System.Drawing.Point(8, 163); - exportBlendShape.Margin = new System.Windows.Forms.Padding(4); + exportBlendShape.CheckState = CheckState.Checked; + exportBlendShape.Location = new System.Drawing.Point(7, 69); + exportBlendShape.Margin = new Padding(4); exportBlendShape.Name = "exportBlendShape"; exportBlendShape.Size = new System.Drawing.Size(124, 19); exportBlendShape.TabIndex = 22; @@ -357,9 +487,9 @@ namespace AssetStudio.GUI // exportAnimations.AutoSize = true; exportAnimations.Checked = true; - exportAnimations.CheckState = System.Windows.Forms.CheckState.Checked; - exportAnimations.Location = new System.Drawing.Point(8, 136); - exportAnimations.Margin = new System.Windows.Forms.Padding(4); + exportAnimations.CheckState = CheckState.Checked; + exportAnimations.Location = new System.Drawing.Point(154, 43); + exportAnimations.Margin = new Padding(4); exportAnimations.Name = "exportAnimations"; exportAnimations.Size = new System.Drawing.Size(122, 19); exportAnimations.TabIndex = 21; @@ -370,19 +500,19 @@ namespace AssetStudio.GUI // scaleFactor.DecimalPlaces = 2; scaleFactor.Increment = new decimal(new int[] { 1, 0, 0, 131072 }); - scaleFactor.Location = new System.Drawing.Point(98, 305); - scaleFactor.Margin = new System.Windows.Forms.Padding(4); + scaleFactor.Location = new System.Drawing.Point(103, 185); + scaleFactor.Margin = new Padding(4); scaleFactor.Name = "scaleFactor"; - scaleFactor.Size = new System.Drawing.Size(70, 23); + scaleFactor.Size = new System.Drawing.Size(59, 23); scaleFactor.TabIndex = 20; - scaleFactor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + scaleFactor.TextAlign = HorizontalAlignment.Center; scaleFactor.Value = new decimal(new int[] { 1, 0, 0, 0 }); // // label5 // label5.AutoSize = true; - label5.Location = new System.Drawing.Point(8, 307); - label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label5.Location = new System.Drawing.Point(9, 189); + label5.Margin = new Padding(4, 0, 4, 0); label5.Name = "label5"; label5.Size = new System.Drawing.Size(67, 15); label5.TabIndex = 19; @@ -390,11 +520,11 @@ namespace AssetStudio.GUI // // fbxFormat // - fbxFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + fbxFormat.DropDownStyle = ComboBoxStyle.DropDownList; fbxFormat.FormattingEnabled = true; fbxFormat.Items.AddRange(new object[] { "Binary", "Ascii" }); - fbxFormat.Location = new System.Drawing.Point(91, 339); - fbxFormat.Margin = new System.Windows.Forms.Padding(4); + fbxFormat.Location = new System.Drawing.Point(272, 121); + fbxFormat.Margin = new Padding(4); fbxFormat.Name = "fbxFormat"; fbxFormat.Size = new System.Drawing.Size(70, 23); fbxFormat.TabIndex = 18; @@ -402,8 +532,8 @@ namespace AssetStudio.GUI // label4 // label4.AutoSize = true; - label4.Location = new System.Drawing.Point(8, 343); - label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label4.Location = new System.Drawing.Point(189, 125); + label4.Margin = new Padding(4, 0, 4, 0); label4.Name = "label4"; label4.Size = new System.Drawing.Size(65, 15); label4.TabIndex = 17; @@ -411,20 +541,20 @@ namespace AssetStudio.GUI // // fbxVersion // - fbxVersion.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + fbxVersion.DropDownStyle = ComboBoxStyle.DropDownList; fbxVersion.FormattingEnabled = true; fbxVersion.Items.AddRange(new object[] { "6.1", "7.1", "7.2", "7.3", "7.4", "7.5" }); - fbxVersion.Location = new System.Drawing.Point(91, 371); - fbxVersion.Margin = new System.Windows.Forms.Padding(4); + fbxVersion.Location = new System.Drawing.Point(272, 153); + fbxVersion.Margin = new Padding(4); fbxVersion.Name = "fbxVersion"; - fbxVersion.Size = new System.Drawing.Size(54, 23); + fbxVersion.Size = new System.Drawing.Size(70, 23); fbxVersion.TabIndex = 16; // // label3 // label3.AutoSize = true; - label3.Location = new System.Drawing.Point(8, 375); - label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label3.Location = new System.Drawing.Point(189, 157); + label3.Margin = new Padding(4, 0, 4, 0); label3.Name = "label3"; label3.Size = new System.Drawing.Size(65, 15); label3.TabIndex = 15; @@ -432,18 +562,18 @@ namespace AssetStudio.GUI // // boneSize // - boneSize.Location = new System.Drawing.Point(77, 270); - boneSize.Margin = new System.Windows.Forms.Padding(4); + boneSize.Location = new System.Drawing.Point(103, 153); + boneSize.Margin = new Padding(4); boneSize.Name = "boneSize"; - boneSize.Size = new System.Drawing.Size(54, 23); + boneSize.Size = new System.Drawing.Size(59, 23); boneSize.TabIndex = 11; boneSize.Value = new decimal(new int[] { 10, 0, 0, 0 }); // // label2 // label2.AutoSize = true; - label2.Location = new System.Drawing.Point(8, 272); - label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label2.Location = new System.Drawing.Point(9, 157); + label2.Margin = new Padding(4, 0, 4, 0); label2.Name = "label2"; label2.Size = new System.Drawing.Size(54, 15); label2.TabIndex = 10; @@ -453,9 +583,9 @@ namespace AssetStudio.GUI // exportSkins.AutoSize = true; exportSkins.Checked = true; - exportSkins.CheckState = System.Windows.Forms.CheckState.Checked; - exportSkins.Location = new System.Drawing.Point(8, 87); - exportSkins.Margin = new System.Windows.Forms.Padding(4); + exportSkins.CheckState = CheckState.Checked; + exportSkins.Location = new System.Drawing.Point(94, 17); + exportSkins.Margin = new Padding(4); exportSkins.Name = "exportSkins"; exportSkins.Size = new System.Drawing.Size(89, 19); exportSkins.TabIndex = 8; @@ -465,8 +595,8 @@ namespace AssetStudio.GUI // label1 // label1.AutoSize = true; - label1.Location = new System.Drawing.Point(31, 41); - label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + label1.Location = new System.Drawing.Point(9, 125); + label1.Margin = new Padding(4, 0, 4, 0); label1.Name = "label1"; label1.Size = new System.Drawing.Size(81, 15); label1.TabIndex = 7; @@ -476,8 +606,8 @@ namespace AssetStudio.GUI // filterPrecision.DecimalPlaces = 2; filterPrecision.Increment = new decimal(new int[] { 1, 0, 0, 131072 }); - filterPrecision.Location = new System.Drawing.Point(149, 38); - filterPrecision.Margin = new System.Windows.Forms.Padding(4); + filterPrecision.Location = new System.Drawing.Point(103, 123); + filterPrecision.Margin = new Padding(4); filterPrecision.Name = "filterPrecision"; filterPrecision.Size = new System.Drawing.Size(59, 23); filterPrecision.TabIndex = 6; @@ -486,8 +616,8 @@ namespace AssetStudio.GUI // castToBone // castToBone.AutoSize = true; - castToBone.Location = new System.Drawing.Point(8, 190); - castToBone.Margin = new System.Windows.Forms.Padding(4); + castToBone.Location = new System.Drawing.Point(154, 69); + castToBone.Margin = new Padding(4); castToBone.Name = "castToBone"; castToBone.Size = new System.Drawing.Size(143, 19); castToBone.TabIndex = 5; @@ -498,9 +628,9 @@ namespace AssetStudio.GUI // exportAllNodes.AutoSize = true; exportAllNodes.Checked = true; - exportAllNodes.CheckState = System.Windows.Forms.CheckState.Checked; - exportAllNodes.Location = new System.Drawing.Point(8, 60); - exportAllNodes.Margin = new System.Windows.Forms.Padding(4); + exportAllNodes.CheckState = CheckState.Checked; + exportAllNodes.Location = new System.Drawing.Point(191, 17); + exportAllNodes.Margin = new Padding(4); exportAllNodes.Name = "exportAllNodes"; exportAllNodes.Size = new System.Drawing.Size(110, 19); exportAllNodes.TabIndex = 4; @@ -511,133 +641,48 @@ namespace AssetStudio.GUI // eulerFilter.AutoSize = true; eulerFilter.Checked = true; - eulerFilter.CheckState = System.Windows.Forms.CheckState.Checked; + eulerFilter.CheckState = CheckState.Checked; eulerFilter.Location = new System.Drawing.Point(8, 17); - eulerFilter.Margin = new System.Windows.Forms.Padding(4); + eulerFilter.Margin = new Padding(4); eulerFilter.Name = "eulerFilter"; eulerFilter.Size = new System.Drawing.Size(78, 19); eulerFilter.TabIndex = 3; eulerFilter.Text = "EulerFilter"; eulerFilter.UseVisualStyleBackColor = true; // - // encrypted - // - encrypted.AutoSize = true; - encrypted.Checked = true; - encrypted.CheckState = System.Windows.Forms.CheckState.Checked; - encrypted.Location = new System.Drawing.Point(8, 22); - encrypted.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - encrypted.Name = "encrypted"; - encrypted.Size = new System.Drawing.Size(166, 19); - encrypted.TabIndex = 12; - encrypted.Text = "Encrypted MiHoYoBinData\r\n"; - encrypted.UseVisualStyleBackColor = true; - // - // key - // - key.Hexadecimal = true; - key.Location = new System.Drawing.Point(199, 18); - key.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - key.Maximum = new decimal(new int[] { 255, 0, 0, 0 }); - key.Name = "key"; - key.Size = new System.Drawing.Size(55, 23); - key.TabIndex = 8; - keyToolTip.SetToolTip(key, "Key in hex"); - // - // groupBox4 - // - groupBox4.AutoSize = true; - groupBox4.Controls.Add(disableAnimationClip); - groupBox4.Controls.Add(minimalAssetMap); - groupBox4.Controls.Add(disableShader); - groupBox4.Controls.Add(disableRenderer); - groupBox4.Controls.Add(key); - groupBox4.Controls.Add(encrypted); - groupBox4.Location = new System.Drawing.Point(13, 287); - groupBox4.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - groupBox4.Name = "groupBox4"; - groupBox4.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); - groupBox4.Size = new System.Drawing.Size(272, 146); - groupBox4.TabIndex = 13; - groupBox4.TabStop = false; - groupBox4.Text = "Options"; - // - // disableAnimationClip - // - disableAnimationClip.AutoSize = true; - disableAnimationClip.Location = new System.Drawing.Point(119, 72); - disableAnimationClip.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - disableAnimationClip.Name = "disableAnimationClip"; - disableAnimationClip.Size = new System.Drawing.Size(144, 19); - disableAnimationClip.TabIndex = 18; - disableAnimationClip.Text = "Disable AnimationClip"; - disableAnimationClip.UseVisualStyleBackColor = true; - // - // minimalAssetMap - // - minimalAssetMap.AutoSize = true; - minimalAssetMap.Location = new System.Drawing.Point(8, 97); - minimalAssetMap.Name = "minimalAssetMap"; - minimalAssetMap.Size = new System.Drawing.Size(125, 19); - minimalAssetMap.TabIndex = 17; - minimalAssetMap.Text = "Minimal AssetMap"; - minimalAssetMap.UseVisualStyleBackColor = true; - // - // disableShader - // - disableShader.AutoSize = true; - disableShader.Location = new System.Drawing.Point(8, 72); - disableShader.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - disableShader.Name = "disableShader"; - disableShader.Size = new System.Drawing.Size(103, 19); - disableShader.TabIndex = 16; - disableShader.Text = "Disable Shader"; - disableShader.UseVisualStyleBackColor = true; - // - // disableRenderer - // - disableRenderer.AutoSize = true; - disableRenderer.Location = new System.Drawing.Point(8, 47); - disableRenderer.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - disableRenderer.Name = "disableRenderer"; - disableRenderer.Size = new System.Drawing.Size(114, 19); - disableRenderer.TabIndex = 15; - disableRenderer.Text = "Disable Renderer"; - disableRenderer.UseVisualStyleBackColor = true; - // // ExportOptions // AcceptButton = OKbutton; AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + AutoScaleMode = AutoScaleMode.Font; CancelButton = Cancel; - ClientSize = new System.Drawing.Size(567, 480); - Controls.Add(groupBox4); + ClientSize = new System.Drawing.Size(677, 480); Controls.Add(groupBox2); Controls.Add(groupBox1); Controls.Add(Cancel); Controls.Add(OKbutton); - Margin = new System.Windows.Forms.Padding(4); + FormBorderStyle = FormBorderStyle.Fixed3D; + Margin = new Padding(4); MaximizeBox = false; MinimizeBox = false; Name = "ExportOptions"; ShowIcon = false; ShowInTaskbar = false; - StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + StartPosition = FormStartPosition.CenterScreen; Text = "Export options"; TopMost = true; groupBox1.ResumeLayout(false); groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)uvsGridView).EndInit(); + ((System.ComponentModel.ISupportInitialize)key).EndInit(); panel1.ResumeLayout(false); panel1.PerformLayout(); groupBox2.ResumeLayout(false); groupBox2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)texsGridView).EndInit(); ((System.ComponentModel.ISupportInitialize)scaleFactor).EndInit(); ((System.ComponentModel.ISupportInitialize)boneSize).EndInit(); ((System.ComponentModel.ISupportInitialize)filterPrecision).EndInit(); - ((System.ComponentModel.ISupportInitialize)key).EndInit(); - groupBox4.ResumeLayout(false); - groupBox4.PerformLayout(); ResumeLayout(false); PerformLayout(); } @@ -671,21 +716,23 @@ namespace AssetStudio.GUI private System.Windows.Forms.CheckBox exportBlendShape; private System.Windows.Forms.CheckBox exportAnimations; private System.Windows.Forms.ComboBox assetGroupOptions; - private System.Windows.Forms.Label label6; private System.Windows.Forms.CheckBox restoreExtensionName; private System.Windows.Forms.CheckBox openAfterExport; - private System.Windows.Forms.CheckBox exportAllUvsAsDiffuseMaps; private System.Windows.Forms.ToolTip exportUvsTooltip; private System.Windows.Forms.CheckBox collectAnimations; private System.Windows.Forms.CheckBox encrypted; private System.Windows.Forms.NumericUpDown key; private System.Windows.Forms.ToolTip keyToolTip; - private System.Windows.Forms.CheckBox exportUV0UV1; - private System.Windows.Forms.GroupBox groupBox4; - private System.Windows.Forms.CheckBox disableShader; - private System.Windows.Forms.CheckBox disableRenderer; private System.Windows.Forms.CheckBox minimalAssetMap; private System.Windows.Forms.Label label7; - private System.Windows.Forms.CheckBox disableAnimationClip; + private System.Windows.Forms.DataGridView texsGridView; + private Label label9; + private DataGridViewTextBoxColumn TexName; + private DataGridViewComboBoxColumn TexType; + private Label label6; + private DataGridView uvsGridView; + private DataGridViewTextBoxColumn UVName; + private DataGridViewCheckBoxColumn UVEnabled; + private DataGridViewComboBoxColumn UVType; } } diff --git a/AssetStudio.GUI/ExportOptions.cs b/AssetStudio.GUI/ExportOptions.cs index 1a25ce7..cab4beb 100644 --- a/AssetStudio.GUI/ExportOptions.cs +++ b/AssetStudio.GUI/ExportOptions.cs @@ -1,5 +1,4 @@ -using AssetStudio; -using Newtonsoft.Json; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; @@ -9,6 +8,17 @@ namespace AssetStudio.GUI { public partial class ExportOptions : Form { + private Dictionary typeMap = new Dictionary() + { + { 0, "Diffuse" }, + { 1, "NormalMap" }, + { 2, "Specular" }, + { 3, "Bump" }, + { 4, "Ambient" }, + { 5, "Emissive" }, + { 6, "Reflection" }, + { 7, "Displacement" }, + }; public ExportOptions() { InitializeComponent(); @@ -33,8 +43,6 @@ namespace AssetStudio.GUI exportAnimations.Checked = Properties.Settings.Default.exportAnimations; exportBlendShape.Checked = Properties.Settings.Default.exportBlendShape; castToBone.Checked = Properties.Settings.Default.castToBone; - exportAllUvsAsDiffuseMaps.Checked = Properties.Settings.Default.exportAllUvsAsDiffuseMaps; - exportUV0UV1.Checked = Properties.Settings.Default.exportUV0UV1; boneSize.Value = Properties.Settings.Default.boneSize; scaleFactor.Value = Properties.Settings.Default.scaleFactor; fbxVersion.SelectedIndex = Properties.Settings.Default.fbxVersion; @@ -42,10 +50,24 @@ namespace AssetStudio.GUI collectAnimations.Checked = Properties.Settings.Default.collectAnimations; encrypted.Checked = Properties.Settings.Default.encrypted; key.Value = Properties.Settings.Default.key; - disableRenderer.Checked = Properties.Settings.Default.disableRenderer; - disableShader.Checked = Properties.Settings.Default.disableShader; - disableAnimationClip.Checked = Properties.Settings.Default.disableAnimationClip; minimalAssetMap.Checked = Properties.Settings.Default.minimalAssetMap; + var uvs = JsonConvert.DeserializeObject>(Properties.Settings.Default.uvs); + foreach (var uv in uvs) + { + var rowIdx = uvsGridView.Rows.Add(); + + uvsGridView.Rows[rowIdx].Cells["UVName"].Value = uv.Key; + uvsGridView.Rows[rowIdx].Cells["UVEnabled"].Value = uv.Value.Item1; + uvsGridView.Rows[rowIdx].Cells["UVType"].Value = typeMap[uv.Value.Item2]; + } + var texs = JsonConvert.DeserializeObject>(Properties.Settings.Default.texs); + foreach (var tex in texs) + { + var rowIdx = texsGridView.Rows.Add(); + + texsGridView.Rows[rowIdx].Cells["TexName"].Value = tex.Key; + texsGridView.Rows[rowIdx].Cells["TexType"].Value = typeMap[tex.Value]; + } } private void OKbutton_Click(object sender, EventArgs e) @@ -70,8 +92,6 @@ namespace AssetStudio.GUI Properties.Settings.Default.exportAnimations = exportAnimations.Checked; Properties.Settings.Default.exportBlendShape = exportBlendShape.Checked; Properties.Settings.Default.castToBone = castToBone.Checked; - Properties.Settings.Default.exportAllUvsAsDiffuseMaps = exportAllUvsAsDiffuseMaps.Checked; - Properties.Settings.Default.exportUV0UV1 = exportUV0UV1.Checked; Properties.Settings.Default.boneSize = boneSize.Value; Properties.Settings.Default.scaleFactor = scaleFactor.Value; Properties.Settings.Default.fbxVersion = fbxVersion.SelectedIndex; @@ -79,17 +99,30 @@ namespace AssetStudio.GUI Properties.Settings.Default.collectAnimations = collectAnimations.Checked; Properties.Settings.Default.encrypted = encrypted.Checked; Properties.Settings.Default.key = (byte)key.Value; - Properties.Settings.Default.disableRenderer = disableRenderer.Checked; - Properties.Settings.Default.disableShader = disableShader.Checked; - Properties.Settings.Default.disableAnimationClip = disableAnimationClip.Checked; Properties.Settings.Default.minimalAssetMap = minimalAssetMap.Checked; + var uvs = new Dictionary(); + foreach (DataGridViewRow row in uvsGridView.Rows) + { + var name = row.Cells["UVName"].Value as string; + var enabled = (bool)row.Cells["UVEnabled"].Value; + var type = row.Cells["UVType"].Value as string; + if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(type)) continue; + uvs.Add(name, (enabled, typeMap.FirstOrDefault(x => x.Value == type).Key)); + } + Properties.Settings.Default.uvs = JsonConvert.SerializeObject(uvs); + var texs = new Dictionary(); + foreach (DataGridViewRow row in texsGridView.Rows) + { + var name = row.Cells["TexName"].Value as string; + var type = row.Cells["TexType"].Value as string; + if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(type)) continue; + texs.Add(name, typeMap.FirstOrDefault(x => x.Value == type).Key); + } + Properties.Settings.Default.texs = JsonConvert.SerializeObject(texs); Properties.Settings.Default.Save(); MiHoYoBinData.Key = (byte)key.Value; MiHoYoBinData.Encrypted = encrypted.Checked; AssetsHelper.Minimal = Properties.Settings.Default.minimalAssetMap; - Renderer.Parsable = !Properties.Settings.Default.disableRenderer; - Shader.Parsable = !Properties.Settings.Default.disableShader; - AnimationClip.Parsable = !Properties.Settings.Default.disableAnimationClip; DialogResult = DialogResult.OK; Close(); } diff --git a/AssetStudio.GUI/ExportOptions.resx b/AssetStudio.GUI/ExportOptions.resx index a0d6ca8..c378442 100644 --- a/AssetStudio.GUI/ExportOptions.resx +++ b/AssetStudio.GUI/ExportOptions.resx @@ -18,7 +18,7 @@ System.Resources.ResXResourceReader, System.Windows.Forms, ... System.Resources.ResXResourceWriter, System.Windows.Forms, ... this is my long stringthis is a comment - Blue + Blue [base64 mime encoded serialized .NET Framework object] @@ -117,12 +117,21 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 + + True + + + True + + + True 162, 17 + + 17, 17 + 57 diff --git a/AssetStudio.GUI/Exporter.cs b/AssetStudio.GUI/Exporter.cs index 0318441..dc4c8fe 100644 --- a/AssetStudio.GUI/Exporter.cs +++ b/AssetStudio.GUI/Exporter.cs @@ -335,8 +335,8 @@ namespace AssetStudio.GUI } var m_Animator = (Animator)item.Asset; var convert = animationList != null - ? new ModelConverter(m_Animator, Properties.Settings.Default.convertType, Studio.Game, Properties.Settings.Default.collectAnimations, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) - : new ModelConverter(m_Animator, Properties.Settings.Default.convertType, Studio.Game, Properties.Settings.Default.collectAnimations); + ? new ModelConverter(m_Animator, Properties.Settings.Default.convertType, Properties.Settings.Default.texs, Properties.Settings.Default.uvs, Studio.Game, Properties.Settings.Default.collectAnimations, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) + : new ModelConverter(m_Animator, Properties.Settings.Default.convertType, Properties.Settings.Default.texs, Properties.Settings.Default.uvs, Studio.Game, Properties.Settings.Default.collectAnimations); ExportFbx(convert, exportFullPath); return true; } @@ -356,8 +356,8 @@ namespace AssetStudio.GUI public static void ExportGameObject(GameObject gameObject, string exportPath, List animationList = null) { var convert = animationList != null - ? new ModelConverter(gameObject, Properties.Settings.Default.convertType, Studio.Game, Properties.Settings.Default.collectAnimations, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) - : new ModelConverter(gameObject, Properties.Settings.Default.convertType, Studio.Game, Properties.Settings.Default.collectAnimations); + ? new ModelConverter(gameObject, Properties.Settings.Default.convertType, Properties.Settings.Default.texs, Properties.Settings.Default.uvs, Studio.Game, Properties.Settings.Default.collectAnimations, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) + : new ModelConverter(gameObject, Properties.Settings.Default.convertType, Properties.Settings.Default.texs, Properties.Settings.Default.uvs, Studio.Game, Properties.Settings.Default.collectAnimations); exportPath = exportPath + FixFileName(gameObject.m_Name) + ".fbx"; ExportFbx(convert, exportPath); } @@ -366,8 +366,8 @@ namespace AssetStudio.GUI { var rootName = Path.GetFileNameWithoutExtension(exportPath); var convert = animationList != null - ? new ModelConverter(rootName, gameObject, Properties.Settings.Default.convertType, Studio.Game, Properties.Settings.Default.collectAnimations, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) - : new ModelConverter(rootName, gameObject, Properties.Settings.Default.convertType, Studio.Game, Properties.Settings.Default.collectAnimations); + ? new ModelConverter(rootName, gameObject, Properties.Settings.Default.convertType, Properties.Settings.Default.texs, Properties.Settings.Default.uvs, Studio.Game, Properties.Settings.Default.collectAnimations, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) + : new ModelConverter(rootName, gameObject, Properties.Settings.Default.convertType, Properties.Settings.Default.texs, Properties.Settings.Default.uvs, Studio.Game, Properties.Settings.Default.collectAnimations); ExportFbx(convert, exportPath); } @@ -383,8 +383,6 @@ namespace AssetStudio.GUI exportBlendShape = Properties.Settings.Default.exportBlendShape, castToBone = Properties.Settings.Default.castToBone, boneSize = (int)Properties.Settings.Default.boneSize, - exportAllUvsAsDiffuseMaps = Properties.Settings.Default.exportAllUvsAsDiffuseMaps, - exportUV0UV1 = Properties.Settings.Default.exportUV0UV1, scaleFactor = (float)Properties.Settings.Default.scaleFactor, fbxVersion = Properties.Settings.Default.fbxVersion, fbxFormat = Properties.Settings.Default.fbxFormat diff --git a/AssetStudio.GUI/Libraries/x64/AssetStudio.FBXNative.dll b/AssetStudio.GUI/Libraries/x64/AssetStudio.FBXNative.dll index 844aff6..5f9e1c5 100644 Binary files a/AssetStudio.GUI/Libraries/x64/AssetStudio.FBXNative.dll and b/AssetStudio.GUI/Libraries/x64/AssetStudio.FBXNative.dll differ diff --git a/AssetStudio.GUI/Libraries/x86/AssetStudio.FBXNative.dll b/AssetStudio.GUI/Libraries/x86/AssetStudio.FBXNative.dll index a66df5c..9be8ef0 100644 Binary files a/AssetStudio.GUI/Libraries/x86/AssetStudio.FBXNative.dll and b/AssetStudio.GUI/Libraries/x86/AssetStudio.FBXNative.dll differ diff --git a/AssetStudio.GUI/MainForm.cs b/AssetStudio.GUI/MainForm.cs index 2596678..ab92486 100644 --- a/AssetStudio.GUI/MainForm.cs +++ b/AssetStudio.GUI/MainForm.cs @@ -111,9 +111,6 @@ namespace AssetStudio.GUI MiHoYoBinData.Encrypted = Properties.Settings.Default.encrypted; MiHoYoBinData.Key = Properties.Settings.Default.key; AssetsHelper.Minimal = Properties.Settings.Default.minimalAssetMap; - Renderer.Parsable = !Properties.Settings.Default.disableRenderer; - Shader.Parsable = !Properties.Settings.Default.disableShader; - AnimationClip.Parsable = !Properties.Settings.Default.disableAnimationClip; } private void InitializeLogger() @@ -1293,12 +1290,12 @@ namespace AssetStudio.GUI private void PreviewGameObject(GameObject m_GameObject) { - var model = new ModelConverter(m_GameObject, Properties.Settings.Default.convertType, Studio.Game, false, Array.Empty()); + var model = new ModelConverter(m_GameObject, Properties.Settings.Default.convertType, Properties.Settings.Default.texs, Properties.Settings.Default.uvs, Studio.Game, false, Array.Empty()); PreviewModel(model); } private void PreviewAnimator(Animator m_Animator) { - var model = new ModelConverter(m_Animator, Properties.Settings.Default.convertType, Studio.Game, false, Array.Empty()); + var model = new ModelConverter(m_Animator, Properties.Settings.Default.convertType, Properties.Settings.Default.texs, Properties.Settings.Default.uvs, Studio.Game, false, Array.Empty()); PreviewModel(model); } diff --git a/AssetStudio.GUI/Properties/Settings.Designer.cs b/AssetStudio.GUI/Properties/Settings.Designer.cs index a7ea93a..d1d7d74 100644 --- a/AssetStudio.GUI/Properties/Settings.Designer.cs +++ b/AssetStudio.GUI/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace AssetStudio.GUI.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.7.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -263,18 +263,6 @@ namespace AssetStudio.GUI.Properties { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool exportAllUvsAsDiffuseMaps { - get { - return ((bool)(this["exportAllUvsAsDiffuseMaps"])); - } - set { - this["exportAllUvsAsDiffuseMaps"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("147")] @@ -371,42 +359,6 @@ namespace AssetStudio.GUI.Properties { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool exportUV0UV1 { - get { - return ((bool)(this["exportUV0UV1"])); - } - set { - this["exportUV0UV1"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool disableShader { - get { - return ((bool)(this["disableShader"])); - } - set { - this["disableShader"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool disableRenderer { - get { - return ((bool)(this["disableRenderer"])); - } - set { - this["disableRenderer"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] @@ -467,18 +419,6 @@ namespace AssetStudio.GUI.Properties { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool disableAnimationClip { - get { - return ((bool)(this["disableAnimationClip"])); - } - set { - this["disableAnimationClip"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] @@ -502,5 +442,32 @@ namespace AssetStudio.GUI.Properties { this["enableVerbose"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("{\"UV0\":{\"Item1\":true,\"Item2\":0},\"UV1\":{\"Item1\":false,\"Item2\":1},\"UV2\":{\"Item1\":tr" + + "ue,\"Item2\":0},\"UV3\":{\"Item1\":false,\"Item2\":0},\"UV4\":{\"Item1\":false,\"Item2\":0},\"U" + + "V5\":{\"Item1\":false,\"Item2\":0},\"UV6\":{\"Item1\":true,\"Item2\":0},\"UV7\":{\"Item1\":true" + + ",\"Item2\":0}}")] + public string uvs { + get { + return ((string)(this["uvs"])); + } + set { + this["uvs"] = 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 39ae294..3ddcde7 100644 --- a/AssetStudio.GUI/Properties/Settings.settings +++ b/AssetStudio.GUI/Properties/Settings.settings @@ -62,9 +62,6 @@ True - - False - 147 @@ -89,15 +86,6 @@ False - - False - - - False - - - False - True @@ -113,14 +101,17 @@ - - False - True False + + {"UV0":{"Item1":true,"Item2":0},"UV1":{"Item1":false,"Item2":1},"UV2":{"Item1":true,"Item2":0},"UV3":{"Item1":false,"Item2":0},"UV4":{"Item1":false,"Item2":0},"UV5":{"Item1":false,"Item2":0},"UV6":{"Item1":true,"Item2":0},"UV7":{"Item1":true,"Item2":0}} + + + {} + \ No newline at end of file diff --git a/AssetStudio.GUI/Studio.cs b/AssetStudio.GUI/Studio.cs index 1ae95e9..c7d7454 100644 --- a/AssetStudio.GUI/Studio.cs +++ b/AssetStudio.GUI/Studio.cs @@ -301,13 +301,13 @@ namespace AssetStudio.GUI break; case Mesh _: case TextAsset _: - case AnimationClip _ when AnimationClip.Parsable: + case AnimationClip _: case Font _: case MovieTexture _: case Sprite _: case Material _: case MiHoYoBinData _: - case Shader _ when Shader.Parsable: + case Shader _: case Animator _: case MonoBehaviour _: exportable = true; diff --git a/AssetStudio.Utility/ModelConverter.cs b/AssetStudio.Utility/ModelConverter.cs index a9e14db..4487a12 100644 --- a/AssetStudio.Utility/ModelConverter.cs +++ b/AssetStudio.Utility/ModelConverter.cs @@ -1,4 +1,5 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -23,11 +24,15 @@ namespace AssetStudio private Dictionary textureNameDictionary = new Dictionary(); private Dictionary transformDictionary = new Dictionary(); Dictionary morphChannelNames = new Dictionary(); + Dictionary uvs = new Dictionary(); + Dictionary texs = new Dictionary(); - public ModelConverter(GameObject m_GameObject, ImageFormat imageFormat, Game game, bool collectAnimations, AnimationClip[] animationList = null) + public ModelConverter(GameObject m_GameObject, ImageFormat imageFormat, string texs, string uvs, Game game, bool collectAnimations, AnimationClip[] animationList = null) { Game = game; this.imageFormat = imageFormat; + this.texs = JsonConvert.DeserializeObject>(texs); + this.uvs = JsonConvert.DeserializeObject>(uvs); if (m_GameObject.m_Animator != null) { InitWithAnimator(m_GameObject.m_Animator); @@ -50,10 +55,12 @@ namespace AssetStudio ConvertAnimations(); } - public ModelConverter(string rootName, List m_GameObjects, ImageFormat imageFormat, Game game, bool collectAnimations, AnimationClip[] animationList = null) + public ModelConverter(string rootName, List m_GameObjects, ImageFormat imageFormat, string texs, string uvs, Game game, bool collectAnimations, AnimationClip[] animationList = null) { Game = game; this.imageFormat = imageFormat; + this.texs = JsonConvert.DeserializeObject>(texs); + this.uvs = JsonConvert.DeserializeObject>(uvs); RootFrame = CreateFrame(rootName, Vector3.Zero, new Quaternion(0, 0, 0, 0), Vector3.One); foreach (var m_GameObject in m_GameObjects) { @@ -81,10 +88,12 @@ namespace AssetStudio ConvertAnimations(); } - public ModelConverter(Animator m_Animator, ImageFormat imageFormat, Game game, bool collectAnimations, AnimationClip[] animationList = null) + public ModelConverter(Animator m_Animator, ImageFormat imageFormat, string texs, string uvs, Game game, bool collectAnimations, AnimationClip[] animationList = null) { Game = game; this.imageFormat = imageFormat; + this.texs = JsonConvert.DeserializeObject>(texs); + this.uvs = JsonConvert.DeserializeObject>(uvs); InitWithAnimator(m_Animator); if (animationList == null && collectAnimations) { @@ -300,9 +309,12 @@ namespace AssetStudio iMesh.hasNormal = mesh.m_Normals?.Length > 0; iMesh.hasUV = new bool[8]; + iMesh.uvType = new int[8]; for (int uv = 0; uv < 8; uv++) { - iMesh.hasUV[uv] = mesh.GetUV(uv)?.Length > 0; + var key = $"UV{uv}"; + iMesh.hasUV[uv] = mesh.GetUV(uv)?.Length > 0 && uvs[key].Item1; + iMesh.uvType[uv] = uvs[key].Item2; } iMesh.hasTangent = mesh.m_Tangents != null && mesh.m_Tangents.Length == mesh.m_VertexCount * 4; iMesh.hasColor = mesh.m_Colors?.Length > 0; @@ -708,7 +720,9 @@ namespace AssetStudio iMat.Textures.Add(texture); int dest = -1; - if (texEnv.Key == "_MainTex") + if (texs.TryGetValue(texEnv.Key, out var targetDest)) + dest = targetDest; + else if (texEnv.Key == "_MainTex") dest = 0; else if (texEnv.Key == "_BumpMap") dest = 3; @@ -716,10 +730,6 @@ namespace AssetStudio dest = 2; else if (texEnv.Key.Contains("Normal")) dest = 1; - else if (Game.Type.IsSRGroup() && texEnv.Key.Contains("Pack")) - dest = 0; - else if (Game.Type.IsArknightsEndfield() && texEnv.Key == "_BaseMap") - dest = 0; texture.Dest = dest; diff --git a/AssetStudio/AssetsHelper.cs b/AssetStudio/AssetsHelper.cs index 6d9d90b..4c97deb 100644 --- a/AssetStudio/AssetsHelper.cs +++ b/AssetStudio/AssetsHelper.cs @@ -388,7 +388,7 @@ namespace AssetStudio asset.Name = gameObject.m_Name; exportable = !Minimal; break; - case ClassIDType.Shader when Shader.Parsable: + case ClassIDType.Shader: asset.Name = objectReader.ReadAlignedString(); if (string.IsNullOrEmpty(asset.Name)) { @@ -423,7 +423,7 @@ namespace AssetStudio case ClassIDType.Texture2D: case ClassIDType.VideoClip: case ClassIDType.AudioClip: - case ClassIDType.AnimationClip when AnimationClip.Parsable: + case ClassIDType.AnimationClip: asset.Name = objectReader.ReadAlignedString(); break; default: diff --git a/AssetStudio/AssetsManager.cs b/AssetStudio/AssetsManager.cs index beccd03..5665610 100644 --- a/AssetStudio/AssetsManager.cs +++ b/AssetStudio/AssetsManager.cs @@ -646,7 +646,7 @@ namespace AssetStudio Object obj = objectReader.type switch { ClassIDType.Animation => new Animation(objectReader), - ClassIDType.AnimationClip when AnimationClip.Parsable => new AnimationClip(objectReader), + ClassIDType.AnimationClip => new AnimationClip(objectReader), ClassIDType.Animator => new Animator(objectReader), ClassIDType.AnimatorController => new AnimatorController(objectReader), ClassIDType.AnimatorOverrideController => new AnimatorOverrideController(objectReader), @@ -659,15 +659,15 @@ namespace AssetStudio ClassIDType.Material => new Material(objectReader), ClassIDType.Mesh => new Mesh(objectReader), ClassIDType.MeshFilter => new MeshFilter(objectReader), - ClassIDType.MeshRenderer when Renderer.Parsable => new MeshRenderer(objectReader), + ClassIDType.MeshRenderer => new MeshRenderer(objectReader), ClassIDType.MiHoYoBinData => new MiHoYoBinData(objectReader), ClassIDType.MonoBehaviour => new MonoBehaviour(objectReader), ClassIDType.MonoScript => new MonoScript(objectReader), ClassIDType.MovieTexture => new MovieTexture(objectReader), ClassIDType.PlayerSettings => new PlayerSettings(objectReader), ClassIDType.RectTransform => new RectTransform(objectReader), - ClassIDType.Shader when Shader.Parsable => new Shader(objectReader), - ClassIDType.SkinnedMeshRenderer when Renderer.Parsable => new SkinnedMeshRenderer(objectReader), + ClassIDType.Shader => new Shader(objectReader), + ClassIDType.SkinnedMeshRenderer => new SkinnedMeshRenderer(objectReader), ClassIDType.Sprite => new Sprite(objectReader), ClassIDType.SpriteAtlas => new SpriteAtlas(objectReader), ClassIDType.TextAsset => new TextAsset(objectReader), diff --git a/AssetStudio/Classes/AnimationClip.cs b/AssetStudio/Classes/AnimationClip.cs index 53ee896..16f7a1f 100644 --- a/AssetStudio/Classes/AnimationClip.cs +++ b/AssetStudio/Classes/AnimationClip.cs @@ -1717,8 +1717,6 @@ namespace AssetStudio public sealed class AnimationClip : NamedObject { - public static bool Parsable; - public AnimationType m_AnimationType; public bool m_Legacy; public bool m_Compressed; diff --git a/AssetStudio/Classes/Renderer.cs b/AssetStudio/Classes/Renderer.cs index fd8156f..cc248e7 100644 --- a/AssetStudio/Classes/Renderer.cs +++ b/AssetStudio/Classes/Renderer.cs @@ -19,8 +19,6 @@ namespace AssetStudio public abstract class Renderer : Component { - public static bool Parsable; - public List> m_Materials; public StaticBatchInfo m_StaticBatchInfo; public uint[] m_SubsetIndices; diff --git a/AssetStudio/Classes/Shader.cs b/AssetStudio/Classes/Shader.cs index 384a20f..59aa4b1 100644 --- a/AssetStudio/Classes/Shader.cs +++ b/AssetStudio/Classes/Shader.cs @@ -988,8 +988,6 @@ namespace AssetStudio public class Shader : NamedObject { - public static bool Parsable; - public byte[] m_Script; //5.3 - 5.4 public uint decompressedSize; diff --git a/AssetStudio/IImported.cs b/AssetStudio/IImported.cs index 8dc51cf..8542d1e 100644 --- a/AssetStudio/IImported.cs +++ b/AssetStudio/IImported.cs @@ -159,6 +159,7 @@ namespace AssetStudio public List BoneList { get; set; } public bool hasNormal { get; set; } public bool[] hasUV { get; set; } + public int[] uvType { get; set; } public bool hasTangent { get; set; } public bool hasColor { get; set; } }