Skip to content

Commit fd4ab51

Browse files
committed
don't pass root bone around
get from skinned mesh instead
1 parent d457f3f commit fd4ab51

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,8 +2217,6 @@ protected int ExportAnimationOnly(
22172217
boneDict.Add (boneArray [i], i);
22182218
}
22192219

2220-
var rootBone = skinnedMesh.rootBone;
2221-
22222220
// get the bones that are also in the export set
22232221
bones.IntersectWith (exportData.goExportSet);
22242222

@@ -2230,7 +2228,7 @@ protected int ExportAnimationOnly(
22302228
if (!ExportGameObjectAndParents (
22312229
bone.gameObject, unityGO, fbxScene, out node, newCenter,
22322230
exportType, ref numObjectsExported, objectCount,
2233-
new SkinnedMeshBoneInfo(rootBone, skinnedMesh, boneDict)
2231+
new SkinnedMeshBoneInfo(skinnedMesh, boneDict)
22342232
)) {
22352233
// export cancelled
22362234
return -1;
@@ -2267,12 +2265,10 @@ protected int ExportAnimationOnly(
22672265
}
22682266

22692267
class SkinnedMeshBoneInfo {
2270-
public Transform rootBone;
22712268
public SkinnedMeshRenderer skinnedMesh;
22722269
public Dictionary<Transform, int> boneDict;
22732270

2274-
public SkinnedMeshBoneInfo(Transform root, SkinnedMeshRenderer skinnedMesh, Dictionary<Transform, int> boneDict){
2275-
this.rootBone = root;
2271+
public SkinnedMeshBoneInfo(SkinnedMeshRenderer skinnedMesh, Dictionary<Transform, int> boneDict){
22762272
this.skinnedMesh = skinnedMesh;
22772273
this.boneDict = boneDict;
22782274
}
@@ -2329,7 +2325,7 @@ private bool ExportGameObjectAndParents(
23292325

23302326
if (unityGo.transform.parent != null || unityGo.transform.parent != rootObject.transform.parent) {
23312327
SkinnedMeshBoneInfo parentBoneInfo = null;
2332-
if (boneInfo != null && boneInfo.rootBone != null && unityGo.transform != boneInfo.rootBone) {
2328+
if (boneInfo != null && boneInfo.skinnedMesh.rootBone != null && unityGo.transform != boneInfo.skinnedMesh.rootBone) {
23332329
parentBoneInfo = boneInfo;
23342330
}
23352331

@@ -2365,13 +2361,9 @@ private bool ExportBoneTransform(
23652361
return false;
23662362
}
23672363

2368-
var rootBone = boneInfo.rootBone;
23692364
var skinnedMesh = boneInfo.skinnedMesh;
23702365
var boneDict = boneInfo.boneDict;
2371-
2372-
if (rootBone == null) {
2373-
boneInfo.rootBone = skinnedMesh.rootBone;
2374-
}
2366+
var rootBone = skinnedMesh.rootBone;
23752367

23762368
var fbxSkeleton = fbxNode.GetSkeleton ();
23772369
if (fbxSkeleton == null) {

0 commit comments

Comments
 (0)