@@ -1471,14 +1471,17 @@ public static bool TryGetValue(string uniPropertyName, out FbxPropertyChannelPai
1471
1471
// Transform Rotation (EULER)
1472
1472
// NOTE: Quaternion Rotation handled by QuaternionCurve
1473
1473
if ( uniPropertyName . StartsWith ( "localEulerAnglesRaw.x" , ct ) ) {
1474
+ Debug . Log ( "euler export" ) ;
1474
1475
prop = new FbxPropertyChannelPair ( "Lcl Rotation" , Globals . FBXSDK_CURVENODE_COMPONENT_X ) ;
1475
1476
return true ;
1476
1477
}
1477
1478
if ( uniPropertyName . StartsWith ( "localEulerAnglesRaw.y" , ct ) ) {
1479
+ Debug . Log ( "euler export" ) ;
1478
1480
prop = new FbxPropertyChannelPair ( "Lcl Rotation" , Globals . FBXSDK_CURVENODE_COMPONENT_Y ) ;
1479
1481
return true ;
1480
1482
}
1481
1483
if ( uniPropertyName . StartsWith ( "localEulerAnglesRaw.z" , ct ) ) {
1484
+ Debug . Log ( "euler export" ) ;
1482
1485
prop = new FbxPropertyChannelPair ( "Lcl Rotation" , Globals . FBXSDK_CURVENODE_COMPONENT_Z ) ;
1483
1486
return true ;
1484
1487
}
@@ -1586,8 +1589,16 @@ Key [] ComputeKeys(UnityEngine.Quaternion restRotation, FbxNode node) {
1586
1589
var fbxPreRotationEuler = node . GetRotationActive ( )
1587
1590
? node . GetPreRotation ( FbxNode . EPivotSet . eSourcePivot )
1588
1591
: new FbxVector4 ( ) ;
1589
- var fbxPreRotationInverse = new FbxQuaternion ( ) ;
1590
- fbxPreRotationInverse . ComposeSphericalXYZ ( fbxPreRotationEuler ) ;
1592
+ //Debug.LogWarning ("rotation active: " + node.GetRotationActive () + ", pre rotation: " + node.GetPreRotation(FbxNode.EPivotSet.eSourcePivot));
1593
+ Debug . LogWarning ( "node name: " + node . GetName ( ) ) ;
1594
+
1595
+ FbxQuaternion fbxPreRotationInverse ; // = new FbxQuaternion();
1596
+
1597
+ FbxAMatrix m = new FbxAMatrix ( ) ;
1598
+ m . SetR ( fbxPreRotationEuler ) ;
1599
+ fbxPreRotationInverse = m . GetQ ( ) ;
1600
+
1601
+ //fbxPreRotationInverse.ComposeSphericalXYZ(fbxPreRotationEuler);
1591
1602
fbxPreRotationInverse . Inverse ( ) ;
1592
1603
1593
1604
// If we're only animating along certain coords for some
@@ -1628,6 +1639,8 @@ Key [] ComputeKeys(UnityEngine.Quaternion restRotation, FbxNode node) {
1628
1639
key . time = FbxTime . FromSecondDouble ( seconds ) ;
1629
1640
key . euler = ModelExporter . ConvertQuaternionToXYZEuler ( fbxQuat ) ;
1630
1641
keys [ i ++ ] = key ;
1642
+
1643
+ Debug . Log ( "pre rotation: " + fbxPreRotationEuler + ", complete rotation: " + key . euler ) ;
1631
1644
}
1632
1645
1633
1646
// Sort the keys by time
@@ -1752,7 +1765,7 @@ protected void ExportAnimationClip (AnimationClip uniAnimClip, GameObject uniRoo
1752
1765
foreach ( var kvp in quaternions ) {
1753
1766
var unityGo = kvp . Key ;
1754
1767
var quat = kvp . Value ;
1755
-
1768
+ //Debug.LogWarning ("unity object: " + unityGo.name);
1756
1769
FbxNode fbxNode ;
1757
1770
if ( ! MapUnityObjectToFbxNode . TryGetValue ( unityGo , out fbxNode ) ) {
1758
1771
Debug . LogError ( string . Format ( "no FbxNode found for {0}" , unityGo . name ) ) ;
0 commit comments