Skip to content

Commit f290924

Browse files
authored
Revert "Add Root Node (#1028)" (#1029)
This reverts commit 80cfea5.
1 parent 80cfea5 commit f290924

File tree

2 files changed

+1
-26
lines changed

2 files changed

+1
-26
lines changed

3ds Max/Max2Babylon/Exporter/BabylonExporter.Mesh.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,9 +1181,6 @@ int CreateGlobalVertex(IIGameMesh mesh, BabylonAbstractMesh babylonAbstractMesh,
11811181
float[] weight = new float[4] { 0, 0, 0, 0 };
11821182
int[] bone = new int[4] { 0, 0, 0, 0 };
11831183
var nbBones = skin.GetNumberOfBones(vertexIndex);
1184-
// Babylon, nor GLTF do not support single bone skeleton, we may add a root node with no transform.
1185-
// this is echoing the process into BabylonExporter.Skeleton ExportBones(Skin)
1186-
var offset = nbBones == 1 ? 1 : 0;
11871184

11881185
int currentVtxBone = 0;
11891186
int currentSkinBone = 0;
@@ -1195,7 +1192,7 @@ int CreateGlobalVertex(IIGameMesh mesh, BabylonAbstractMesh babylonAbstractMesh,
11951192
if (boneWeight <= 0)
11961193
continue;
11971194

1198-
bone[currentVtxBone] = boneIds.IndexOf(skin.GetIGameBone(vertexIndex, currentSkinBone).NodeID) + offset; // add optional offset
1195+
bone[currentVtxBone] = boneIds.IndexOf(skin.GetIGameBone(vertexIndex, currentSkinBone).NodeID);
11991196
weight[currentVtxBone] = skin.GetWeight(vertexIndex, currentSkinBone);
12001197
++currentVtxBone;
12011198
}

3ds Max/Max2Babylon/Exporter/BabylonExporter.Skeleton.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -424,28 +424,6 @@ private BabylonBone[] ExportBones(IIGameSkin skin)
424424
bones.Add(bone);
425425
}
426426

427-
// Babylon, nor GLTF do not support single bone skeleton, we may add a root node with no transform.
428-
if( bones.Count == 1)
429-
{
430-
var root = new BabylonBone()
431-
{
432-
id = Guid.NewGuid().ToString(),
433-
parentNodeId = null,
434-
name = "root-bone-added",
435-
index = 0,
436-
parentBoneIndex = -1,
437-
matrix = BabylonMatrix.Identity().m
438-
};
439-
440-
var bone = bones[0];
441-
bone.parentNodeId = root.id;
442-
bone.index = 1;
443-
bone.parentBoneIndex = 0;
444-
445-
bones.Insert(0, root);
446-
}
447-
448-
// finally return the bones.
449427
return bones.ToArray();
450428
}
451429
}

0 commit comments

Comments
 (0)