Add scaleFactor option

This commit is contained in:
Perfare 2018-11-13 01:07:24 +08:00
parent 798a63e33c
commit e7c5976f7c
8 changed files with 107 additions and 49 deletions

View File

@ -38,6 +38,8 @@
this.tobmp = new System.Windows.Forms.RadioButton(); this.tobmp = new System.Windows.Forms.RadioButton();
this.converttexture = new System.Windows.Forms.CheckBox(); this.converttexture = new System.Windows.Forms.CheckBox();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.scaleFactor = new System.Windows.Forms.NumericUpDown();
this.label5 = new System.Windows.Forms.Label();
this.fbxFormat = new System.Windows.Forms.ComboBox(); this.fbxFormat = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.fbxVersion = new System.Windows.Forms.ComboBox(); this.fbxVersion = new System.Windows.Forms.ComboBox();
@ -50,17 +52,18 @@
this.filterPrecision = new System.Windows.Forms.NumericUpDown(); this.filterPrecision = new System.Windows.Forms.NumericUpDown();
this.allBones = new System.Windows.Forms.CheckBox(); this.allBones = new System.Windows.Forms.CheckBox();
this.allFrames = new System.Windows.Forms.CheckBox(); this.allFrames = new System.Windows.Forms.CheckBox();
this.EulerFilter = new System.Windows.Forms.CheckBox(); this.eulerFilter = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.scaleFactor)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.boneSize)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.boneSize)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.filterPrecision)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.filterPrecision)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// OKbutton // OKbutton
// //
this.OKbutton.Location = new System.Drawing.Point(321, 240); this.OKbutton.Location = new System.Drawing.Point(321, 267);
this.OKbutton.Name = "OKbutton"; this.OKbutton.Name = "OKbutton";
this.OKbutton.Size = new System.Drawing.Size(75, 21); this.OKbutton.Size = new System.Drawing.Size(75, 21);
this.OKbutton.TabIndex = 6; this.OKbutton.TabIndex = 6;
@ -71,7 +74,7 @@
// Cancel // Cancel
// //
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Cancel.Location = new System.Drawing.Point(402, 240); this.Cancel.Location = new System.Drawing.Point(402, 267);
this.Cancel.Name = "Cancel"; this.Cancel.Name = "Cancel";
this.Cancel.Size = new System.Drawing.Size(75, 21); this.Cancel.Size = new System.Drawing.Size(75, 21);
this.Cancel.TabIndex = 7; this.Cancel.TabIndex = 7;
@ -161,6 +164,8 @@
// groupBox2 // groupBox2
// //
this.groupBox2.AutoSize = true; this.groupBox2.AutoSize = true;
this.groupBox2.Controls.Add(this.scaleFactor);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.fbxFormat); this.groupBox2.Controls.Add(this.fbxFormat);
this.groupBox2.Controls.Add(this.label4); this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.fbxVersion); this.groupBox2.Controls.Add(this.fbxVersion);
@ -173,14 +178,42 @@
this.groupBox2.Controls.Add(this.filterPrecision); this.groupBox2.Controls.Add(this.filterPrecision);
this.groupBox2.Controls.Add(this.allBones); this.groupBox2.Controls.Add(this.allBones);
this.groupBox2.Controls.Add(this.allFrames); this.groupBox2.Controls.Add(this.allFrames);
this.groupBox2.Controls.Add(this.EulerFilter); this.groupBox2.Controls.Add(this.eulerFilter);
this.groupBox2.Location = new System.Drawing.Point(12, 12); this.groupBox2.Location = new System.Drawing.Point(12, 12);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(214, 249); this.groupBox2.Size = new System.Drawing.Size(214, 276);
this.groupBox2.TabIndex = 11; this.groupBox2.TabIndex = 11;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "Fbx"; this.groupBox2.Text = "Fbx";
// //
// scaleFactor
//
this.scaleFactor.DecimalPlaces = 2;
this.scaleFactor.Increment = new decimal(new int[] {
1,
0,
0,
131072});
this.scaleFactor.Location = new System.Drawing.Point(83, 155);
this.scaleFactor.Name = "scaleFactor";
this.scaleFactor.Size = new System.Drawing.Size(60, 21);
this.scaleFactor.TabIndex = 20;
this.scaleFactor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.scaleFactor.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(6, 157);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(71, 12);
this.label5.TabIndex = 19;
this.label5.Text = "ScaleFactor";
//
// fbxFormat // fbxFormat
// //
this.fbxFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.fbxFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@ -188,7 +221,7 @@
this.fbxFormat.Items.AddRange(new object[] { this.fbxFormat.Items.AddRange(new object[] {
"Binary", "Binary",
"Ascii"}); "Ascii"});
this.fbxFormat.Location = new System.Drawing.Point(75, 180); this.fbxFormat.Location = new System.Drawing.Point(75, 207);
this.fbxFormat.Name = "fbxFormat"; this.fbxFormat.Name = "fbxFormat";
this.fbxFormat.Size = new System.Drawing.Size(61, 20); this.fbxFormat.Size = new System.Drawing.Size(61, 20);
this.fbxFormat.TabIndex = 18; this.fbxFormat.TabIndex = 18;
@ -196,7 +229,7 @@
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(4, 183); this.label4.Location = new System.Drawing.Point(4, 210);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(59, 12); this.label4.Size = new System.Drawing.Size(59, 12);
this.label4.TabIndex = 17; this.label4.TabIndex = 17;
@ -213,7 +246,7 @@
"7.3", "7.3",
"7.4", "7.4",
"7.5"}); "7.5"});
this.fbxVersion.Location = new System.Drawing.Point(75, 209); this.fbxVersion.Location = new System.Drawing.Point(75, 236);
this.fbxVersion.Name = "fbxVersion"; this.fbxVersion.Name = "fbxVersion";
this.fbxVersion.Size = new System.Drawing.Size(47, 20); this.fbxVersion.Size = new System.Drawing.Size(47, 20);
this.fbxVersion.TabIndex = 16; this.fbxVersion.TabIndex = 16;
@ -221,7 +254,7 @@
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(4, 212); this.label3.Location = new System.Drawing.Point(4, 239);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 12); this.label3.Size = new System.Drawing.Size(65, 12);
this.label3.TabIndex = 15; this.label3.TabIndex = 15;
@ -230,7 +263,7 @@
// flatInbetween // flatInbetween
// //
this.flatInbetween.AutoSize = true; this.flatInbetween.AutoSize = true;
this.flatInbetween.Location = new System.Drawing.Point(6, 155); this.flatInbetween.Location = new System.Drawing.Point(6, 182);
this.flatInbetween.Name = "flatInbetween"; this.flatInbetween.Name = "flatInbetween";
this.flatInbetween.Size = new System.Drawing.Size(102, 16); this.flatInbetween.Size = new System.Drawing.Size(102, 16);
this.flatInbetween.TabIndex = 12; this.flatInbetween.TabIndex = 12;
@ -319,17 +352,17 @@
this.allFrames.Text = "AllFrames"; this.allFrames.Text = "AllFrames";
this.allFrames.UseVisualStyleBackColor = true; this.allFrames.UseVisualStyleBackColor = true;
// //
// EulerFilter // eulerFilter
// //
this.EulerFilter.AutoSize = true; this.eulerFilter.AutoSize = true;
this.EulerFilter.Checked = true; this.eulerFilter.Checked = true;
this.EulerFilter.CheckState = System.Windows.Forms.CheckState.Checked; 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, 20);
this.EulerFilter.Name = "EulerFilter"; this.eulerFilter.Name = "eulerFilter";
this.EulerFilter.Size = new System.Drawing.Size(90, 16); this.eulerFilter.Size = new System.Drawing.Size(90, 16);
this.EulerFilter.TabIndex = 3; this.eulerFilter.TabIndex = 3;
this.EulerFilter.Text = "EulerFilter"; this.eulerFilter.Text = "EulerFilter";
this.EulerFilter.UseVisualStyleBackColor = true; this.eulerFilter.UseVisualStyleBackColor = true;
// //
// ExportOptions // ExportOptions
// //
@ -337,7 +370,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.Cancel; this.CancelButton = this.Cancel;
this.ClientSize = new System.Drawing.Size(490, 275); this.ClientSize = new System.Drawing.Size(490, 301);
this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Controls.Add(this.Cancel); this.Controls.Add(this.Cancel);
@ -356,6 +389,7 @@
this.panel1.PerformLayout(); this.panel1.PerformLayout();
this.groupBox2.ResumeLayout(false); this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout(); this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.scaleFactor)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.boneSize)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.boneSize)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.filterPrecision)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.filterPrecision)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
@ -382,10 +416,12 @@
private System.Windows.Forms.NumericUpDown filterPrecision; private System.Windows.Forms.NumericUpDown filterPrecision;
private System.Windows.Forms.CheckBox allBones; private System.Windows.Forms.CheckBox allBones;
private System.Windows.Forms.CheckBox allFrames; private System.Windows.Forms.CheckBox allFrames;
private System.Windows.Forms.CheckBox EulerFilter; private System.Windows.Forms.CheckBox eulerFilter;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox fbxVersion; private System.Windows.Forms.ComboBox fbxVersion;
private System.Windows.Forms.ComboBox fbxFormat; private System.Windows.Forms.ComboBox fbxFormat;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.NumericUpDown scaleFactor;
private System.Windows.Forms.Label label5;
} }
} }

