Skip to content

Commit a0e2718

Browse files
committed
export euler rotation with tangents
1 parent 125c6ab commit a0e2718

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

com.unity.formats.fbx/Editor/FbxExporter.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,7 +1857,11 @@ internal void ExportAnimationKeys (AnimationCurve uniAnimCurve, FbxAnimCurve fbx
18571857
}
18581858

18591859
float tangentMultiplier = 100;
1860-
if(uniPropertyName == "m_LocalPosition.x")
1860+
if(uniPropertyName.StartsWith("localEulerAnglesRaw"))
1861+
{
1862+
tangentMultiplier = 1;
1863+
}
1864+
if(uniPropertyName == "m_LocalPosition.x" || uniPropertyName == "localEulerAnglesRaw.y" || uniPropertyName == "localEulerAnglesRaw.z")
18611865
{
18621866
tangentMultiplier *= -1; // have to negate x when switching between Unity->Maya axes
18631867
}
@@ -2052,9 +2056,12 @@ public UnityToMayaConvertSceneHelper(string uniPropertyName)
20522056
bool partT = uniPropertyName.StartsWith("m_LocalPosition.", cc) || uniPropertyName.StartsWith("m_TranslationOffset", cc);
20532057
bool partTx = uniPropertyName.EndsWith("Position.x", cc) || uniPropertyName.EndsWith("T.x", cc) || (uniPropertyName.StartsWith("m_TranslationOffset") && uniPropertyName.EndsWith(".x", cc));
20542058
bool partRyz = uniPropertyName.StartsWith("m_RotationOffset", cc) && (uniPropertyName.EndsWith(".y") || uniPropertyName.EndsWith(".z"));
2059+
partRyz = partRyz || (uniPropertyName.StartsWith("localEulerAnglesRaw", cc) && (uniPropertyName.EndsWith(".y") || uniPropertyName.EndsWith(".z")));
2060+
//bool partR = uniPropertyName.StartsWith("localEulerAnglesRaw.", cc);
20552061

20562062
convertLtoR |= partTx;
20572063
convertLtoR |= partRyz;
2064+
convertLtoR |= partRyz;
20582065

20592066
convertDistance |= partT;
20602067
convertDistance |= uniPropertyName.StartsWith ("m_Intensity", cc);
@@ -2218,12 +2225,12 @@ private void ExportAnimationClip (AnimationClip uniAnimClip, GameObject uniRoot,
22182225
continue;
22192226
}
22202227

2221-
index = EulerCurve.GetEulerIndex (propertyName);
2228+
/*index = EulerCurve.GetEulerIndex (propertyName);
22222229
if (index >= 0) {
22232230
RotationCurve rotCurve = GetRotationCurve<EulerCurve> (uniGO, uniAnimClip.frameRate, ref rotations);
22242231
rotCurve.SetCurve (index, uniAnimCurve);
22252232
continue;
2226-
}
2233+
}*/
22272234

22282235
// simple property (e.g. intensity), export right away
22292236
ExportAnimationCurve (fbxNode, uniAnimCurve, uniAnimClip.frameRate,

com.unity.formats.fbx/Editor/FbxPropertyChannelPair.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ public PropertyChannelMap(Dictionary<string,string> propertyMap, Dictionary<stri
6161
{ "Motion T", "Lcl Translation" },
6262
{ "m_TranslationOffset", "Translation" },
6363
{ "m_ScaleOffset", "Scaling" },
64-
{ "m_RotationOffset", "Rotation" }
64+
{ "m_RotationOffset", "Rotation" },
65+
{ "localEulerAnglesRaw", "Lcl Rotation" }
6566
};
6667

6768
/// <summary>

0 commit comments

Comments
 (0)