FIxed #258
This commit is contained in:
parent
a233af5b8f
commit
310c165824
|
@ -46,6 +46,7 @@
|
|||
this.assetGroupOptions = new System.Windows.Forms.ToolStripComboBox();
|
||||
this.showExpOpt = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.modelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.exportallobjectsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.exportallobjectssplitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.exportselectedobjectsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -113,7 +114,6 @@
|
|||
this.exportobjectswithselectedAnimationClipMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.jumpToSceneHierarchyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.showOriginalFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
|
@ -263,7 +263,7 @@
|
|||
// assetGroupOptions
|
||||
//
|
||||
this.assetGroupOptions.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.assetGroupOptions.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.assetGroupOptions.FlatStyle = System.Windows.Forms.FlatStyle.Standard;
|
||||
this.assetGroupOptions.Items.AddRange(new object[] {
|
||||
"Group by type",
|
||||
"Group by source file",
|
||||
|
@ -294,24 +294,31 @@
|
|||
this.modelToolStripMenuItem.Size = new System.Drawing.Size(58, 21);
|
||||
this.modelToolStripMenuItem.Text = "Model";
|
||||
//
|
||||
// toolStripMenuItem3
|
||||
//
|
||||
this.toolStripMenuItem3.Enabled = false;
|
||||
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
|
||||
this.toolStripMenuItem3.Size = new System.Drawing.Size(332, 22);
|
||||
this.toolStripMenuItem3.Text = "-----------------------Ascii-----------------------";
|
||||
//
|
||||
// exportallobjectsMenuItem
|
||||
//
|
||||
this.exportallobjectsMenuItem.Name = "exportallobjectsMenuItem";
|
||||
this.exportallobjectsMenuItem.Size = new System.Drawing.Size(323, 22);
|
||||
this.exportallobjectsMenuItem.Size = new System.Drawing.Size(332, 22);
|
||||
this.exportallobjectsMenuItem.Text = "Export all objects";
|
||||
this.exportallobjectsMenuItem.Click += new System.EventHandler(this.ExportObjects_Click);
|
||||
//
|
||||
// exportallobjectssplitToolStripMenuItem
|
||||
//
|
||||
this.exportallobjectssplitToolStripMenuItem.Name = "exportallobjectssplitToolStripMenuItem";
|
||||
this.exportallobjectssplitToolStripMenuItem.Size = new System.Drawing.Size(323, 22);
|
||||
this.exportallobjectssplitToolStripMenuItem.Size = new System.Drawing.Size(332, 22);
|
||||
this.exportallobjectssplitToolStripMenuItem.Text = "Export all objects (split)";
|
||||
this.exportallobjectssplitToolStripMenuItem.Click += new System.EventHandler(this.exportallobjectssplitToolStripMenuItem_Click);
|
||||
//
|
||||
// exportselectedobjectsMenuItem
|
||||
//
|
||||
this.exportselectedobjectsMenuItem.Name = "exportselectedobjectsMenuItem";
|
||||
this.exportselectedobjectsMenuItem.Size = new System.Drawing.Size(323, 22);
|
||||
this.exportselectedobjectsMenuItem.Size = new System.Drawing.Size(332, 22);
|
||||
this.exportselectedobjectsMenuItem.Text = "Export selected objects";
|
||||
this.exportselectedobjectsMenuItem.Click += new System.EventHandler(this.ExportObjects_Click);
|
||||
//
|
||||
|
@ -325,21 +332,21 @@
|
|||
// exportAllObjectssplitToolStripMenuItem1
|
||||
//
|
||||
this.exportAllObjectssplitToolStripMenuItem1.Name = "exportAllObjectssplitToolStripMenuItem1";
|
||||
this.exportAllObjectssplitToolStripMenuItem1.Size = new System.Drawing.Size(323, 22);
|
||||
this.exportAllObjectssplitToolStripMenuItem1.Size = new System.Drawing.Size(332, 22);
|
||||
this.exportAllObjectssplitToolStripMenuItem1.Text = "Export all objects (split)";
|
||||
this.exportAllObjectssplitToolStripMenuItem1.Click += new System.EventHandler(this.exportAllObjectssplitToolStripMenuItem1_Click);
|
||||
//
|
||||
// exportSelectedObjectsToolStripMenuItem
|
||||
//
|
||||
this.exportSelectedObjectsToolStripMenuItem.Name = "exportSelectedObjectsToolStripMenuItem";
|
||||
this.exportSelectedObjectsToolStripMenuItem.Size = new System.Drawing.Size(323, 22);
|
||||
this.exportSelectedObjectsToolStripMenuItem.Size = new System.Drawing.Size(332, 22);
|
||||
this.exportSelectedObjectsToolStripMenuItem.Text = "Export selected objects";
|
||||
this.exportSelectedObjectsToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedObjectsToolStripMenuItem_Click);
|
||||
//
|
||||
// exportSelectedObjectsWithAnimationClipToolStripMenuItem
|
||||
//
|
||||
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Name = "exportSelectedObjectsWithAnimationClipToolStripMenuItem";
|
||||
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(323, 22);
|
||||
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(332, 22);
|
||||
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Text = "Export selected objects with AnimationClip";
|
||||
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Click += new System.EventHandler(this.exportObjectswithAnimationClipMenuItem_Click);
|
||||
//
|
||||
|
@ -951,13 +958,6 @@
|
|||
this.showOriginalFileToolStripMenuItem.Visible = false;
|
||||
this.showOriginalFileToolStripMenuItem.Click += new System.EventHandler(this.showOriginalFileToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripMenuItem3
|
||||
//
|
||||
this.toolStripMenuItem3.Enabled = false;
|
||||
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
|
||||
this.toolStripMenuItem3.Size = new System.Drawing.Size(332, 22);
|
||||
this.toolStripMenuItem3.Text = "-----------------------Ascii-----------------------";
|
||||
//
|
||||
// AssetStudioForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
|
|
|
@ -120,9 +120,6 @@
|
|||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>312, 17</value>
|
||||
</metadata>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>432, 17</value>
|
||||
</metadata>
|
||||
<data name="fontPreviewBox.Text" xml:space="preserve">
|
||||
<value>abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWYZ
|
||||
1234567890.:,;'\"(!?)+-*/=
|
||||
|
@ -141,6 +138,9 @@ The quick brown fox jumps over the lazy dog. 1234567890
|
|||
|
||||
The quick brown fox jumps over the lazy dog. 1234567890</value>
|
||||
</data>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>432, 17</value>
|
||||
</metadata>
|
||||
<metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>553, 17</value>
|
||||
</metadata>
|
||||
|
|
|
@ -48,8 +48,9 @@
|
|||
this.tobmp = new System.Windows.Forms.RadioButton();
|
||||
this.converttexture = new System.Windows.Forms.CheckBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.fbxVersion = new System.Windows.Forms.ComboBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.FixRotation = new System.Windows.Forms.CheckBox();
|
||||
this.compatibility = new System.Windows.Forms.CheckBox();
|
||||
this.flatInbetween = new System.Windows.Forms.CheckBox();
|
||||
this.boneSize = new System.Windows.Forms.NumericUpDown();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
|
@ -300,8 +301,9 @@
|
|||
// groupBox2
|
||||
//
|
||||
this.groupBox2.AutoSize = true;
|
||||
this.groupBox2.Controls.Add(this.fbxVersion);
|
||||
this.groupBox2.Controls.Add(this.label3);
|
||||
this.groupBox2.Controls.Add(this.FixRotation);
|
||||
this.groupBox2.Controls.Add(this.compatibility);
|
||||
this.groupBox2.Controls.Add(this.flatInbetween);
|
||||
this.groupBox2.Controls.Add(this.boneSize);
|
||||
this.groupBox2.Controls.Add(this.label2);
|
||||
|
@ -313,11 +315,35 @@
|
|||
this.groupBox2.Controls.Add(this.EulerFilter);
|
||||
this.groupBox2.Location = new System.Drawing.Point(265, 12);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(214, 235);
|
||||
this.groupBox2.Size = new System.Drawing.Size(214, 240);
|
||||
this.groupBox2.TabIndex = 11;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Fbx Binary";
|
||||
//
|
||||
// fbxVersion
|
||||
//
|
||||
this.fbxVersion.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.fbxVersion.FormattingEnabled = true;
|
||||
this.fbxVersion.Items.AddRange(new object[] {
|
||||
"6.1",
|
||||
"7.1",
|
||||
"7.2",
|
||||
"7.3",
|
||||
"7.4"});
|
||||
this.fbxVersion.Location = new System.Drawing.Point(77, 200);
|
||||
this.fbxVersion.Name = "fbxVersion";
|
||||
this.fbxVersion.Size = new System.Drawing.Size(47, 20);
|
||||
this.fbxVersion.TabIndex = 16;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(6, 203);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(65, 12);
|
||||
this.label3.TabIndex = 15;
|
||||
this.label3.Text = "FBXVersion";
|
||||
//
|
||||
// FixRotation
|
||||
//
|
||||
this.FixRotation.AutoSize = true;
|
||||
|
@ -330,16 +356,6 @@
|
|||
this.FixRotation.Text = "FixRotation";
|
||||
this.FixRotation.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// compatibility
|
||||
//
|
||||
this.compatibility.AutoSize = true;
|
||||
this.compatibility.Location = new System.Drawing.Point(6, 199);
|
||||
this.compatibility.Name = "compatibility";
|
||||
this.compatibility.Size = new System.Drawing.Size(138, 16);
|
||||
this.compatibility.TabIndex = 13;
|
||||
this.compatibility.Text = "Compatibility (6.1)";
|
||||
this.compatibility.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// flatInbetween
|
||||
//
|
||||
this.flatInbetween.AutoSize = true;
|
||||
|
@ -502,7 +518,6 @@
|
|||
private System.Windows.Forms.CheckBox convertAudio;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.CheckBox compatibility;
|
||||
private System.Windows.Forms.CheckBox flatInbetween;
|
||||
private System.Windows.Forms.NumericUpDown boneSize;
|
||||
private System.Windows.Forms.Label label2;
|
||||
|
@ -513,5 +528,7 @@
|
|||
private System.Windows.Forms.CheckBox allFrames;
|
||||
private System.Windows.Forms.CheckBox EulerFilter;
|
||||
private System.Windows.Forms.CheckBox FixRotation;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.ComboBox fbxVersion;
|
||||
}
|
||||
}
|
|
@ -42,7 +42,7 @@ namespace AssetStudio
|
|||
skins.Checked = (bool)Properties.Settings.Default["skins"];
|
||||
boneSize.Value = (decimal)Properties.Settings.Default["boneSize"];
|
||||
flatInbetween.Checked = (bool)Properties.Settings.Default["flatInbetween"];
|
||||
compatibility.Checked = (bool)Properties.Settings.Default["compatibility"];
|
||||
fbxVersion.SelectedIndex = (int)Properties.Settings.Default["fbxVersion"];
|
||||
}
|
||||
|
||||
private void exportOpnions_CheckedChanged(object sender, EventArgs e)
|
||||
|
@ -77,7 +77,7 @@ namespace AssetStudio
|
|||
Properties.Settings.Default["skins"] = skins.Checked;
|
||||
Properties.Settings.Default["boneSize"] = boneSize.Value;
|
||||
Properties.Settings.Default["flatInbetween"] = flatInbetween.Checked;
|
||||
Properties.Settings.Default["compatibility"] = compatibility.Checked;
|
||||
Properties.Settings.Default["fbxVersion"] = fbxVersion.SelectedIndex;
|
||||
Properties.Settings.Default.Save();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
|
|
|
@ -301,13 +301,13 @@ namespace AssetStudio.Properties {
|
|||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool compatibility {
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("3")]
|
||||
public int fbxVersion {
|
||||
get {
|
||||
return ((bool)(this["compatibility"]));
|
||||
return ((int)(this["fbxVersion"]));
|
||||
}
|
||||
set {
|
||||
this["compatibility"] = value;
|
||||
this["fbxVersion"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,8 +71,8 @@
|
|||
<Setting Name="flatInbetween" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="compatibility" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
<Setting Name="fbxVersion" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">3</Value>
|
||||
</Setting>
|
||||
<Setting Name="FixRotation" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
|
|
|
@ -353,8 +353,8 @@ namespace AssetStudio
|
|||
var skins = (bool)Properties.Settings.Default["skins"];
|
||||
var boneSize = (int)(decimal)Properties.Settings.Default["boneSize"];
|
||||
var flatInbetween = (bool)Properties.Settings.Default["flatInbetween"];
|
||||
var compatibility = (bool)Properties.Settings.Default["compatibility"];
|
||||
Fbx.Exporter.Export(exportPath, convert, EulerFilter, filterPrecision, allFrames, allBones, skins, boneSize, flatInbetween, compatibility);
|
||||
var fbxVersion = (int)Properties.Settings.Default["fbxVersion"];
|
||||
Fbx.Exporter.Export(exportPath, convert, EulerFilter, filterPrecision, allFrames, allBones, skins, boneSize, flatInbetween, fbxVersion);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,13 @@ namespace AssetStudio
|
|||
|
||||
public ModelConverter(GameObject m_GameObject, List<AssetPreloadData> animationList)
|
||||
{
|
||||
InitWithGameObject(m_GameObject);
|
||||
if (assetsfileList.TryGetPD(m_GameObject.m_Animator, out var m_Animator))
|
||||
{
|
||||
var animator = new Animator(m_Animator);
|
||||
InitWithAnimator(animator);
|
||||
}
|
||||
else
|
||||
InitWithGameObject(m_GameObject);
|
||||
foreach (var assetPreloadData in animationList)
|
||||
{
|
||||
animationClipHashSet.Add(assetPreloadData);
|
||||
|
|
|
@ -76,8 +76,8 @@
|
|||
<setting name="flatInbetween" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="compatibility" serializeAs="String">
|
||||
<value>False</value>
|
||||
<setting name="fbxVersion" serializeAs="String">
|
||||
<value>3</value>
|
||||
</setting>
|
||||
<setting name="FixRotation" serializeAs="String">
|
||||
<value>True</value>
|
||||
|
|
|
@ -25,6 +25,15 @@ using namespace SharpDX;
|
|||
} \
|
||||
}
|
||||
|
||||
static char* FBXVersion[] =
|
||||
{
|
||||
FBX_2010_00_COMPATIBLE,
|
||||
FBX_2011_00_COMPATIBLE,
|
||||
FBX_2012_00_COMPATIBLE,
|
||||
FBX_2013_00_COMPATIBLE,
|
||||
FBX_2014_00_COMPATIBLE
|
||||
};
|
||||
|
||||
namespace AssetStudio {
|
||||
|
||||
public ref class Fbx
|
||||
|
@ -32,12 +41,14 @@ namespace AssetStudio {
|
|||
public:
|
||||
static Vector3 QuaternionToEuler(Quaternion q);
|
||||
static Quaternion EulerToQuaternion(Vector3 v);
|
||||
static char* StringToCharArray(String^ s);
|
||||
static void Init(FbxManager** pSdkManager, FbxScene** pScene);
|
||||
|
||||
ref class Exporter
|
||||
{
|
||||
public:
|
||||
static void Export(String^ path, IImported^ imported, bool EulerFilter, float filterPrecision, bool allFrames, bool allBones, bool skins, float boneSize, bool flatInbetween, bool compatibility);
|
||||
static void ExportMorph(String^ path, IImported^ imported, bool morphMask, bool flatInbetween, bool skins, float boneSize, bool compatibility);
|
||||
static void Export(String^ path, IImported^ imported, bool EulerFilter, float filterPrecision, bool allFrames, bool allBones, bool skins, float boneSize, bool flatInbetween, int versionIndex);
|
||||
static void ExportMorph(String^ path, IImported^ imported, bool morphMask, bool flatInbetween, bool skins, float boneSize, int versionIndex);
|
||||
|
||||
private:
|
||||
HashSet<String^>^ frameNames;
|
||||
|
@ -54,11 +65,11 @@ namespace AssetStudio {
|
|||
FbxArray<FbxFileTexture*>* pTextures;
|
||||
FbxArray<FbxNode*>* pMeshNodes;
|
||||
|
||||
Exporter(String^ path, IImported^ imported, bool allFrames, bool allBones, bool skins, float boneSize, int versionIndex, bool normals);
|
||||
~Exporter();
|
||||
void Fbx::Exporter::LinkTexture(ImportedMaterial^ mat, int attIndex, FbxFileTexture* pTexture, FbxProperty& prop);
|
||||
void SetJointsNode(FbxNode* pNode, HashSet<String^>^ boneNames, bool allBones);
|
||||
|
||||
Exporter(String^ path, IImported^ imported, bool allFrames, bool allBones, bool skins, float boneSize, bool compatibility, bool normals);
|
||||
void Exporter::LinkTexture(ImportedMaterial^ mat, int attIndex, FbxFileTexture* pTexture, FbxProperty& prop);
|
||||
void SetJointsNode(FbxNode* pNode, HashSet<String^>^ boneNames, bool allBones);
|
||||
HashSet<String^>^ SearchHierarchy();
|
||||
void SearchHierarchy(ImportedFrame^ frame, HashSet<String^>^ exportFrames);
|
||||
void SetJointsFromImportedMeshes(bool allBones);
|
||||
|
@ -69,8 +80,5 @@ namespace AssetStudio {
|
|||
void ExportKeyframedAnimation(ImportedKeyframedAnimation^ parser, FbxString& kTakeName, FbxAnimCurveFilterUnroll* EulerFilter, float filterPrecision, bool flatInbetween);
|
||||
void ExportMorphs(IImported^ imported, bool morphMask, bool flatInbetween);
|
||||
};
|
||||
|
||||
static char* StringToCharArray(String^ s);
|
||||
static void Init(FbxManager** pSdkManager, FbxScene** pScene);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace AssetStudio
|
||||
{
|
||||
void Fbx::Exporter::Export(String^ path, IImported^ imported, bool EulerFilter, float filterPrecision, bool allFrames, bool allBones, bool skins, float boneSize, bool flatInbetween, bool compatibility)
|
||||
void Fbx::Exporter::Export(String^ path, IImported^ imported, bool EulerFilter, float filterPrecision, bool allFrames, bool allBones, bool skins, float boneSize, bool flatInbetween, int versionIndex)
|
||||
{
|
||||
FileInfo^ file = gcnew FileInfo(path);
|
||||
DirectoryInfo^ dir = file->Directory;
|
||||
|
@ -16,7 +16,7 @@ namespace AssetStudio
|
|||
Directory::SetCurrentDirectory(dir->FullName);
|
||||
path = Path::GetFileName(path);
|
||||
|
||||
Exporter^ exporter = gcnew Exporter(path, imported, allFrames, allBones, skins, boneSize, compatibility, true);
|
||||
Exporter^ exporter = gcnew Exporter(path, imported, allFrames, allBones, skins, boneSize, versionIndex, true);
|
||||
exporter->ExportMorphs(imported, false, flatInbetween);
|
||||
exporter->ExportAnimations(EulerFilter, filterPrecision, flatInbetween);
|
||||
exporter->pExporter->Export(exporter->pScene);
|
||||
|
@ -25,7 +25,7 @@ namespace AssetStudio
|
|||
Directory::SetCurrentDirectory(currentDir);
|
||||
}
|
||||
|
||||
void Fbx::Exporter::ExportMorph(String^ path, IImported^ imported, bool morphMask, bool flatInbetween, bool skins, float boneSize, bool compatibility)
|
||||
void Fbx::Exporter::ExportMorph(String^ path, IImported^ imported, bool morphMask, bool flatInbetween, bool skins, float boneSize, int versionIndex)
|
||||
{
|
||||
FileInfo^ file = gcnew FileInfo(path);
|
||||
DirectoryInfo^ dir = file->Directory;
|
||||
|
@ -37,7 +37,7 @@ namespace AssetStudio
|
|||
Directory::SetCurrentDirectory(dir->FullName);
|
||||
path = Path::GetFileName(path);
|
||||
|
||||
Exporter^ exporter = gcnew Exporter(path, imported, false, true, skins, boneSize, compatibility, false);
|
||||
Exporter^ exporter = gcnew Exporter(path, imported, false, true, skins, boneSize, versionIndex, false);
|
||||
exporter->ExportMorphs(imported, morphMask, flatInbetween);
|
||||
exporter->pExporter->Export(exporter->pScene);
|
||||
delete exporter;
|
||||
|
@ -45,7 +45,7 @@ namespace AssetStudio
|
|||
Directory::SetCurrentDirectory(currentDir);
|
||||
}
|
||||
|
||||
Fbx::Exporter::Exporter(String^ path, IImported^ imported, bool allFrames, bool allBones, bool skins, float boneSize, bool compatibility, bool normals)
|
||||
Fbx::Exporter::Exporter(String^ path, IImported^ imported, bool allFrames, bool allBones, bool skins, float boneSize, int versionIndex, bool normals)
|
||||
{
|
||||
this->imported = imported;
|
||||
exportSkins = skins;
|
||||
|
@ -63,24 +63,6 @@ namespace AssetStudio
|
|||
pin_ptr<FbxScene*> pScenePin = &pScene;
|
||||
Init(pSdkManagerPin, pScenePin);
|
||||
|
||||
cDest = Fbx::StringToCharArray(path);
|
||||
pExporter = FbxExporter::Create(pScene, "");
|
||||
int lFormatIndex, lFormatCount = pSdkManager->GetIOPluginRegistry()->GetWriterFormatCount();
|
||||
for (lFormatIndex = 0; lFormatIndex < lFormatCount; lFormatIndex++)
|
||||
{
|
||||
if (pSdkManager->GetIOPluginRegistry()->WriterIsFBX(lFormatIndex))
|
||||
{
|
||||
FbxString lDesc = FbxString(pSdkManager->GetIOPluginRegistry()->GetWriterFormatDescription(lFormatIndex));
|
||||
if (lDesc.Find("binary") >= 0)
|
||||
{
|
||||
if (!compatibility || lDesc.Find("6.") >= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IOS_REF.SetBoolProp(EXP_FBX_MATERIAL, true);
|
||||
IOS_REF.SetBoolProp(EXP_FBX_TEXTURE, true);
|
||||
IOS_REF.SetBoolProp(EXP_FBX_EMBEDDED, false);
|
||||
|
@ -91,10 +73,13 @@ namespace AssetStudio
|
|||
|
||||
FbxGlobalSettings& globalSettings = pScene->GetGlobalSettings();
|
||||
|
||||
if (!pExporter->Initialize(cDest, lFormatIndex, pSdkManager->GetIOSettings()))
|
||||
cDest = StringToCharArray(path);
|
||||
pExporter = FbxExporter::Create(pScene, "");
|
||||
if (!pExporter->Initialize(cDest, 0, pSdkManager->GetIOSettings()))
|
||||
{
|
||||
throw gcnew Exception(gcnew String("Failed to initialize FbxExporter: ") + gcnew String(pExporter->GetStatus().GetErrorString()));
|
||||
}
|
||||
pExporter->SetFileExportVersion(FBXVersion[versionIndex], FbxSceneRenamer::ERenamingMode::eNone);
|
||||
|
||||
frameNames = nullptr;
|
||||
if (!allFrames)
|
||||
|
@ -128,7 +113,7 @@ namespace AssetStudio
|
|||
meshPath = gcnew String(rootNode->GetName()) + "/" + meshPath;
|
||||
}
|
||||
ImportedMesh^ mesh = ImportedHelpers::FindMesh(meshPath, imported->MeshList);
|
||||
ExportMesh(meshNode, mesh, normals);
|
||||
ExportMesh(meshNode, mesh, normals);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -543,7 +528,8 @@ namespace AssetStudio
|
|||
lGeometryElementNormal->GetDirectArray().Add(FbxVector4(normal.X, normal.Y, normal.Z, 0));
|
||||
}
|
||||
array<float>^ uv = vertex->UV;
|
||||
lGeometryElementUV->GetDirectArray().Add(FbxVector2(uv[0], -uv[1]));
|
||||
if (uv != nullptr)
|
||||
lGeometryElementUV->GetDirectArray().Add(FbxVector2(uv[0], -uv[1]));
|
||||
if (normals)
|
||||
{
|
||||
Vector4 tangent = vertex->Tangent;
|
||||
|
@ -568,13 +554,10 @@ namespace AssetStudio
|
|||
for (int j = 0; j < faceList->Count; j++)
|
||||
{
|
||||
ImportedFace^ face = faceList[j];
|
||||
unsigned short v1 = (unsigned short)face->VertexIndices[0];
|
||||
unsigned short v2 = (unsigned short)face->VertexIndices[1];
|
||||
unsigned short v3 = (unsigned short)face->VertexIndices[2];
|
||||
pMesh->BeginPolygon(false);
|
||||
pMesh->AddPolygon(v1);
|
||||
pMesh->AddPolygon(v2);
|
||||
pMesh->AddPolygon(v3);
|
||||
pMesh->BeginPolygon(0);
|
||||
pMesh->AddPolygon(face->VertexIndices[0]);
|
||||
pMesh->AddPolygon(face->VertexIndices[1]);
|
||||
pMesh->AddPolygon(face->VertexIndices[2]);
|
||||
pMesh->EndPolygon();
|
||||
}
|
||||
|
||||
|
@ -586,7 +569,6 @@ namespace AssetStudio
|
|||
FbxCluster* pCluster = pClusterArray->GetAt(j);
|
||||
if (pCluster->GetControlPointIndicesCount() > 0)
|
||||
{
|
||||
FbxNode* pBoneNode = pBoneNodeList->GetAt(j);
|
||||
auto boneMatrix = boneList[j]->Matrix;
|
||||
FbxAMatrix lBoneMatrix;
|
||||
for (int m = 0; m < 4; m++)
|
||||
|
@ -618,7 +600,7 @@ namespace AssetStudio
|
|||
{
|
||||
delete pClusterArray;
|
||||
}
|
||||
Marshal::FreeHGlobal((IntPtr)pName);
|
||||
Marshal::FreeHGlobal((IntPtr)pName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -762,7 +744,7 @@ namespace AssetStudio
|
|||
char* pName = NULL;
|
||||
try
|
||||
{
|
||||
pName = Fbx::StringToCharArray(name);
|
||||
pName = StringToCharArray(name);
|
||||
pNode = pScene->GetRootNode()->FindChild(pName);
|
||||
}
|
||||
finally
|
||||
|
@ -976,7 +958,7 @@ namespace AssetStudio
|
|||
}
|
||||
|
||||
int meshVertexIndex = 0;
|
||||
for (int meshObjIdx = 0; meshObjIdx < meshList->SubmeshList->Count; meshObjIdx++)
|
||||
for (int meshObjIdx = pBaseNode->GetChildCount() - meshList->SubmeshList->Count; meshObjIdx < meshList->SubmeshList->Count; meshObjIdx++)
|
||||
{
|
||||
List<ImportedVertex^>^ vertList = meshList->SubmeshList[meshObjIdx]->VertexList;
|
||||
FbxNode* pBaseMeshNode = pBaseNode->GetChild(meshObjIdx);
|
||||
|
|
Loading…
Reference in New Issue