View File

@ -26,12 +26,13 @@ namespace AssetStudio
break; break;
} }
} }
EulerFilter.Checked = (bool)Properties.Settings.Default["EulerFilter"]; eulerFilter.Checked = (bool)Properties.Settings.Default["eulerFilter"];
filterPrecision.Value = (decimal)Properties.Settings.Default["filterPrecision"]; filterPrecision.Value = (decimal)Properties.Settings.Default["filterPrecision"];
allFrames.Checked = (bool)Properties.Settings.Default["allFrames"]; allFrames.Checked = (bool)Properties.Settings.Default["allFrames"];
allBones.Checked = (bool)Properties.Settings.Default["allBones"]; allBones.Checked = (bool)Properties.Settings.Default["allBones"];
skins.Checked = (bool)Properties.Settings.Default["skins"]; skins.Checked = (bool)Properties.Settings.Default["skins"];
boneSize.Value = (decimal)Properties.Settings.Default["boneSize"]; boneSize.Value = (decimal)Properties.Settings.Default["boneSize"];
scaleFactor.Value = (decimal)Properties.Settings.Default["scaleFactor"];
flatInbetween.Checked = (bool)Properties.Settings.Default["flatInbetween"]; flatInbetween.Checked = (bool)Properties.Settings.Default["flatInbetween"];
fbxVersion.SelectedIndex = (int)Properties.Settings.Default["fbxVersion"]; fbxVersion.SelectedIndex = (int)Properties.Settings.Default["fbxVersion"];
fbxFormat.SelectedIndex = (int)Properties.Settings.Default["fbxFormat"]; fbxFormat.SelectedIndex = (int)Properties.Settings.Default["fbxFormat"];
@ -55,12 +56,13 @@ namespace AssetStudio
break; break;
} }
} }
Properties.Settings.Default["EulerFilter"] = EulerFilter.Checked; Properties.Settings.Default["eulerFilter"] = eulerFilter.Checked;
Properties.Settings.Default["filterPrecision"] = filterPrecision.Value; Properties.Settings.Default["filterPrecision"] = filterPrecision.Value;
Properties.Settings.Default["allFrames"] = allFrames.Checked; Properties.Settings.Default["allFrames"] = allFrames.Checked;
Properties.Settings.Default["allBones"] = allBones.Checked; Properties.Settings.Default["allBones"] = allBones.Checked;
Properties.Settings.Default["skins"] = skins.Checked; Properties.Settings.Default["skins"] = skins.Checked;
Properties.Settings.Default["boneSize"] = boneSize.Value; Properties.Settings.Default["boneSize"] = boneSize.Value;
Properties.Settings.Default["scaleFactor"] = scaleFactor.Value;
Properties.Settings.Default["flatInbetween"] = flatInbetween.Checked; Properties.Settings.Default["flatInbetween"] = flatInbetween.Checked;
Properties.Settings.Default["fbxVersion"] = fbxVersion.SelectedIndex; Properties.Settings.Default["fbxVersion"] = fbxVersion.SelectedIndex;
Properties.Settings.Default["fbxFormat"] = fbxFormat.SelectedIndex; Properties.Settings.Default["fbxFormat"] = fbxFormat.SelectedIndex;

