diff --git a/AssetStudio/ExportOptions.Designer.cs b/AssetStudio/ExportOptions.Designer.cs
index e4c03c6..9d85289 100644
--- a/AssetStudio/ExportOptions.Designer.cs
+++ b/AssetStudio/ExportOptions.Designer.cs
@@ -61,6 +61,7 @@
this.allBones = new System.Windows.Forms.CheckBox();
this.allFrames = new System.Windows.Forms.CheckBox();
this.EulerFilter = new System.Windows.Forms.CheckBox();
+ this.FixRotation = new System.Windows.Forms.CheckBox();
this.FbxBox.SuspendLayout();
this.geometryBox.SuspendLayout();
this.advancedBox.SuspendLayout();
@@ -235,7 +236,7 @@
//
// fbxOKbutton
//
- this.fbxOKbutton.Location = new System.Drawing.Point(325, 335);
+ this.fbxOKbutton.Location = new System.Drawing.Point(325, 354);
this.fbxOKbutton.Name = "fbxOKbutton";
this.fbxOKbutton.Size = new System.Drawing.Size(75, 21);
this.fbxOKbutton.TabIndex = 6;
@@ -246,7 +247,7 @@
// fbxCancel
//
this.fbxCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.fbxCancel.Location = new System.Drawing.Point(406, 335);
+ this.fbxCancel.Location = new System.Drawing.Point(406, 354);
this.fbxCancel.Name = "fbxCancel";
this.fbxCancel.Size = new System.Drawing.Size(75, 21);
this.fbxCancel.TabIndex = 7;
@@ -334,6 +335,7 @@
//
// groupBox2
//
+ this.groupBox2.Controls.Add(this.FixRotation);
this.groupBox2.Controls.Add(this.compatibility);
this.groupBox2.Controls.Add(this.flatInbetween);
this.groupBox2.Controls.Add(this.boneSize);
@@ -346,7 +348,7 @@
this.groupBox2.Controls.Add(this.EulerFilter);
this.groupBox2.Location = new System.Drawing.Point(267, 124);
this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(214, 205);
+ this.groupBox2.Size = new System.Drawing.Size(214, 224);
this.groupBox2.TabIndex = 11;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Fbx Binary";
@@ -354,7 +356,7 @@
// compatibility
//
this.compatibility.AutoSize = true;
- this.compatibility.Location = new System.Drawing.Point(6, 177);
+ this.compatibility.Location = new System.Drawing.Point(6, 199);
this.compatibility.Name = "compatibility";
this.compatibility.Size = new System.Drawing.Size(102, 16);
this.compatibility.TabIndex = 13;
@@ -364,7 +366,7 @@
// flatInbetween
//
this.flatInbetween.AutoSize = true;
- this.flatInbetween.Location = new System.Drawing.Point(6, 155);
+ this.flatInbetween.Location = new System.Drawing.Point(6, 177);
this.flatInbetween.Name = "flatInbetween";
this.flatInbetween.Size = new System.Drawing.Size(102, 16);
this.flatInbetween.TabIndex = 12;
@@ -373,7 +375,7 @@
//
// boneSize
//
- this.boneSize.Location = new System.Drawing.Point(65, 128);
+ this.boneSize.Location = new System.Drawing.Point(65, 150);
this.boneSize.Name = "boneSize";
this.boneSize.Size = new System.Drawing.Size(46, 21);
this.boneSize.TabIndex = 11;
@@ -386,7 +388,7 @@
// label2
//
this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(6, 130);
+ this.label2.Location = new System.Drawing.Point(6, 152);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 12);
this.label2.TabIndex = 10;
@@ -397,7 +399,7 @@
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.Location = new System.Drawing.Point(6, 127);
this.skins.Name = "skins";
this.skins.Size = new System.Drawing.Size(54, 16);
this.skins.TabIndex = 8;
@@ -407,7 +409,7 @@
// label1
//
this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(26, 39);
+ this.label1.Location = new System.Drawing.Point(26, 61);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(95, 12);
this.label1.TabIndex = 7;
@@ -421,7 +423,7 @@
0,
0,
131072});
- this.filterPrecision.Location = new System.Drawing.Point(127, 37);
+ this.filterPrecision.Location = new System.Drawing.Point(127, 59);
this.filterPrecision.Name = "filterPrecision";
this.filterPrecision.Size = new System.Drawing.Size(51, 21);
this.filterPrecision.TabIndex = 6;
@@ -436,7 +438,7 @@
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.Location = new System.Drawing.Point(6, 105);
this.allBones.Name = "allBones";
this.allBones.Size = new System.Drawing.Size(72, 16);
this.allBones.TabIndex = 5;
@@ -446,7 +448,7 @@
// allFrames
//
this.allFrames.AutoSize = true;
- this.allFrames.Location = new System.Drawing.Point(6, 61);
+ this.allFrames.Location = new System.Drawing.Point(6, 83);
this.allFrames.Name = "allFrames";
this.allFrames.Size = new System.Drawing.Size(78, 16);
this.allFrames.TabIndex = 4;
@@ -456,20 +458,32 @@
// EulerFilter
//
this.EulerFilter.AutoSize = true;
- this.EulerFilter.Location = new System.Drawing.Point(6, 20);
+ this.EulerFilter.Location = new System.Drawing.Point(6, 42);
this.EulerFilter.Name = "EulerFilter";
this.EulerFilter.Size = new System.Drawing.Size(90, 16);
this.EulerFilter.TabIndex = 3;
this.EulerFilter.Text = "EulerFilter";
this.EulerFilter.UseVisualStyleBackColor = true;
//
+ // FixRotation
+ //
+ this.FixRotation.AutoSize = true;
+ this.FixRotation.Checked = true;
+ this.FixRotation.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.FixRotation.Location = new System.Drawing.Point(6, 20);
+ this.FixRotation.Name = "FixRotation";
+ this.FixRotation.Size = new System.Drawing.Size(90, 16);
+ this.FixRotation.TabIndex = 14;
+ this.FixRotation.Text = "FixRotation";
+ this.FixRotation.UseVisualStyleBackColor = true;
+ //
// ExportOptions
//
this.AcceptButton = this.fbxOKbutton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.fbxCancel;
- this.ClientSize = new System.Drawing.Size(495, 369);
+ this.ClientSize = new System.Drawing.Size(495, 384);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.fbxCancel);
@@ -538,5 +552,6 @@
private System.Windows.Forms.CheckBox allBones;
private System.Windows.Forms.CheckBox allFrames;
private System.Windows.Forms.CheckBox EulerFilter;
+ private System.Windows.Forms.CheckBox FixRotation;
}
}
\ No newline at end of file
diff --git a/AssetStudio/ExportOptions.cs b/AssetStudio/ExportOptions.cs
index 32306a0..4de5b3f 100644
--- a/AssetStudio/ExportOptions.cs
+++ b/AssetStudio/ExportOptions.cs
@@ -35,6 +35,7 @@ namespace AssetStudio
break;
}
}
+ FixRotation.Checked = (bool)Properties.Settings.Default["FixRotation"];
EulerFilter.Checked = (bool)Properties.Settings.Default["EulerFilter"];
filterPrecision.Value = (decimal)Properties.Settings.Default["filterPrecision"];
allFrames.Checked = (bool)Properties.Settings.Default["allFrames"];
@@ -70,6 +71,7 @@ namespace AssetStudio
break;
}
}
+ Properties.Settings.Default["FixRotation"] = FixRotation.Checked;
Properties.Settings.Default["EulerFilter"] = EulerFilter.Checked;
Properties.Settings.Default["filterPrecision"] = filterPrecision.Value;
Properties.Settings.Default["allFrames"] = allFrames.Checked;
diff --git a/AssetStudio/Properties/Settings.Designer.cs b/AssetStudio/Properties/Settings.Designer.cs
index aa487de..21560af 100644
--- a/AssetStudio/Properties/Settings.Designer.cs
+++ b/AssetStudio/Properties/Settings.Designer.cs
@@ -322,5 +322,17 @@ namespace AssetStudio.Properties {
this["compatibility"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool FixRotation {
+ get {
+ return ((bool)(this["FixRotation"]));
+ }
+ set {
+ this["FixRotation"] = value;
+ }
+ }
}
}
diff --git a/AssetStudio/Properties/Settings.settings b/AssetStudio/Properties/Settings.settings
index 7bb2a2b..117f248 100644
--- a/AssetStudio/Properties/Settings.settings
+++ b/AssetStudio/Properties/Settings.settings
@@ -77,5 +77,8 @@
False
+
+ True
+
\ No newline at end of file
diff --git a/AssetStudio/StudioClasses/ModelConverter.cs b/AssetStudio/StudioClasses/ModelConverter.cs
index 2ad55cc..6f0151c 100644
--- a/AssetStudio/StudioClasses/ModelConverter.cs
+++ b/AssetStudio/StudioClasses/ModelConverter.cs
@@ -583,21 +583,12 @@ namespace AssetStudio
track.Name = boneName;
iAnim.TrackList.Add(track);
}
- Vector3 prevKey = new Vector3();
foreach (var m_Curve in m_RotationCurve.curve.m_Curve)
{
var value = Fbx.QuaternionToEuler(new Quaternion(m_Curve.value.X, -m_Curve.value.Y, -m_Curve.value.Z, m_Curve.value.W));
var inSlope = Fbx.QuaternionToEuler(new Quaternion(m_Curve.inSlope.X, -m_Curve.inSlope.Y, -m_Curve.inSlope.Z, m_Curve.inSlope.W));
var outSlope = Fbx.QuaternionToEuler(new Quaternion(m_Curve.outSlope.X, -m_Curve.outSlope.Y, -m_Curve.outSlope.Z, m_Curve.outSlope.W));
-
- ReplaceOutOfBound(ref prevKey, ref value);
- prevKey = value;
-
- track.Rotations.Add(new ImportedKeyframe(
- m_Curve.time,
- value,
- inSlope,
- outSlope));
+ track.Rotations.Add(new ImportedKeyframe(m_Curve.time, value, inSlope, outSlope));
}
}
foreach (var m_PositionCurve in clip.m_PositionCurves)
@@ -640,6 +631,21 @@ namespace AssetStudio
new Vector3(m_Curve.outSlope.X, m_Curve.outSlope.Y, m_Curve.outSlope.Z)));
}
}
+
+ if ((bool)Properties.Settings.Default["FixRotation"])
+ {
+ foreach (var track in iAnim.TrackList)
+ {
+ var prevKey = new Vector3();
+ foreach (var rotation in track.Rotations)
+ {
+ var value = rotation.value;
+ ReplaceOutOfBound(ref prevKey, ref value);
+ prevKey = value;
+ rotation.value = value;
+ }
+ }
+ }
}
else
{
@@ -724,16 +730,16 @@ namespace AssetStudio
case 2:
if (track.Rotations == null)
{
- track.Rotations = new Quaternion?[numFrames];
+ track.Rotations = new Vector3?[numFrames];
}
- track.Rotations[frameIdx] = new Quaternion
+ track.Rotations[frameIdx] = Fbx.QuaternionToEuler(new Quaternion
(
data[curveIdx++ - dataOffset],
-data[curveIdx++ - dataOffset],
-data[curveIdx++ - dataOffset],
data[curveIdx++ - dataOffset]
- );
+ ));
break;
case 3:
if (track.Scalings == null)
@@ -751,17 +757,14 @@ namespace AssetStudio
case 4:
if (track.Rotations == null)
{
- track.Rotations = new Quaternion?[numFrames];
+ track.Rotations = new Vector3?[numFrames];
}
- track.Rotations[frameIdx] = Fbx.EulerToQuaternion
+ track.Rotations[frameIdx] = new Vector3
(
- new Vector3
- (
- data[curveIdx++ - dataOffset],
- -data[curveIdx++ - dataOffset],
- -data[curveIdx++ - dataOffset]
- )
+ data[curveIdx++ - dataOffset],
+ -data[curveIdx++ - dataOffset],
+ -data[curveIdx++ - dataOffset]
);
break;
default:
@@ -782,6 +785,26 @@ namespace AssetStudio
}
}
}
+
+ if ((bool)Properties.Settings.Default["FixRotation"])
+ {
+ foreach (var track in iAnim.TrackList)
+ {
+ if (track.Rotations == null)
+ continue;
+ var prevKey = new Vector3();
+ for (var i = 0; i < track.Rotations.Length; i++)
+ {
+ var rotation = track.Rotations[i];
+ if (rotation == null)
+ continue;
+ var value = new Vector3(rotation.Value.X, rotation.Value.Y, rotation.Value.Z);
+ ReplaceOutOfBound(ref prevKey, ref value);
+ prevKey = value;
+ track.Rotations[i] = value;
+ }
+ }
+ }
}
}
}
@@ -905,10 +928,6 @@ namespace AssetStudio
}
double newValue = count * 360.0 + cur;
- if (newValue != cur)
- {
-
- }
return (float)newValue;
}
}
diff --git a/AssetStudio/app.config b/AssetStudio/app.config
index 4c887bc..f2afb20 100644
--- a/AssetStudio/app.config
+++ b/AssetStudio/app.config
@@ -82,6 +82,9 @@
False
+
+ True
+
\ No newline at end of file
diff --git a/AssetStudioFBX/AssetStudioFBXExporter.cpp b/AssetStudioFBX/AssetStudioFBXExporter.cpp
index 770af19..a4dfe22 100644
--- a/AssetStudioFBX/AssetStudioFBXExporter.cpp
+++ b/AssetStudioFBX/AssetStudioFBXExporter.cpp
@@ -986,10 +986,9 @@ namespace AssetStudio
lTime.SetSecondDouble(fps * k);
- Vector3 rotation = Fbx::QuaternionToEuler(sampleList->Rotations[k].Value);
- lCurveRX->KeySet(lCurveRX->KeyAdd(lTime), lTime, rotation.X);
- lCurveRY->KeySet(lCurveRY->KeyAdd(lTime), lTime, rotation.Y);
- lCurveRZ->KeySet(lCurveRZ->KeyAdd(lTime), lTime, rotation.Z);
+ lCurveRX->KeySet(lCurveRX->KeyAdd(lTime), lTime, sampleList->Rotations[k].Value.X);
+ lCurveRY->KeySet(lCurveRY->KeyAdd(lTime), lTime, sampleList->Rotations[k].Value.Y);
+ lCurveRZ->KeySet(lCurveRZ->KeyAdd(lTime), lTime, sampleList->Rotations[k].Value.Z);
}
lCurveRX->KeyModifyEnd();
lCurveRY->KeyModifyEnd();
diff --git a/AssetStudioUtility/Imported.cs b/AssetStudioUtility/Imported.cs
index 45c01ce..1355ede 100644
--- a/AssetStudioUtility/Imported.cs
+++ b/AssetStudioUtility/Imported.cs
@@ -147,7 +147,7 @@ namespace AssetStudio
public class ImportedAnimationSampledTrack : ImportedAnimationTrack
{
public Vector3?[] Scalings;
- public Quaternion?[] Rotations;
+ public Vector3?[] Rotations;
public Vector3?[] Translations;
public float?[] Curve;
}