@@ -683,21 +683,41 @@ protected void ExportTransform (UnityEngine.Transform unityTransform, FbxNode fb
683
683
FbxDouble3 fbxRotate ;
684
684
UnityEngine . Vector3 unityScale ;
685
685
686
+ RectTransform uiComponent = unityTransform . gameObject . GetComponent < RectTransform > ( ) ;
687
+
686
688
switch ( exportType ) {
687
689
case TransformExportType . Reset :
688
690
unityTranslate = Vector3 . zero ;
689
691
fbxRotate = new FbxDouble3 ( 0 ) ;
690
692
unityScale = Vector3 . one ;
693
+ if ( uiComponent != null ) // if this component is a RectTransform
694
+ {
695
+ unityTranslate = uiComponent . localPosition ;
696
+ fbxRotate = ConvertQuaternionToXYZEuler ( uiComponent . localRotation ) ;
697
+ unityScale = uiComponent . localScale ;
698
+ }
691
699
break ;
692
700
case TransformExportType . Global :
693
701
unityTranslate = GetRecenteredTranslation ( unityTransform , newCenter ) ;
694
702
fbxRotate = ConvertQuaternionToXYZEuler ( unityTransform . rotation ) ;
695
703
unityScale = unityTransform . lossyScale ;
704
+ if ( uiComponent != null ) // if this component is a RectTransform
705
+ {
706
+ unityTranslate = GetRecenteredTranslation ( uiComponent . transform , newCenter ) ;
707
+ fbxRotate = ConvertQuaternionToXYZEuler ( uiComponent . rotation ) ;
708
+ unityScale = uiComponent . lossyScale ;
709
+ }
696
710
break ;
697
711
default : /*case TransformExportType.Local*/
698
712
unityTranslate = unityTransform . localPosition ;
699
713
fbxRotate = ConvertQuaternionToXYZEuler ( unityTransform . localRotation ) ;
700
714
unityScale = unityTransform . localScale ;
715
+ if ( uiComponent != null ) // if this component is a RectTransform
716
+ {
717
+ unityTranslate = uiComponent . localPosition ;
718
+ fbxRotate = ConvertQuaternionToXYZEuler ( uiComponent . localRotation ) ;
719
+ unityScale = uiComponent . localScale ;
720
+ }
701
721
break ;
702
722
}
703
723
0 commit comments