View File

@ -134,12 +134,12 @@ namespace AssetStudio.Properties {
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")] [global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool EulerFilter { public bool eulerFilter {
get { get {
return ((bool)(this["EulerFilter"])); return ((bool)(this["eulerFilter"]));
} }
set { set {
this["EulerFilter"] = value; this["eulerFilter"] = value;
} }
} }
@ -238,5 +238,17 @@ namespace AssetStudio.Properties {
this["fbxFormat"] = value; this["fbxFormat"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("1")]
public decimal scaleFactor {
get {
return ((decimal)(this["scaleFactor"]));
}
set {
this["scaleFactor"] = value;
}
}
} }
} }

View File

@ -29,7 +29,7 @@
<Setting Name="displayOriginalName" Type="System.Boolean" Scope="User"> <Setting Name="displayOriginalName" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value> <Value Profile="(Default)">False</Value>
</Setting> </Setting>
<Setting Name="EulerFilter" Type="System.Boolean" Scope="User"> <Setting Name="eulerFilter" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value> <Value Profile="(Default)">True</Value>
</Setting> </Setting>
<Setting Name="filterPrecision" Type="System.Decimal" Scope="User"> <Setting Name="filterPrecision" Type="System.Decimal" Scope="User">
@ -56,5 +56,8 @@
<Setting Name="fbxFormat" Type="System.Int32" Scope="User"> <Setting Name="fbxFormat" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value> <Value Profile="(Default)">0</Value>
</Setting> </Setting>
<Setting Name="scaleFactor" Type="System.Decimal" Scope="User">
<Value Profile="(Default)">1</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -308,16 +308,17 @@ namespace AssetStudio
private static bool ModelConverter(ModelConverter convert, string exportPath) private static bool ModelConverter(ModelConverter convert, string exportPath)
{ {
var EulerFilter = (bool)Properties.Settings.Default["EulerFilter"]; var eulerFilter = (bool)Properties.Settings.Default["eulerFilter"];
var filterPrecision = (float)(decimal)Properties.Settings.Default["filterPrecision"]; var filterPrecision = (float)(decimal)Properties.Settings.Default["filterPrecision"];
var allFrames = (bool)Properties.Settings.Default["allFrames"]; var allFrames = (bool)Properties.Settings.Default["allFrames"];
var allBones = (bool)Properties.Settings.Default["allBones"]; var allBones = (bool)Properties.Settings.Default["allBones"];
var skins = (bool)Properties.Settings.Default["skins"]; var skins = (bool)Properties.Settings.Default["skins"];
var boneSize = (int)(decimal)Properties.Settings.Default["boneSize"]; var boneSize = (int)(decimal)Properties.Settings.Default["boneSize"];
var scaleFactor = (float)(decimal)Properties.Settings.Default["scaleFactor"];
var flatInbetween = (bool)Properties.Settings.Default["flatInbetween"]; var flatInbetween = (bool)Properties.Settings.Default["flatInbetween"];
var fbxVersion = (int)Properties.Settings.Default["fbxVersion"]; var fbxVersion = (int)Properties.Settings.Default["fbxVersion"];
var fbxFormat = (int)Properties.Settings.Default["fbxFormat"]; var fbxFormat = (int)Properties.Settings.Default["fbxFormat"];
Fbx.Exporter.Export(exportPath, convert, EulerFilter, filterPrecision, allFrames, allBones, skins, boneSize, flatInbetween, fbxVersion, fbxFormat == 1); Fbx.Exporter.Export(exportPath, convert, eulerFilter, filterPrecision, allFrames, allBones, skins, boneSize, scaleFactor, flatInbetween, fbxVersion, fbxFormat == 1);
return true; return true;
} }
} }

