File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
com.unity.formats.fbx/Editor Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -2887,8 +2887,28 @@ private bool ExportBoneTransform(
2887
2887
fbxSkeleton . Size . Set ( 1.0f * UnitScaleFactor ) ;
2888
2888
fbxNode . SetNodeAttribute ( fbxSkeleton ) ;
2889
2889
}
2890
- var fbxSkeletonType = rootBone != unityBone
2891
- ? FbxSkeleton . EType . eLimbNode : FbxSkeleton . EType . eRoot ;
2890
+ var fbxSkeletonType = FbxSkeleton . EType . eLimbNode ;
2891
+
2892
+ // Only set the rootbone's skeleton type to FbxSkeleton.EType.eRoot
2893
+ // if it has at least one child that is also a bone.
2894
+ // Otherwise if it is marked as Root but has no bones underneath,
2895
+ // Maya will import it as a Null object instead of a bone.
2896
+ if ( rootBone == unityBone && rootBone . childCount > 0 )
2897
+ {
2898
+ var hasChildBone = false ;
2899
+ foreach ( Transform child in unityBone )
2900
+ {
2901
+ if ( boneDict . ContainsKey ( child ) )
2902
+ {
2903
+ hasChildBone = true ;
2904
+ break ;
2905
+ }
2906
+ }
2907
+ if ( hasChildBone )
2908
+ {
2909
+ fbxSkeletonType = FbxSkeleton . EType . eRoot ;
2910
+ }
2911
+ }
2892
2912
fbxSkeleton . SetSkeletonType ( fbxSkeletonType ) ;
2893
2913
2894
2914
var bindPoses = skinnedMesh . sharedMesh . bindposes ;
You can’t perform that action at this time.
0 commit comments