From 20f9fe493f7463f1902fdb91b3f0bde3439e950d Mon Sep 17 00:00:00 2001 From: Perfare Date: Sun, 28 Jul 2019 18:55:08 +0800 Subject: [PATCH] add more options for export model --- AssetStudio/Properties/AssemblyInfo.cs | 2 +- AssetStudioFBX/AssemblyInfo.cpp | 2 +- AssetStudioFBX/AssetStudioFBX.h | 5 +- AssetStudioFBX/AssetStudioFBXExporter.cpp | 67 +++++---- AssetStudioGUI/ExportOptions.Designer.cs | 130 +++++++++++------- AssetStudioGUI/ExportOptions.cs | 16 ++- AssetStudioGUI/Exporter.cs | 11 +- AssetStudioGUI/Properties/AssemblyInfo.cs | 2 +- .../Properties/Settings.Designer.cs | 42 ++++-- AssetStudioGUI/Properties/Settings.settings | 12 +- AssetStudioGUI/app.config | 12 +- AssetStudioUtility/ModelExporter.cs | 5 +- AssetStudioUtility/Properties/AssemblyInfo.cs | 2 +- 13 files changed, 196 insertions(+), 112 deletions(-) diff --git a/AssetStudio/Properties/AssemblyInfo.cs b/AssetStudio/Properties/AssemblyInfo.cs index cd38ea1..3b4181e 100644 --- a/AssetStudio/Properties/AssemblyInfo.cs +++ b/AssetStudio/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AssetStudio")] -[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyCopyright("Copyright © Perfare 2018-2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/AssetStudioFBX/AssemblyInfo.cpp b/AssetStudioFBX/AssemblyInfo.cpp index 8ead0f6..c73d9e4 100644 --- a/AssetStudioFBX/AssemblyInfo.cpp +++ b/AssetStudioFBX/AssemblyInfo.cpp @@ -9,7 +9,7 @@ using namespace System::Security::Permissions; [assembly:AssemblyConfigurationAttribute(L"")]; [assembly:AssemblyCompanyAttribute(L"")]; [assembly:AssemblyProductAttribute(L"AssetStudioFBX")]; -[assembly:AssemblyCopyrightAttribute(L"Copyright © Perfare 2018")]; +[assembly:AssemblyCopyrightAttribute(L"Copyright © Perfare 2018-2019")]; [assembly:AssemblyTrademarkAttribute(L"")]; [assembly:AssemblyCultureAttribute(L"")]; diff --git a/AssetStudioFBX/AssetStudioFBX.h b/AssetStudioFBX/AssetStudioFBX.h index ac9882b..f9ee1ac 100644 --- a/AssetStudioFBX/AssetStudioFBX.h +++ b/AssetStudioFBX/AssetStudioFBX.h @@ -48,7 +48,8 @@ namespace AssetStudio { ref class Exporter { public: - static void Export(String^ name, IImported^ imported, bool eulerFilter, float filterPrecision, bool allFrames, bool allBones, bool skins, float boneSize, float scaleFactor, int versionIndex, bool isAscii); + 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); private: bool exportSkins; @@ -66,7 +67,7 @@ namespace AssetStudio { FbxArray* pTextures; FbxPose* pBindPose; - Exporter(String^ path, IImported^ imported, bool allFrames, bool allBones, bool skins, float boneSize, float scaleFactor, int versionIndex, bool isAscii); + Exporter(String^ name, IImported^ imported, bool allNodes, bool skins, bool castToBone, float boneSize, float scaleFactor, int versionIndex, bool isAscii); ~Exporter(); void Exporter::LinkTexture(ImportedMaterialTexture^ texture, FbxFileTexture* pTexture, FbxProperty& prop); diff --git a/AssetStudioFBX/AssetStudioFBXExporter.cpp b/AssetStudioFBX/AssetStudioFBXExporter.cpp index b364f00..ca0b84b 100644 --- a/AssetStudioFBX/AssetStudioFBXExporter.cpp +++ b/AssetStudioFBX/AssetStudioFBXExporter.cpp @@ -2,7 +2,8 @@ namespace AssetStudio { - void Fbx::Exporter::Export(String^ path, IImported^ imported, bool eulerFilter, float filterPrecision, bool allFrames, bool allBones, bool skins, float boneSize, float scaleFactor, int versionIndex, bool isAscii) + void Fbx::Exporter::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) { FileInfo^ file = gcnew FileInfo(path); DirectoryInfo^ dir = file->Directory; @@ -13,16 +14,22 @@ namespace AssetStudio String^ currentDir = Directory::GetCurrentDirectory(); Directory::SetCurrentDirectory(dir->FullName); auto name = Path::GetFileName(path); - Exporter^ exporter = gcnew Exporter(name, imported, allFrames, allBones, skins, boneSize, scaleFactor, versionIndex, isAscii); - exporter->ExportMorphs(); - exporter->ExportAnimations(eulerFilter, filterPrecision); + Exporter^ exporter = gcnew Exporter(name, imported, allNodes, skins, castToBone, boneSize, scaleFactor, versionIndex, isAscii); + if (blendShape) + { + exporter->ExportMorphs(); + } + if (animation) + { + exporter->ExportAnimations(eulerFilter, filterPrecision); + } exporter->pExporter->Export(exporter->pScene); delete exporter; Directory::SetCurrentDirectory(currentDir); } - Fbx::Exporter::Exporter(String^ name, IImported^ imported, bool allFrames, bool allBones, bool skins, float boneSize, float scaleFactor, int versionIndex, bool isAscii) + Fbx::Exporter::Exporter(String^ name, IImported^ imported, bool allNodes, bool skins, bool castToBone, float boneSize, float scaleFactor, int versionIndex, bool isAscii) { this->imported = imported; exportSkins = skins; @@ -86,7 +93,7 @@ namespace AssetStudio } framePaths = nullptr; - if (!allFrames) + if (!allNodes) { framePaths = SearchHierarchy(); if (!framePaths) @@ -104,7 +111,7 @@ namespace AssetStudio if (imported->MeshList != nullptr) { - SetJointsFromImportedMeshes(allBones); + SetJointsFromImportedMeshes(castToBone); pMaterials = new FbxArray(); pTextures = new FbxArray(); @@ -167,13 +174,13 @@ namespace AssetStudio } } - void Fbx::Exporter::SetJointsNode(ImportedFrame^ frame, HashSet^ bonePaths, bool allBones) + void Fbx::Exporter::SetJointsNode(ImportedFrame^ frame, HashSet^ bonePaths, bool castToBone) { size_t pointer; if (frameToNode->TryGetValue(frame, pointer)) { auto pNode = (FbxNode*)pointer; - if (allBones) + if (castToBone) { FbxSkeleton* pJoint = FbxSkeleton::Create(pScene, ""); pJoint->Size.Set(FbxDouble(boneSize)); @@ -205,7 +212,7 @@ namespace AssetStudio } for (int i = 0; i < frame->Count; i++) { - SetJointsNode(frame[i], bonePaths, allBones); + SetJointsNode(frame[i], bonePaths, castToBone); } } @@ -256,7 +263,7 @@ namespace AssetStudio } } - void Fbx::Exporter::SetJointsFromImportedMeshes(bool allBones) + void Fbx::Exporter::SetJointsFromImportedMeshes(bool castToBone) { if (!exportSkins) { @@ -277,7 +284,7 @@ namespace AssetStudio } } - SetJointsNode(imported->RootFrame, bonePaths, allBones); + SetJointsNode(imported->RootFrame, bonePaths, castToBone); } void Fbx::Exporter::ExportFrame(FbxNode* pParentNode, ImportedFrame^ frame) @@ -780,26 +787,30 @@ namespace AssetStudio ); auto lGeometry = (FbxGeometry*)pNode->GetNodeAttribute(); - FbxBlendShape* lBlendShape = (FbxBlendShape*)lGeometry->GetDeformer(0, FbxDeformer::eBlendShape); - int lBlendShapeChannelCount = lBlendShape->GetBlendShapeChannelCount(); - for (int lChannelIndex = 0; lChannelIndex < lBlendShapeChannelCount; ++lChannelIndex) + int lBlendShapeDeformerCount = lGeometry->GetDeformerCount(FbxDeformer::eBlendShape); + if (lBlendShapeDeformerCount > 0) { - FbxBlendShapeChannel* lChannel = lBlendShape->GetBlendShapeChannel(lChannelIndex); - FbxString lChannelName = lChannel->GetNameOnly(); - if (lChannelName == channelName) + FbxBlendShape* lBlendShape = (FbxBlendShape*)lGeometry->GetDeformer(0, FbxDeformer::eBlendShape); + int lBlendShapeChannelCount = lBlendShape->GetBlendShapeChannelCount(); + for (int lChannelIndex = 0; lChannelIndex < lBlendShapeChannelCount; ++lChannelIndex) { - FbxAnimCurve* lAnimCurve = lGeometry->GetShapeChannel(0, lChannelIndex, lAnimLayer, true); - lAnimCurve->KeyModifyBegin(); - - for each (auto keyframe in keyframeList->BlendShape->Keyframes) + FbxBlendShapeChannel* lChannel = lBlendShape->GetBlendShapeChannel(lChannelIndex); + FbxString lChannelName = lChannel->GetNameOnly(); + if (lChannelName == channelName) { - lTime.SetSecondDouble(keyframe->time); - int lKeyIndex = lAnimCurve->KeyAdd(lTime); - lAnimCurve->KeySetValue(lKeyIndex, keyframe->value); - lAnimCurve->KeySetInterpolation(lKeyIndex, FbxAnimCurveDef::eInterpolationCubic); - } + FbxAnimCurve* lAnimCurve = lGeometry->GetShapeChannel(0, lChannelIndex, lAnimLayer, true); + lAnimCurve->KeyModifyBegin(); - lAnimCurve->KeyModifyEnd(); + for each (auto keyframe in keyframeList->BlendShape->Keyframes) + { + lTime.SetSecondDouble(keyframe->time); + int lKeyIndex = lAnimCurve->KeyAdd(lTime); + lAnimCurve->KeySetValue(lKeyIndex, keyframe->value); + lAnimCurve->KeySetInterpolation(lKeyIndex, FbxAnimCurveDef::eInterpolationCubic); + } + + lAnimCurve->KeyModifyEnd(); + } } } } diff --git a/AssetStudioGUI/ExportOptions.Designer.cs b/AssetStudioGUI/ExportOptions.Designer.cs index 2b7a7be..7035f27 100644 --- a/AssetStudioGUI/ExportOptions.Designer.cs +++ b/AssetStudioGUI/ExportOptions.Designer.cs @@ -38,6 +38,8 @@ this.tobmp = new System.Windows.Forms.RadioButton(); this.converttexture = new System.Windows.Forms.CheckBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.exportBlendShape = new System.Windows.Forms.CheckBox(); + this.exportAnimations = new System.Windows.Forms.CheckBox(); this.scaleFactor = new System.Windows.Forms.NumericUpDown(); this.label5 = new System.Windows.Forms.Label(); this.fbxFormat = new System.Windows.Forms.ComboBox(); @@ -46,11 +48,11 @@ this.label3 = new System.Windows.Forms.Label(); this.boneSize = new System.Windows.Forms.NumericUpDown(); this.label2 = new System.Windows.Forms.Label(); - this.skins = new System.Windows.Forms.CheckBox(); + this.exportSkins = new System.Windows.Forms.CheckBox(); this.label1 = new System.Windows.Forms.Label(); this.filterPrecision = new System.Windows.Forms.NumericUpDown(); - this.allBones = new System.Windows.Forms.CheckBox(); - this.allFrames = new System.Windows.Forms.CheckBox(); + this.castToBone = new System.Windows.Forms.CheckBox(); + this.exportAllNodes = new System.Windows.Forms.CheckBox(); this.eulerFilter = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); this.panel1.SuspendLayout(); @@ -62,7 +64,7 @@ // // OKbutton // - this.OKbutton.Location = new System.Drawing.Point(321, 244); + this.OKbutton.Location = new System.Drawing.Point(321, 293); this.OKbutton.Name = "OKbutton"; this.OKbutton.Size = new System.Drawing.Size(75, 21); this.OKbutton.TabIndex = 6; @@ -73,7 +75,7 @@ // Cancel // this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.Cancel.Location = new System.Drawing.Point(402, 244); + this.Cancel.Location = new System.Drawing.Point(402, 293); this.Cancel.Name = "Cancel"; this.Cancel.Size = new System.Drawing.Size(75, 21); this.Cancel.TabIndex = 7; @@ -163,6 +165,8 @@ // groupBox2 // this.groupBox2.AutoSize = true; + this.groupBox2.Controls.Add(this.exportBlendShape); + this.groupBox2.Controls.Add(this.exportAnimations); this.groupBox2.Controls.Add(this.scaleFactor); this.groupBox2.Controls.Add(this.label5); this.groupBox2.Controls.Add(this.fbxFormat); @@ -171,19 +175,43 @@ this.groupBox2.Controls.Add(this.label3); this.groupBox2.Controls.Add(this.boneSize); this.groupBox2.Controls.Add(this.label2); - this.groupBox2.Controls.Add(this.skins); + this.groupBox2.Controls.Add(this.exportSkins); this.groupBox2.Controls.Add(this.label1); this.groupBox2.Controls.Add(this.filterPrecision); - this.groupBox2.Controls.Add(this.allBones); - this.groupBox2.Controls.Add(this.allFrames); + 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(12, 12); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(214, 255); + this.groupBox2.Size = new System.Drawing.Size(214, 302); this.groupBox2.TabIndex = 11; this.groupBox2.TabStop = false; this.groupBox2.Text = "Fbx"; // + // 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.Name = "exportBlendShape"; + this.exportBlendShape.Size = new System.Drawing.Size(126, 16); + this.exportBlendShape.TabIndex = 22; + this.exportBlendShape.Text = "Export blendshape"; + this.exportBlendShape.UseVisualStyleBackColor = true; + // + // exportAnimations + // + 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.Name = "exportAnimations"; + this.exportAnimations.Size = new System.Drawing.Size(126, 16); + this.exportAnimations.TabIndex = 21; + this.exportAnimations.Text = "Export animations"; + this.exportAnimations.UseVisualStyleBackColor = true; + // // scaleFactor // this.scaleFactor.DecimalPlaces = 2; @@ -192,7 +220,7 @@ 0, 0, 131072}); - this.scaleFactor.Location = new System.Drawing.Point(83, 155); + this.scaleFactor.Location = new System.Drawing.Point(83, 202); this.scaleFactor.Name = "scaleFactor"; this.scaleFactor.Size = new System.Drawing.Size(60, 21); this.scaleFactor.TabIndex = 20; @@ -206,7 +234,7 @@ // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(6, 157); + this.label5.Location = new System.Drawing.Point(6, 204); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(71, 12); this.label5.TabIndex = 19; @@ -219,7 +247,7 @@ this.fbxFormat.Items.AddRange(new object[] { "Binary", "Ascii"}); - this.fbxFormat.Location = new System.Drawing.Point(77, 186); + this.fbxFormat.Location = new System.Drawing.Point(77, 233); this.fbxFormat.Name = "fbxFormat"; this.fbxFormat.Size = new System.Drawing.Size(61, 20); this.fbxFormat.TabIndex = 18; @@ -227,7 +255,7 @@ // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(6, 189); + this.label4.Location = new System.Drawing.Point(6, 236); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(59, 12); this.label4.TabIndex = 17; @@ -244,7 +272,7 @@ "7.3", "7.4", "7.5"}); - this.fbxVersion.Location = new System.Drawing.Point(77, 215); + this.fbxVersion.Location = new System.Drawing.Point(77, 262); this.fbxVersion.Name = "fbxVersion"; this.fbxVersion.Size = new System.Drawing.Size(47, 20); this.fbxVersion.TabIndex = 16; @@ -252,7 +280,7 @@ // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(6, 218); + this.label3.Location = new System.Drawing.Point(6, 265); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(65, 12); this.label3.TabIndex = 15; @@ -260,7 +288,7 @@ // // boneSize // - this.boneSize.Location = new System.Drawing.Point(65, 128); + this.boneSize.Location = new System.Drawing.Point(65, 175); this.boneSize.Name = "boneSize"; this.boneSize.Size = new System.Drawing.Size(46, 21); this.boneSize.TabIndex = 11; @@ -273,23 +301,23 @@ // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(6, 130); + this.label2.Location = new System.Drawing.Point(6, 177); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(53, 12); this.label2.TabIndex = 10; this.label2.Text = "BoneSize"; // - // skins + // exportSkins // - this.skins.AutoSize = true; - this.skins.Checked = true; - this.skins.CheckState = System.Windows.Forms.CheckState.Checked; - this.skins.Location = new System.Drawing.Point(6, 105); - this.skins.Name = "skins"; - this.skins.Size = new System.Drawing.Size(54, 16); - this.skins.TabIndex = 8; - this.skins.Text = "Skins"; - this.skins.UseVisualStyleBackColor = true; + 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.Name = "exportSkins"; + this.exportSkins.Size = new System.Drawing.Size(96, 16); + this.exportSkins.TabIndex = 8; + this.exportSkins.Text = "Export skins"; + this.exportSkins.UseVisualStyleBackColor = true; // // label1 // @@ -318,29 +346,27 @@ 0, 131072}); // - // allBones + // castToBone // - this.allBones.AutoSize = true; - this.allBones.Checked = true; - this.allBones.CheckState = System.Windows.Forms.CheckState.Checked; - this.allBones.Location = new System.Drawing.Point(6, 83); - this.allBones.Name = "allBones"; - this.allBones.Size = new System.Drawing.Size(72, 16); - this.allBones.TabIndex = 5; - this.allBones.Text = "AllBones"; - this.allBones.UseVisualStyleBackColor = true; + this.castToBone.AutoSize = true; + this.castToBone.Location = new System.Drawing.Point(6, 149); + this.castToBone.Name = "castToBone"; + this.castToBone.Size = new System.Drawing.Size(156, 16); + this.castToBone.TabIndex = 5; + this.castToBone.Text = "All nodes cast to bone"; + this.castToBone.UseVisualStyleBackColor = true; // - // allFrames + // exportAllNodes // - this.allFrames.AutoSize = true; - this.allFrames.Checked = true; - this.allFrames.CheckState = System.Windows.Forms.CheckState.Checked; - this.allFrames.Location = new System.Drawing.Point(6, 61); - this.allFrames.Name = "allFrames"; - this.allFrames.Size = new System.Drawing.Size(78, 16); - this.allFrames.TabIndex = 4; - this.allFrames.Text = "AllFrames"; - this.allFrames.UseVisualStyleBackColor = true; + 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.Name = "exportAllNodes"; + this.exportAllNodes.Size = new System.Drawing.Size(120, 16); + this.exportAllNodes.TabIndex = 4; + this.exportAllNodes.Text = "Export all nodes"; + this.exportAllNodes.UseVisualStyleBackColor = true; // // eulerFilter // @@ -360,7 +386,7 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.Cancel; - this.ClientSize = new System.Drawing.Size(490, 277); + this.ClientSize = new System.Drawing.Size(490, 328); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.Cancel); @@ -400,11 +426,11 @@ private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.NumericUpDown boneSize; private System.Windows.Forms.Label label2; - private System.Windows.Forms.CheckBox skins; + private System.Windows.Forms.CheckBox exportSkins; private System.Windows.Forms.Label label1; private System.Windows.Forms.NumericUpDown filterPrecision; - private System.Windows.Forms.CheckBox allBones; - private System.Windows.Forms.CheckBox allFrames; + private System.Windows.Forms.CheckBox castToBone; + private System.Windows.Forms.CheckBox exportAllNodes; private System.Windows.Forms.CheckBox eulerFilter; private System.Windows.Forms.Label label3; private System.Windows.Forms.ComboBox fbxVersion; @@ -412,5 +438,7 @@ private System.Windows.Forms.Label label4; private System.Windows.Forms.NumericUpDown scaleFactor; private System.Windows.Forms.Label label5; + private System.Windows.Forms.CheckBox exportBlendShape; + private System.Windows.Forms.CheckBox exportAnimations; } } \ No newline at end of file diff --git a/AssetStudioGUI/ExportOptions.cs b/AssetStudioGUI/ExportOptions.cs index 03d8742..f284c56 100644 --- a/AssetStudioGUI/ExportOptions.cs +++ b/AssetStudioGUI/ExportOptions.cs @@ -28,9 +28,11 @@ namespace AssetStudioGUI } eulerFilter.Checked = (bool)Properties.Settings.Default["eulerFilter"]; filterPrecision.Value = (decimal)Properties.Settings.Default["filterPrecision"]; - allFrames.Checked = (bool)Properties.Settings.Default["allFrames"]; - allBones.Checked = (bool)Properties.Settings.Default["allBones"]; - skins.Checked = (bool)Properties.Settings.Default["skins"]; + exportAllNodes.Checked = (bool)Properties.Settings.Default["exportAllNodes"]; + exportSkins.Checked = (bool)Properties.Settings.Default["exportSkins"]; + exportAnimations.Checked = (bool)Properties.Settings.Default["exportAnimations"]; + exportBlendShape.Checked = (bool)Properties.Settings.Default["exportBlendShape"]; + castToBone.Checked = (bool)Properties.Settings.Default["castToBone"]; boneSize.Value = (decimal)Properties.Settings.Default["boneSize"]; scaleFactor.Value = (decimal)Properties.Settings.Default["scaleFactor"]; fbxVersion.SelectedIndex = (int)Properties.Settings.Default["fbxVersion"]; @@ -57,9 +59,11 @@ namespace AssetStudioGUI } Properties.Settings.Default["eulerFilter"] = eulerFilter.Checked; Properties.Settings.Default["filterPrecision"] = filterPrecision.Value; - Properties.Settings.Default["allFrames"] = allFrames.Checked; - Properties.Settings.Default["allBones"] = allBones.Checked; - Properties.Settings.Default["skins"] = skins.Checked; + Properties.Settings.Default["exportAllNodes"] = exportAllNodes.Checked; + Properties.Settings.Default["exportSkins"] = exportSkins.Checked; + Properties.Settings.Default["exportAnimations"] = exportAnimations.Checked; + Properties.Settings.Default["exportBlendShape"] = exportBlendShape.Checked; + Properties.Settings.Default["castToBone"] = castToBone.Checked; Properties.Settings.Default["boneSize"] = boneSize.Value; Properties.Settings.Default["scaleFactor"] = scaleFactor.Value; Properties.Settings.Default["fbxVersion"] = fbxVersion.SelectedIndex; diff --git a/AssetStudioGUI/Exporter.cs b/AssetStudioGUI/Exporter.cs index a308686..feec4c9 100644 --- a/AssetStudioGUI/Exporter.cs +++ b/AssetStudioGUI/Exporter.cs @@ -322,14 +322,17 @@ namespace AssetStudioGUI { var eulerFilter = (bool)Properties.Settings.Default["eulerFilter"]; var filterPrecision = (float)(decimal)Properties.Settings.Default["filterPrecision"]; - var allFrames = (bool)Properties.Settings.Default["allFrames"]; - var allBones = (bool)Properties.Settings.Default["allBones"]; - var skins = (bool)Properties.Settings.Default["skins"]; + var exportAllNodes = (bool)Properties.Settings.Default["exportAllNodes"]; + var exportSkins = (bool)Properties.Settings.Default["exportSkins"]; + var exportAnimations = (bool)Properties.Settings.Default["exportAnimations"]; + var exportBlendShape = (bool)Properties.Settings.Default["exportBlendShape"]; + var castToBone = (bool)Properties.Settings.Default["castToBone"]; var boneSize = (int)(decimal)Properties.Settings.Default["boneSize"]; var scaleFactor = (float)(decimal)Properties.Settings.Default["scaleFactor"]; var fbxVersion = (int)Properties.Settings.Default["fbxVersion"]; var fbxFormat = (int)Properties.Settings.Default["fbxFormat"]; - ModelExporter.ExportFbx(exportPath, convert, eulerFilter, filterPrecision, allFrames, allBones, skins, boneSize, scaleFactor, fbxVersion, fbxFormat == 1); + ModelExporter.ExportFbx(exportPath, convert, eulerFilter, filterPrecision, + exportAllNodes, exportSkins, exportAnimations, exportBlendShape, castToBone, boneSize, scaleFactor, fbxVersion, fbxFormat == 1); } } } diff --git a/AssetStudioGUI/Properties/AssemblyInfo.cs b/AssetStudioGUI/Properties/AssemblyInfo.cs index 0fb7449..7612b63 100644 --- a/AssetStudioGUI/Properties/AssemblyInfo.cs +++ b/AssetStudioGUI/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AssetStudioGUI")] -[assembly: AssemblyCopyright("")] +[assembly: AssemblyCopyright("Copyright © Perfare 2018-2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/AssetStudioGUI/Properties/Settings.Designer.cs b/AssetStudioGUI/Properties/Settings.Designer.cs index a02cf19..20815b2 100644 --- a/AssetStudioGUI/Properties/Settings.Designer.cs +++ b/AssetStudioGUI/Properties/Settings.Designer.cs @@ -158,36 +158,36 @@ namespace AssetStudioGUI.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool allFrames { + public bool exportAllNodes { get { - return ((bool)(this["allFrames"])); + return ((bool)(this["exportAllNodes"])); } set { - this["allFrames"] = value; + this["exportAllNodes"] = value; } } [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool allBones { + public bool exportSkins { get { - return ((bool)(this["allBones"])); + return ((bool)(this["exportSkins"])); } set { - this["allBones"] = value; + this["exportSkins"] = value; } } [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool skins { + public bool exportAnimations { get { - return ((bool)(this["skins"])); + return ((bool)(this["exportAnimations"])); } set { - this["skins"] = value; + this["exportAnimations"] = value; } } @@ -238,5 +238,29 @@ namespace AssetStudioGUI.Properties { this["scaleFactor"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool exportBlendShape { + get { + return ((bool)(this["exportBlendShape"])); + } + set { + this["exportBlendShape"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool castToBone { + get { + return ((bool)(this["castToBone"])); + } + set { + this["castToBone"] = value; + } + } } } diff --git a/AssetStudioGUI/Properties/Settings.settings b/AssetStudioGUI/Properties/Settings.settings index a32ed14..8f767fa 100644 --- a/AssetStudioGUI/Properties/Settings.settings +++ b/AssetStudioGUI/Properties/Settings.settings @@ -35,13 +35,13 @@ 0.25 - + True - + True - + True @@ -56,5 +56,11 @@ 1 + + True + + + False + \ No newline at end of file diff --git a/AssetStudioGUI/app.config b/AssetStudioGUI/app.config index 245f5b0..dd0cd05 100644 --- a/AssetStudioGUI/app.config +++ b/AssetStudioGUI/app.config @@ -40,13 +40,13 @@ 0.25 - + True - + True - + True @@ -61,6 +61,12 @@ 1 + + True + + + False + \ No newline at end of file diff --git a/AssetStudioUtility/ModelExporter.cs b/AssetStudioUtility/ModelExporter.cs index 41b8e17..87bb42b 100644 --- a/AssetStudioUtility/ModelExporter.cs +++ b/AssetStudioUtility/ModelExporter.cs @@ -2,9 +2,10 @@ { public static class ModelExporter { - public static void ExportFbx(string path, IImported imported, bool eulerFilter, float filterPrecision, bool allFrames, bool allBones, bool skins, float boneSize, float scaleFactor, int versionIndex, bool isAscii) + 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) { - Fbx.Exporter.Export(path, imported, eulerFilter, filterPrecision, allFrames, allBones, skins, boneSize, scaleFactor, versionIndex, isAscii); + Fbx.Exporter.Export(path, imported, eulerFilter, filterPrecision, allNodes, skins, animation, blendShape, castToBone, boneSize, scaleFactor, versionIndex, isAscii); } } } diff --git a/AssetStudioUtility/Properties/AssemblyInfo.cs b/AssetStudioUtility/Properties/AssemblyInfo.cs index 550d649..77a1d3b 100644 --- a/AssetStudioUtility/Properties/AssemblyInfo.cs +++ b/AssetStudioUtility/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AssetStudioTools")] -[assembly: AssemblyCopyright("Copyright © Perfare 2018")] +[assembly: AssemblyCopyright("Copyright © Perfare 2018-2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]