View File

@ -34,7 +34,7 @@
<setting name="displayOriginalName" serializeAs="String"> <setting name="displayOriginalName" serializeAs="String">
<value>False</value> <value>False</value>
</setting> </setting>
<setting name="EulerFilter" serializeAs="String"> <setting name="eulerFilter" serializeAs="String">
<value>True</value> <value>True</value>
</setting> </setting>
<setting name="filterPrecision" serializeAs="String"> <setting name="filterPrecision" serializeAs="String">
@ -61,6 +61,9 @@
<setting name="fbxFormat" serializeAs="String"> <setting name="fbxFormat" serializeAs="String">
<value>0</value> <value>0</value>
</setting> </setting>
<setting name="scaleFactor" serializeAs="String">
<value>1</value>
</setting>
</AssetStudio.Properties.Settings> </AssetStudio.Properties.Settings>
</userSettings> </userSettings>
</configuration> </configuration>

View File

@ -48,8 +48,8 @@ namespace AssetStudio {
ref class Exporter ref class Exporter
{ {
public: public:
static void Export(String^ path, IImported^ imported, bool EulerFilter, float filterPrecision, bool allFrames, bool allBones, bool skins, float boneSize, bool flatInbetween, int versionIndex, bool isAscii); static void Export(String^ path, IImported^ imported, bool eulerFilter, float filterPrecision, bool allFrames, bool allBones, bool skins, float boneSize, float scaleFactor, bool flatInbetween, int versionIndex, bool isAscii);
static void ExportMorph(String^ path, IImported^ imported, bool morphMask, bool flatInbetween, bool skins, float boneSize, int versionIndex, bool isAscii); static void ExportMorph(String^ path, IImported^ imported, bool morphMask, bool flatInbetween, bool skins, float boneSize, float scaleFactor, int versionIndex, bool isAscii);
private: private:
HashSet<String^>^ frameNames; HashSet<String^>^ frameNames;
@ -66,7 +66,7 @@ namespace AssetStudio {
FbxArray<FbxFileTexture*>* pTextures; FbxArray<FbxFileTexture*>* pTextures;
FbxArray<FbxNode*>* pMeshNodes; FbxArray<FbxNode*>* pMeshNodes;
Exporter(String^ path, IImported^ imported, bool allFrames, bool allBones, bool skins, float boneSize, int versionIndex, bool isAscii, bool normals); Exporter(String^ path, IImported^ imported, bool allFrames, bool allBones, bool skins, float boneSize, float scaleFactor, int versionIndex, bool isAscii, bool normals);
~Exporter(); ~Exporter();
void Exporter::LinkTexture(ImportedMaterial^ mat, int attIndex, FbxFileTexture* pTexture, FbxProperty& prop); void Exporter::LinkTexture(ImportedMaterial^ mat, int attIndex, FbxFileTexture* pTexture, FbxProperty& prop);
@ -77,8 +77,8 @@ namespace AssetStudio {
void ExportFrame(FbxNode* pParentNode, ImportedFrame^ frame); void ExportFrame(FbxNode* pParentNode, ImportedFrame^ frame);
void ExportMesh(FbxNode* pFrameNode, ImportedMesh^ meshList, bool normals); void ExportMesh(FbxNode* pFrameNode, ImportedMesh^ meshList, bool normals);
FbxFileTexture* ExportTexture(ImportedTexture^ matTex, FbxMesh* pMesh); FbxFileTexture* ExportTexture(ImportedTexture^ matTex, FbxMesh* pMesh);
void ExportAnimations(bool EulerFilter, float filterValue, bool flatInbetween); void ExportAnimations(bool eulerFilter, float filterValue, bool flatInbetween);
void ExportKeyframedAnimation(ImportedKeyframedAnimation^ parser, FbxString& kTakeName, FbxAnimCurveFilterUnroll* EulerFilter, float filterPrecision, bool flatInbetween); void ExportKeyframedAnimation(ImportedKeyframedAnimation^ parser, FbxString& kTakeName, FbxAnimCurveFilterUnroll* eulerFilter, float filterPrecision, bool flatInbetween);
void ExportMorphs(IImported^ imported, bool morphMask, bool flatInbetween); void ExportMorphs(IImported^ imported, bool morphMask, bool flatInbetween);
}; };
}; };

View File

@ -4,7 +4,7 @@
namespace AssetStudio namespace AssetStudio
{ {
void Fbx::Exporter::Export(String^ path, IImported^ imported, bool EulerFilter, float filterPrecision, bool allFrames, bool allBones, bool skins, float boneSize, bool flatInbetween, int versionIndex, bool isAscii) void Fbx::Exporter::Export(String^ path, IImported^ imported, bool eulerFilter, float filterPrecision, bool allFrames, bool allBones, bool skins, float boneSize, float scaleFactor, bool flatInbetween, int versionIndex, bool isAscii)
{ {
FileInfo^ file = gcnew FileInfo(path); FileInfo^ file = gcnew FileInfo(path);
DirectoryInfo^ dir = file->Directory; DirectoryInfo^ dir = file->Directory;
@ -16,16 +16,16 @@ namespace AssetStudio
Directory::SetCurrentDirectory(dir->FullName); Directory::SetCurrentDirectory(dir->FullName);
path = Path::GetFileName(path); path = Path::GetFileName(path);
Exporter^ exporter = gcnew Exporter(path, imported, allFrames, allBones, skins, boneSize, versionIndex, isAscii, true); Exporter^ exporter = gcnew Exporter(path, imported, allFrames, allBones, skins, boneSize, scaleFactor, versionIndex, isAscii, true);
exporter->ExportMorphs(imported, false, flatInbetween); exporter->ExportMorphs(imported, false, flatInbetween);
exporter->ExportAnimations(EulerFilter, filterPrecision, flatInbetween); exporter->ExportAnimations(eulerFilter, filterPrecision, flatInbetween);
exporter->pExporter->Export(exporter->pScene); exporter->pExporter->Export(exporter->pScene);
delete exporter; delete exporter;
Directory::SetCurrentDirectory(currentDir); Directory::SetCurrentDirectory(currentDir);
} }
void Fbx::Exporter::ExportMorph(String^ path, IImported^ imported, bool morphMask, bool flatInbetween, bool skins, float boneSize, int versionIndex, bool isAscii) void Fbx::Exporter::ExportMorph(String^ path, IImported^ imported, bool morphMask, bool flatInbetween, bool skins, float boneSize, float scaleFactor, int versionIndex, bool isAscii)
{ {
FileInfo^ file = gcnew FileInfo(path); FileInfo^ file = gcnew FileInfo(path);
DirectoryInfo^ dir = file->Directory; DirectoryInfo^ dir = file->Directory;
@ -37,7 +37,7 @@ namespace AssetStudio
Directory::SetCurrentDirectory(dir->FullName); Directory::SetCurrentDirectory(dir->FullName);
path = Path::GetFileName(path); path = Path::GetFileName(path);
Exporter^ exporter = gcnew Exporter(path, imported, false, true, skins, boneSize, versionIndex, isAscii, false); Exporter^ exporter = gcnew Exporter(path, imported, false, true, skins, boneSize, scaleFactor, versionIndex, isAscii, false);
exporter->ExportMorphs(imported, morphMask, flatInbetween); exporter->ExportMorphs(imported, morphMask, flatInbetween);
exporter->pExporter->Export(exporter->pScene); exporter->pExporter->Export(exporter->pScene);
delete exporter; delete exporter;
@ -45,7 +45,7 @@ namespace AssetStudio
Directory::SetCurrentDirectory(currentDir); Directory::SetCurrentDirectory(currentDir);
} }
Fbx::Exporter::Exporter(String^ path, IImported^ imported, bool allFrames, bool allBones, bool skins, float boneSize, int versionIndex, bool isAscii, bool normals) Fbx::Exporter::Exporter(String^ path, IImported^ imported, bool allFrames, bool allBones, bool skins, float boneSize, float scaleFactor, int versionIndex, bool isAscii, bool normals)
{ {
this->imported = imported; this->imported = imported;
exportSkins = skins; exportSkins = skins;
@ -72,6 +72,7 @@ namespace AssetStudio
IOS_REF.SetBoolProp(EXP_FBX_GLOBAL_SETTINGS, true); IOS_REF.SetBoolProp(EXP_FBX_GLOBAL_SETTINGS, true);
FbxGlobalSettings& globalSettings = pScene->GetGlobalSettings(); FbxGlobalSettings& globalSettings = pScene->GetGlobalSettings();
globalSettings.SetSystemUnit(FbxSystemUnit(scaleFactor));
cDest = StringToCharArray(path); cDest = StringToCharArray(path);
pExporter = FbxExporter::Create(pScene, ""); pExporter = FbxExporter::Create(pScene, "");
@ -707,7 +708,7 @@ namespace AssetStudio
prop.ConnectSrcObject(pTexture); prop.ConnectSrcObject(pTexture);
} }
void Fbx::Exporter::ExportAnimations(bool EulerFilter, float filterPrecision, bool flatInbetween) void Fbx::Exporter::ExportAnimations(bool eulerFilter, float filterPrecision, bool flatInbetween)
{ {
auto importedAnimationList = imported->AnimationList; auto importedAnimationList = imported->AnimationList;
if (importedAnimationList == nullptr) if (importedAnimationList == nullptr)
@ -715,7 +716,7 @@ namespace AssetStudio
return; return;
} }
FbxAnimCurveFilterUnroll* lFilter = EulerFilter ? new FbxAnimCurveFilterUnroll() : NULL; FbxAnimCurveFilterUnroll* lFilter = eulerFilter ? new FbxAnimCurveFilterUnroll() : NULL;
for (int i = 0; i < importedAnimationList->Count; i++) for (int i = 0; i < importedAnimationList->Count; i++)
{ {
@ -738,7 +739,7 @@ namespace AssetStudio
} }
} }
void Fbx::Exporter::ExportKeyframedAnimation(ImportedKeyframedAnimation^ parser, FbxString& kTakeName, FbxAnimCurveFilterUnroll* EulerFilter, float filterPrecision, bool flatInbetween) void Fbx::Exporter::ExportKeyframedAnimation(ImportedKeyframedAnimation^ parser, FbxString& kTakeName, FbxAnimCurveFilterUnroll* eulerFilter, float filterPrecision, bool flatInbetween)
{ {
List<ImportedAnimationKeyframedTrack^>^ pAnimationList = parser->TrackList; List<ImportedAnimationKeyframedTrack^>^ pAnimationList = parser->TrackList;
@ -828,15 +829,15 @@ namespace AssetStudio
lCurveTY->KeyModifyEnd(); lCurveTY->KeyModifyEnd();
lCurveTZ->KeyModifyEnd(); lCurveTZ->KeyModifyEnd();
if (EulerFilter) if (eulerFilter)
{ {
FbxAnimCurve* lCurve[3]; FbxAnimCurve* lCurve[3];
lCurve[0] = lCurveRX; lCurve[0] = lCurveRX;
lCurve[1] = lCurveRY; lCurve[1] = lCurveRY;
lCurve[2] = lCurveRZ; lCurve[2] = lCurveRZ;
EulerFilter->Reset(); eulerFilter->Reset();
EulerFilter->SetQualityTolerance(filterPrecision); eulerFilter->SetQualityTolerance(filterPrecision);
EulerFilter->Apply(lCurve, 3); eulerFilter->Apply(lCurve, 3);
} }
if (keyframeList->Curve->Count > 0) if (keyframeList->Curve->Count > 0)