Skip to content

Commit d25cab7

Browse files
committed
Uni-35607-component-rotation-euler
1 parent 9308a6c commit d25cab7

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,33 +1376,38 @@ protected void ExportAnimationCurve (UnityEngine.Object uniObj,
13761376
class UnityToMayaConvertSceneHelper
13771377
{
13781378
bool convertDistance = false;
1379+
bool convertLtoR = false;
1380+
13791381
float unitScaleFactor = 1f;
13801382

13811383
public UnityToMayaConvertSceneHelper(string uniPropertyName)
13821384
{
13831385
System.StringComparison cc = System.StringComparison.CurrentCulture;
13841386

1385-
convertDistance |= uniPropertyName.StartsWith ("m_LocalPosition.", cc);
1386-
convertDistance |= uniPropertyName.StartsWith ("m_Intensity", cc);
1387+
bool partT = uniPropertyName.StartsWith ("m_LocalPosition.", cc);
1388+
bool partTx = uniPropertyName.EndsWith ("Position.x", cc) || uniPropertyName.EndsWith ("T.x", cc);
1389+
bool partRy = uniPropertyName.Equals("localEulerAnglesRaw.y", cc);
1390+
bool partRz = uniPropertyName.Equals("localEulerAnglesRaw.z", cc);
13871391

1388-
bool convertLHRH = convertDistance && uniPropertyName.EndsWith (".x", cc) || uniPropertyName.EndsWith ("T.x", cc);
1389-
convertDistance |= convertLHRH;
1390-
convertDistance |= uniPropertyName.EndsWith ("T.y", cc);
1391-
convertDistance |= uniPropertyName.EndsWith ("T.z", cc);
1392+
convertLtoR |= partTx || partRy || partRz;
1393+
1394+
convertDistance |= partT;
1395+
convertDistance |= uniPropertyName.StartsWith ("m_Intensity", cc);
13921396

1393-
if (convertDistance) {
1397+
if (convertDistance)
13941398
unitScaleFactor = ModelExporter.UnitScaleFactor;
1395-
if (convertLHRH)
1396-
unitScaleFactor = -unitScaleFactor;
1397-
}
1399+
1400+
if (convertLtoR)
1401+
unitScaleFactor = -unitScaleFactor;
13981402
}
13991403

14001404
public float Convert(float value)
14011405
{
14021406
// left handed to right handed conversion
14031407
// meters to centimetres conversion
1404-
return (convertDistance) ? unitScaleFactor * value : value;
1408+
return unitScaleFactor * value;
14051409
}
1410+
14061411
}
14071412

14081413
/// <summary>
@@ -1438,7 +1443,20 @@ public static bool TryGetValue(string uniPropertyName, out FbxPropertyChannelPai
14381443
return true;
14391444
}
14401445

1441-
// NOTE: Transform Rotation handled by QuaternionCurve
1446+
// Transform Rotation (EULER)
1447+
// NOTE: Quaternion Rotation handled by QuaternionCurve
1448+
if (uniPropertyName.StartsWith ("localEulerAnglesRaw.x", ct)) {
1449+
prop = new FbxPropertyChannelPair ("Lcl Rotation", Globals.FBXSDK_CURVENODE_COMPONENT_X);
1450+
return true;
1451+
}
1452+
if (uniPropertyName.StartsWith ("localEulerAnglesRaw.y", ct)) {
1453+
prop = new FbxPropertyChannelPair ("Lcl Rotation", Globals.FBXSDK_CURVENODE_COMPONENT_Y);
1454+
return true;
1455+
}
1456+
if (uniPropertyName.StartsWith ("localEulerAnglesRaw.z", ct)) {
1457+
prop = new FbxPropertyChannelPair ("Lcl Rotation", Globals.FBXSDK_CURVENODE_COMPONENT_Z);
1458+
return true;
1459+
}
14421460

14431461
// Transform Translation
14441462
if (uniPropertyName.StartsWith ("m_LocalPosition.x", ct) || uniPropertyName.EndsWith ("T.x", ct)) {

0 commit comments

Comments
 (0)