From c9cf2d188e477f6f5c09680fdce6ff8067e0a999 Mon Sep 17 00:00:00 2001 From: Patrick King Date: Fri, 11 Jun 2021 14:26:37 -0600 Subject: [PATCH 1/2] Enable FBX export for higher UV maps. --- AssetStudioFBXWrapper/FbxExporterContext.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/AssetStudioFBXWrapper/FbxExporterContext.cs b/AssetStudioFBXWrapper/FbxExporterContext.cs index d18beb3..e29f272 100644 --- a/AssetStudioFBXWrapper/FbxExporterContext.cs +++ b/AssetStudioFBXWrapper/FbxExporterContext.cs @@ -270,6 +270,14 @@ namespace AssetStudio.FbxInterop AsFbxMeshCreateNormalMapUV(mesh, 1); } + for (int i = 2; i < importedMesh.hasUV.Length; i++) + { + if (importedMesh.hasUV[i]) + { + AsFbxMeshCreateDiffuseUV(mesh, i); + } + } + if (importedMesh.hasTangent) { AsFbxMeshCreateElementTangent(mesh); @@ -362,7 +370,7 @@ namespace AssetStudio.FbxInterop AsFbxMeshElementNormalAdd(mesh, 0, normal.X, normal.Y, normal.Z); } - for (var uvIndex = 0; uvIndex < 2; uvIndex += 1) + for (var uvIndex = 0; uvIndex < importedMesh.hasUV.Length; uvIndex += 1) { if (importedMesh.hasUV[uvIndex]) { From 57e4f7cefdf2c9a92a32febbcff34a2cb8f1c9d5 Mon Sep 17 00:00:00 2001 From: Patrick King Date: Fri, 11 Jun 2021 17:12:15 -0600 Subject: [PATCH 2/2] Add an option to export all UVs as diffuse maps. --- AssetStudioFBXWrapper/Fbx.cs | 4 +- AssetStudioFBXWrapper/FbxExporter.cs | 6 +- AssetStudioFBXWrapper/FbxExporterContext.cs | 24 ++- AssetStudioGUI/ExportOptions.Designer.cs | 147 ++++++++++-------- AssetStudioGUI/ExportOptions.cs | 4 + AssetStudioGUI/ExportOptions.resx | 3 + AssetStudioGUI/Exporter.cs | 3 +- .../Properties/Settings.Designer.cs | 22 ++- AssetStudioGUI/Properties/Settings.settings | 3 + AssetStudioGUI/app.config | 3 + AssetStudioUtility/ModelExporter.cs | 4 +- 11 files changed, 133 insertions(+), 90 deletions(-) diff --git a/AssetStudioFBXWrapper/Fbx.cs b/AssetStudioFBXWrapper/Fbx.cs index 3f38884..543706b 100644 --- a/AssetStudioFBXWrapper/Fbx.cs +++ b/AssetStudioFBXWrapper/Fbx.cs @@ -28,7 +28,7 @@ namespace AssetStudio { public static void Export(string path, IImported imported, bool eulerFilter, float filterPrecision, - bool allNodes, bool skins, bool animation, bool blendShape, bool castToBone, float boneSize, float scaleFactor, int versionIndex, bool isAscii) + bool allNodes, bool skins, bool animation, bool blendShape, bool castToBone, float boneSize, bool exportAllUvsAsDiffuseMaps, float scaleFactor, int versionIndex, bool isAscii) { var file = new FileInfo(path); var dir = file.Directory; @@ -43,7 +43,7 @@ namespace AssetStudio var name = Path.GetFileName(path); - using (var exporter = new FbxExporter(name, imported, allNodes, skins, castToBone, boneSize, scaleFactor, versionIndex, isAscii)) + using (var exporter = new FbxExporter(name, imported, allNodes, skins, castToBone, boneSize, exportAllUvsAsDiffuseMaps, scaleFactor, versionIndex, isAscii)) { exporter.Initialize(); exporter.ExportAll(blendShape, animation, eulerFilter, filterPrecision); diff --git a/AssetStudioFBXWrapper/FbxExporter.cs b/AssetStudioFBXWrapper/FbxExporter.cs index ef008b7..b9e5ed6 100644 --- a/AssetStudioFBXWrapper/FbxExporter.cs +++ b/AssetStudioFBXWrapper/FbxExporter.cs @@ -15,11 +15,12 @@ namespace AssetStudio.FbxInterop private readonly bool _exportSkins; private readonly bool _castToBone; private readonly float _boneSize; + private readonly bool _exportAllUvsAsDiffuseMaps; private readonly float _scaleFactor; private readonly int _versionIndex; private readonly bool _isAscii; - internal FbxExporter(string fileName, IImported imported, bool allNodes, bool exportSkins, bool castToBone, float boneSize, float scaleFactor, int versionIndex, bool isAscii) + internal FbxExporter(string fileName, IImported imported, bool allNodes, bool exportSkins, bool castToBone, float boneSize, bool exportAllUvsAsDiffuseMaps, float scaleFactor, int versionIndex, bool isAscii) { _context = new FbxExporterContext(); @@ -29,6 +30,7 @@ namespace AssetStudio.FbxInterop _exportSkins = exportSkins; _castToBone = castToBone; _boneSize = boneSize; + _exportAllUvsAsDiffuseMaps = exportAllUvsAsDiffuseMaps; _scaleFactor = scaleFactor; _versionIndex = versionIndex; _isAscii = isAscii; @@ -171,7 +173,7 @@ namespace AssetStudio.FbxInterop { foreach (var meshFrame in meshFrames) { - _context.ExportMeshFromFrame(rootFrame, meshFrame, _imported.MeshList, _imported.MaterialList, _imported.TextureList, _exportSkins); + _context.ExportMeshFromFrame(rootFrame, meshFrame, _imported.MeshList, _imported.MaterialList, _imported.TextureList, _exportSkins, _exportAllUvsAsDiffuseMaps); } } diff --git a/AssetStudioFBXWrapper/FbxExporterContext.cs b/AssetStudioFBXWrapper/FbxExporterContext.cs index e29f272..d1c79e2 100644 --- a/AssetStudioFBXWrapper/FbxExporterContext.cs +++ b/AssetStudioFBXWrapper/FbxExporterContext.cs @@ -173,12 +173,12 @@ namespace AssetStudio.FbxInterop AsFbxPrepareMaterials(_pContext, materialCount, textureCount); } - internal void ExportMeshFromFrame(ImportedFrame rootFrame, ImportedFrame meshFrame, List meshList, List materialList, List textureList, bool exportSkins) + internal void ExportMeshFromFrame(ImportedFrame rootFrame, ImportedFrame meshFrame, List meshList, List materialList, List textureList, bool exportSkins, bool exportAllUvsAsDiffuseMaps) { var meshNode = _frameToNode[meshFrame]; var mesh = ImportedHelpers.FindMesh(meshFrame.Path, meshList); - ExportMesh(rootFrame, materialList, textureList, meshNode, mesh, exportSkins); + ExportMesh(rootFrame, materialList, textureList, meshNode, mesh, exportSkins, exportAllUvsAsDiffuseMaps); } private IntPtr ExportTexture(ImportedTexture texture) @@ -207,7 +207,7 @@ namespace AssetStudio.FbxInterop return pTex; } - private void ExportMesh(ImportedFrame rootFrame, List materialList, List textureList, IntPtr frameNode, ImportedMesh importedMesh, bool exportSkins) + private void ExportMesh(ImportedFrame rootFrame, List materialList, List textureList, IntPtr frameNode, ImportedMesh importedMesh, bool exportSkins, bool exportAllUvsAsDiffuseMaps) { var boneList = importedMesh.BoneList; var totalBoneCount = 0; @@ -260,19 +260,15 @@ namespace AssetStudio.FbxInterop AsFbxMeshCreateElementNormal(mesh); } - if (importedMesh.hasUV[0]) + for (int i = 0; i < importedMesh.hasUV.Length; i++) { - AsFbxMeshCreateDiffuseUV(mesh, 0); - } + if (!importedMesh.hasUV[i]) {continue;} - if (importedMesh.hasUV[1]) - { - AsFbxMeshCreateNormalMapUV(mesh, 1); - } - - for (int i = 2; i < importedMesh.hasUV.Length; i++) - { - if (importedMesh.hasUV[i]) + if (i == 1 && !exportAllUvsAsDiffuseMaps) + { + AsFbxMeshCreateNormalMapUV(mesh, 1); + } + else { AsFbxMeshCreateDiffuseUV(mesh, i); } diff --git a/AssetStudioGUI/ExportOptions.Designer.cs b/AssetStudioGUI/ExportOptions.Designer.cs index b8e9198..02d8fe7 100644 --- a/AssetStudioGUI/ExportOptions.Designer.cs +++ b/AssetStudioGUI/ExportOptions.Designer.cs @@ -28,6 +28,7 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.OKbutton = new System.Windows.Forms.Button(); this.Cancel = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); @@ -43,6 +44,7 @@ this.tobmp = new System.Windows.Forms.RadioButton(); this.converttexture = new System.Windows.Forms.CheckBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.exportAllUvsAsDiffuseMaps = new System.Windows.Forms.CheckBox(); this.exportBlendShape = new System.Windows.Forms.CheckBox(); this.exportAnimations = new System.Windows.Forms.CheckBox(); this.scaleFactor = new System.Windows.Forms.NumericUpDown(); @@ -59,6 +61,7 @@ this.castToBone = new System.Windows.Forms.CheckBox(); this.exportAllNodes = new System.Windows.Forms.CheckBox(); this.eulerFilter = new System.Windows.Forms.CheckBox(); + this.exportUvsTooltip = new System.Windows.Forms.ToolTip(this.components); this.groupBox1.SuspendLayout(); this.panel1.SuspendLayout(); this.groupBox2.SuspendLayout(); @@ -69,9 +72,9 @@ // // OKbutton // - this.OKbutton.Location = new System.Drawing.Point(308, 320); + this.OKbutton.Location = new System.Drawing.Point(309, 381); this.OKbutton.Name = "OKbutton"; - this.OKbutton.Size = new System.Drawing.Size(75, 21); + this.OKbutton.Size = new System.Drawing.Size(75, 23); this.OKbutton.TabIndex = 6; this.OKbutton.Text = "OK"; this.OKbutton.UseVisualStyleBackColor = true; @@ -80,9 +83,9 @@ // Cancel // this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.Cancel.Location = new System.Drawing.Point(389, 320); + this.Cancel.Location = new System.Drawing.Point(390, 381); this.Cancel.Name = "Cancel"; - this.Cancel.Size = new System.Drawing.Size(75, 21); + this.Cancel.Size = new System.Drawing.Size(75, 23); this.Cancel.TabIndex = 7; this.Cancel.Text = "Cancel"; this.Cancel.UseVisualStyleBackColor = true; @@ -98,9 +101,9 @@ this.groupBox1.Controls.Add(this.convertAudio); this.groupBox1.Controls.Add(this.panel1); this.groupBox1.Controls.Add(this.converttexture); - this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Location = new System.Drawing.Point(12, 13); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(232, 302); + this.groupBox1.Size = new System.Drawing.Size(232, 362); this.groupBox1.TabIndex = 9; this.groupBox1.TabStop = false; this.groupBox1.Text = "Export"; @@ -110,9 +113,9 @@ this.openAfterExport.AutoSize = true; this.openAfterExport.Checked = true; this.openAfterExport.CheckState = System.Windows.Forms.CheckState.Checked; - this.openAfterExport.Location = new System.Drawing.Point(6, 160); + this.openAfterExport.Location = new System.Drawing.Point(6, 173); this.openAfterExport.Name = "openAfterExport"; - this.openAfterExport.Size = new System.Drawing.Size(168, 16); + this.openAfterExport.Size = new System.Drawing.Size(137, 17); this.openAfterExport.TabIndex = 10; this.openAfterExport.Text = "Open folder after export"; this.openAfterExport.UseVisualStyleBackColor = true; @@ -122,9 +125,9 @@ this.restoreExtensionName.AutoSize = true; this.restoreExtensionName.Checked = true; this.restoreExtensionName.CheckState = System.Windows.Forms.CheckState.Checked; - this.restoreExtensionName.Location = new System.Drawing.Point(6, 58); + this.restoreExtensionName.Location = new System.Drawing.Point(6, 63); this.restoreExtensionName.Name = "restoreExtensionName"; - this.restoreExtensionName.Size = new System.Drawing.Size(216, 16); + this.restoreExtensionName.Size = new System.Drawing.Size(190, 17); this.restoreExtensionName.TabIndex = 9; this.restoreExtensionName.Text = "Restore TextAsset extension name"; this.restoreExtensionName.UseVisualStyleBackColor = true; @@ -138,17 +141,17 @@ "container path", "source file name", "do not group"}); - this.assetGroupOptions.Location = new System.Drawing.Point(6, 32); + this.assetGroupOptions.Location = new System.Drawing.Point(6, 35); this.assetGroupOptions.Name = "assetGroupOptions"; - this.assetGroupOptions.Size = new System.Drawing.Size(149, 20); + this.assetGroupOptions.Size = new System.Drawing.Size(149, 21); this.assetGroupOptions.TabIndex = 8; // // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(6, 17); + this.label6.Location = new System.Drawing.Point(6, 18); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(149, 12); + this.label6.Size = new System.Drawing.Size(127, 13); this.label6.TabIndex = 7; this.label6.Text = "Group exported assets by"; // @@ -157,9 +160,9 @@ this.convertAudio.AutoSize = true; this.convertAudio.Checked = true; this.convertAudio.CheckState = System.Windows.Forms.CheckState.Checked; - this.convertAudio.Location = new System.Drawing.Point(6, 138); + this.convertAudio.Location = new System.Drawing.Point(6, 150); this.convertAudio.Name = "convertAudio"; - this.convertAudio.Size = new System.Drawing.Size(198, 16); + this.convertAudio.Size = new System.Drawing.Size(179, 17); this.convertAudio.TabIndex = 6; this.convertAudio.Text = "Convert AudioClip to WAV(PCM)"; this.convertAudio.UseVisualStyleBackColor = true; @@ -170,17 +173,17 @@ this.panel1.Controls.Add(this.tojpg); this.panel1.Controls.Add(this.topng); this.panel1.Controls.Add(this.tobmp); - this.panel1.Location = new System.Drawing.Point(20, 102); + this.panel1.Location = new System.Drawing.Point(20, 111); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(202, 30); + this.panel1.Size = new System.Drawing.Size(202, 33); this.panel1.TabIndex = 5; // // totga // this.totga.AutoSize = true; - this.totga.Location = new System.Drawing.Point(150, 6); + this.totga.Location = new System.Drawing.Point(150, 7); this.totga.Name = "totga"; - this.totga.Size = new System.Drawing.Size(41, 16); + this.totga.Size = new System.Drawing.Size(47, 17); this.totga.TabIndex = 2; this.totga.Text = "TGA"; this.totga.UseVisualStyleBackColor = true; @@ -188,9 +191,9 @@ // tojpg // this.tojpg.AutoSize = true; - this.tojpg.Location = new System.Drawing.Point(97, 6); + this.tojpg.Location = new System.Drawing.Point(97, 7); this.tojpg.Name = "tojpg"; - this.tojpg.Size = new System.Drawing.Size(47, 16); + this.tojpg.Size = new System.Drawing.Size(52, 17); this.tojpg.TabIndex = 4; this.tojpg.Text = "JPEG"; this.tojpg.UseVisualStyleBackColor = true; @@ -199,9 +202,9 @@ // this.topng.AutoSize = true; this.topng.Checked = true; - this.topng.Location = new System.Drawing.Point(50, 6); + this.topng.Location = new System.Drawing.Point(50, 7); this.topng.Name = "topng"; - this.topng.Size = new System.Drawing.Size(41, 16); + this.topng.Size = new System.Drawing.Size(48, 17); this.topng.TabIndex = 3; this.topng.TabStop = true; this.topng.Text = "PNG"; @@ -210,9 +213,9 @@ // tobmp // this.tobmp.AutoSize = true; - this.tobmp.Location = new System.Drawing.Point(3, 6); + this.tobmp.Location = new System.Drawing.Point(3, 7); this.tobmp.Name = "tobmp"; - this.tobmp.Size = new System.Drawing.Size(41, 16); + this.tobmp.Size = new System.Drawing.Size(48, 17); this.tobmp.TabIndex = 2; this.tobmp.Text = "BMP"; this.tobmp.UseVisualStyleBackColor = true; @@ -222,9 +225,9 @@ this.converttexture.AutoSize = true; this.converttexture.Checked = true; this.converttexture.CheckState = System.Windows.Forms.CheckState.Checked; - this.converttexture.Location = new System.Drawing.Point(6, 80); + this.converttexture.Location = new System.Drawing.Point(6, 87); this.converttexture.Name = "converttexture"; - this.converttexture.Size = new System.Drawing.Size(126, 16); + this.converttexture.Size = new System.Drawing.Size(116, 17); this.converttexture.TabIndex = 1; this.converttexture.Text = "Convert Texture2D"; this.converttexture.UseVisualStyleBackColor = true; @@ -232,6 +235,7 @@ // groupBox2 // this.groupBox2.AutoSize = true; + this.groupBox2.Controls.Add(this.exportAllUvsAsDiffuseMaps); this.groupBox2.Controls.Add(this.exportBlendShape); this.groupBox2.Controls.Add(this.exportAnimations); this.groupBox2.Controls.Add(this.scaleFactor); @@ -248,21 +252,34 @@ this.groupBox2.Controls.Add(this.castToBone); this.groupBox2.Controls.Add(this.exportAllNodes); this.groupBox2.Controls.Add(this.eulerFilter); - this.groupBox2.Location = new System.Drawing.Point(250, 12); + this.groupBox2.Location = new System.Drawing.Point(250, 13); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(214, 302); + this.groupBox2.Size = new System.Drawing.Size(214, 362); this.groupBox2.TabIndex = 11; this.groupBox2.TabStop = false; this.groupBox2.Text = "Fbx"; // + // exportAllUvsAsDiffuseMaps + // + this.exportAllUvsAsDiffuseMaps.AccessibleDescription = ""; + this.exportAllUvsAsDiffuseMaps.AutoSize = true; + this.exportAllUvsAsDiffuseMaps.Location = new System.Drawing.Point(6, 184); + this.exportAllUvsAsDiffuseMaps.Name = "exportAllUvsAsDiffuseMaps"; + this.exportAllUvsAsDiffuseMaps.Size = new System.Drawing.Size(168, 17); + this.exportAllUvsAsDiffuseMaps.TabIndex = 23; + this.exportAllUvsAsDiffuseMaps.Text = "Export all UVs as diffuse maps"; + this.exportUvsTooltip.SetToolTip(this.exportAllUvsAsDiffuseMaps, "Unchecked: UV1 exported as normal map. Check this if your export is missing a UV " + + "map."); + this.exportAllUvsAsDiffuseMaps.UseVisualStyleBackColor = true; + // // exportBlendShape // this.exportBlendShape.AutoSize = true; this.exportBlendShape.Checked = true; this.exportBlendShape.CheckState = System.Windows.Forms.CheckState.Checked; - this.exportBlendShape.Location = new System.Drawing.Point(6, 127); + this.exportBlendShape.Location = new System.Drawing.Point(6, 138); this.exportBlendShape.Name = "exportBlendShape"; - this.exportBlendShape.Size = new System.Drawing.Size(126, 16); + this.exportBlendShape.Size = new System.Drawing.Size(114, 17); this.exportBlendShape.TabIndex = 22; this.exportBlendShape.Text = "Export blendshape"; this.exportBlendShape.UseVisualStyleBackColor = true; @@ -272,9 +289,9 @@ this.exportAnimations.AutoSize = true; this.exportAnimations.Checked = true; this.exportAnimations.CheckState = System.Windows.Forms.CheckState.Checked; - this.exportAnimations.Location = new System.Drawing.Point(6, 105); + this.exportAnimations.Location = new System.Drawing.Point(6, 114); this.exportAnimations.Name = "exportAnimations"; - this.exportAnimations.Size = new System.Drawing.Size(126, 16); + this.exportAnimations.Size = new System.Drawing.Size(109, 17); this.exportAnimations.TabIndex = 21; this.exportAnimations.Text = "Export animations"; this.exportAnimations.UseVisualStyleBackColor = true; @@ -287,9 +304,9 @@ 0, 0, 131072}); - this.scaleFactor.Location = new System.Drawing.Point(83, 202); + this.scaleFactor.Location = new System.Drawing.Point(83, 237); this.scaleFactor.Name = "scaleFactor"; - this.scaleFactor.Size = new System.Drawing.Size(60, 21); + this.scaleFactor.Size = new System.Drawing.Size(60, 20); this.scaleFactor.TabIndex = 20; this.scaleFactor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.scaleFactor.Value = new decimal(new int[] { @@ -301,9 +318,9 @@ // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(6, 204); + this.label5.Location = new System.Drawing.Point(6, 239); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(71, 12); + this.label5.Size = new System.Drawing.Size(64, 13); this.label5.TabIndex = 19; this.label5.Text = "ScaleFactor"; // @@ -314,17 +331,17 @@ this.fbxFormat.Items.AddRange(new object[] { "Binary", "Ascii"}); - this.fbxFormat.Location = new System.Drawing.Point(77, 233); + this.fbxFormat.Location = new System.Drawing.Point(77, 270); this.fbxFormat.Name = "fbxFormat"; - this.fbxFormat.Size = new System.Drawing.Size(61, 20); + this.fbxFormat.Size = new System.Drawing.Size(61, 21); this.fbxFormat.TabIndex = 18; // // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(6, 236); + this.label4.Location = new System.Drawing.Point(6, 274); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(59, 12); + this.label4.Size = new System.Drawing.Size(59, 13); this.label4.TabIndex = 17; this.label4.Text = "FBXFormat"; // @@ -339,25 +356,25 @@ "7.3", "7.4", "7.5"}); - this.fbxVersion.Location = new System.Drawing.Point(77, 262); + this.fbxVersion.Location = new System.Drawing.Point(77, 302); this.fbxVersion.Name = "fbxVersion"; - this.fbxVersion.Size = new System.Drawing.Size(47, 20); + this.fbxVersion.Size = new System.Drawing.Size(47, 21); this.fbxVersion.TabIndex = 16; // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(6, 265); + this.label3.Location = new System.Drawing.Point(6, 305); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(65, 12); + this.label3.Size = new System.Drawing.Size(62, 13); this.label3.TabIndex = 15; this.label3.Text = "FBXVersion"; // // boneSize // - this.boneSize.Location = new System.Drawing.Point(65, 175); + this.boneSize.Location = new System.Drawing.Point(65, 208); this.boneSize.Name = "boneSize"; - this.boneSize.Size = new System.Drawing.Size(46, 21); + this.boneSize.Size = new System.Drawing.Size(46, 20); this.boneSize.TabIndex = 11; this.boneSize.Value = new decimal(new int[] { 10, @@ -368,9 +385,9 @@ // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(6, 177); + this.label2.Location = new System.Drawing.Point(6, 210); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(53, 12); + this.label2.Size = new System.Drawing.Size(52, 13); this.label2.TabIndex = 10; this.label2.Text = "BoneSize"; // @@ -379,9 +396,9 @@ this.exportSkins.AutoSize = true; this.exportSkins.Checked = true; this.exportSkins.CheckState = System.Windows.Forms.CheckState.Checked; - this.exportSkins.Location = new System.Drawing.Point(6, 83); + this.exportSkins.Location = new System.Drawing.Point(6, 90); this.exportSkins.Name = "exportSkins"; - this.exportSkins.Size = new System.Drawing.Size(96, 16); + this.exportSkins.Size = new System.Drawing.Size(83, 17); this.exportSkins.TabIndex = 8; this.exportSkins.Text = "Export skins"; this.exportSkins.UseVisualStyleBackColor = true; @@ -389,9 +406,9 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(26, 39); + this.label1.Location = new System.Drawing.Point(26, 42); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(95, 12); + this.label1.Size = new System.Drawing.Size(72, 13); this.label1.TabIndex = 7; this.label1.Text = "FilterPrecision"; // @@ -403,9 +420,9 @@ 0, 0, 131072}); - this.filterPrecision.Location = new System.Drawing.Point(127, 37); + this.filterPrecision.Location = new System.Drawing.Point(127, 40); this.filterPrecision.Name = "filterPrecision"; - this.filterPrecision.Size = new System.Drawing.Size(51, 21); + this.filterPrecision.Size = new System.Drawing.Size(51, 20); this.filterPrecision.TabIndex = 6; this.filterPrecision.Value = new decimal(new int[] { 25, @@ -416,9 +433,9 @@ // castToBone // this.castToBone.AutoSize = true; - this.castToBone.Location = new System.Drawing.Point(6, 149); + this.castToBone.Location = new System.Drawing.Point(6, 161); this.castToBone.Name = "castToBone"; - this.castToBone.Size = new System.Drawing.Size(156, 16); + this.castToBone.Size = new System.Drawing.Size(131, 17); this.castToBone.TabIndex = 5; this.castToBone.Text = "All nodes cast to bone"; this.castToBone.UseVisualStyleBackColor = true; @@ -428,9 +445,9 @@ this.exportAllNodes.AutoSize = true; this.exportAllNodes.Checked = true; this.exportAllNodes.CheckState = System.Windows.Forms.CheckState.Checked; - this.exportAllNodes.Location = new System.Drawing.Point(6, 61); + this.exportAllNodes.Location = new System.Drawing.Point(6, 66); this.exportAllNodes.Name = "exportAllNodes"; - this.exportAllNodes.Size = new System.Drawing.Size(120, 16); + this.exportAllNodes.Size = new System.Drawing.Size(101, 17); this.exportAllNodes.TabIndex = 4; this.exportAllNodes.Text = "Export all nodes"; this.exportAllNodes.UseVisualStyleBackColor = true; @@ -440,9 +457,9 @@ this.eulerFilter.AutoSize = true; this.eulerFilter.Checked = true; this.eulerFilter.CheckState = System.Windows.Forms.CheckState.Checked; - this.eulerFilter.Location = new System.Drawing.Point(6, 20); + this.eulerFilter.Location = new System.Drawing.Point(6, 22); this.eulerFilter.Name = "eulerFilter"; - this.eulerFilter.Size = new System.Drawing.Size(90, 16); + this.eulerFilter.Size = new System.Drawing.Size(72, 17); this.eulerFilter.TabIndex = 3; this.eulerFilter.Text = "EulerFilter"; this.eulerFilter.UseVisualStyleBackColor = true; @@ -450,10 +467,10 @@ // ExportOptions // this.AcceptButton = this.OKbutton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.Cancel; - this.ClientSize = new System.Drawing.Size(477, 351); + this.ClientSize = new System.Drawing.Size(477, 416); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.Cancel); @@ -512,5 +529,7 @@ 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; } } \ No newline at end of file diff --git a/AssetStudioGUI/ExportOptions.cs b/AssetStudioGUI/ExportOptions.cs index b00744a..47b7ece 100644 --- a/AssetStudioGUI/ExportOptions.cs +++ b/AssetStudioGUI/ExportOptions.cs @@ -36,10 +36,12 @@ namespace AssetStudioGUI exportAnimations.Checked = Properties.Settings.Default.exportAnimations; exportBlendShape.Checked = Properties.Settings.Default.exportBlendShape; castToBone.Checked = Properties.Settings.Default.castToBone; + exportAllUvsAsDiffuseMaps.Checked = Properties.Settings.Default.exportAllUvsAsDiffuseMaps; boneSize.Value = Properties.Settings.Default.boneSize; scaleFactor.Value = Properties.Settings.Default.scaleFactor; fbxVersion.SelectedIndex = Properties.Settings.Default.fbxVersion; fbxFormat.SelectedIndex = Properties.Settings.Default.fbxFormat; + } private void OKbutton_Click(object sender, EventArgs e) @@ -64,6 +66,7 @@ namespace AssetStudioGUI 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.boneSize = boneSize.Value; Properties.Settings.Default.scaleFactor = scaleFactor.Value; Properties.Settings.Default.fbxVersion = fbxVersion.SelectedIndex; @@ -78,5 +81,6 @@ namespace AssetStudioGUI DialogResult = DialogResult.Cancel; Close(); } + } } diff --git a/AssetStudioGUI/ExportOptions.resx b/AssetStudioGUI/ExportOptions.resx index 1af7de1..6966b18 100644 --- a/AssetStudioGUI/ExportOptions.resx +++ b/AssetStudioGUI/ExportOptions.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/AssetStudioGUI/Exporter.cs b/AssetStudioGUI/Exporter.cs index 1c00f68..b501996 100644 --- a/AssetStudioGUI/Exporter.cs +++ b/AssetStudioGUI/Exporter.cs @@ -359,11 +359,12 @@ namespace AssetStudioGUI var exportBlendShape = Properties.Settings.Default.exportBlendShape; var castToBone = Properties.Settings.Default.castToBone; var boneSize = (int)Properties.Settings.Default.boneSize; + var exportAllUvsAsDiffuseMaps = Properties.Settings.Default.exportAllUvsAsDiffuseMaps; var scaleFactor = (float)Properties.Settings.Default.scaleFactor; var fbxVersion = Properties.Settings.Default.fbxVersion; var fbxFormat = Properties.Settings.Default.fbxFormat; ModelExporter.ExportFbx(exportPath, convert, eulerFilter, filterPrecision, - exportAllNodes, exportSkins, exportAnimations, exportBlendShape, castToBone, boneSize, scaleFactor, fbxVersion, fbxFormat == 1); + exportAllNodes, exportSkins, exportAnimations, exportBlendShape, castToBone, boneSize, exportAllUvsAsDiffuseMaps, scaleFactor, fbxVersion, fbxFormat == 1); } public static bool ExportDumpFile(AssetItem item, string exportPath) diff --git a/AssetStudioGUI/Properties/Settings.Designer.cs b/AssetStudioGUI/Properties/Settings.Designer.cs index 4074970..82393e1 100644 --- a/AssetStudioGUI/Properties/Settings.Designer.cs +++ b/AssetStudioGUI/Properties/Settings.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -12,7 +12,7 @@ namespace AssetStudioGUI.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -262,5 +262,17 @@ namespace AssetStudioGUI.Properties { this["restoreExtensionName"] = value; } } + + [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; + } + } } } diff --git a/AssetStudioGUI/Properties/Settings.settings b/AssetStudioGUI/Properties/Settings.settings index 3700b01..db9a5ea 100644 --- a/AssetStudioGUI/Properties/Settings.settings +++ b/AssetStudioGUI/Properties/Settings.settings @@ -62,5 +62,8 @@ True + + False + \ No newline at end of file diff --git a/AssetStudioGUI/app.config b/AssetStudioGUI/app.config index 0088836..f9dbe6e 100644 --- a/AssetStudioGUI/app.config +++ b/AssetStudioGUI/app.config @@ -70,6 +70,9 @@ True + + False + \ No newline at end of file diff --git a/AssetStudioUtility/ModelExporter.cs b/AssetStudioUtility/ModelExporter.cs index 87bb42b..5b7813e 100644 --- a/AssetStudioUtility/ModelExporter.cs +++ b/AssetStudioUtility/ModelExporter.cs @@ -3,9 +3,9 @@ public static class ModelExporter { public static void ExportFbx(string path, IImported imported, bool eulerFilter, float filterPrecision, - bool allNodes, bool skins, bool animation, bool blendShape, bool castToBone, float boneSize, float scaleFactor, int versionIndex, bool isAscii) + bool allNodes, bool skins, bool animation, bool blendShape, bool castToBone, float boneSize, bool exportAllUvsAsDiffuseMaps, float scaleFactor, int versionIndex, bool isAscii) { - Fbx.Exporter.Export(path, imported, eulerFilter, filterPrecision, allNodes, skins, animation, blendShape, castToBone, boneSize, scaleFactor, versionIndex, isAscii); + Fbx.Exporter.Export(path, imported, eulerFilter, filterPrecision, allNodes, skins, animation, blendShape, castToBone, boneSize, exportAllUvsAsDiffuseMaps, scaleFactor, versionIndex, isAscii); } } }