Skip to content

Commit 235ad02

Browse files
authored
Save bone as relevant when single (#1022)
1 parent 306587a commit 235ad02

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,18 @@ private List<IIGameNode> GetSkinnedBones(IIGameSkin skin)
9494
}
9595

9696
// Babylon format assumes skeleton root is at origin, add any additional node parents from the lowest common ancestor to the scene root to the skeleton hierarchy.
97-
while (lowestCommonAncestor.NodeParent != null)
97+
allHierarchyNodes.Add(lowestCommonAncestor);
98+
if (lowestCommonAncestor.NodeParent != null)
9899
{
99-
lowestCommonAncestor = lowestCommonAncestor.NodeParent;
100-
allHierarchyNodes.Add(lowestCommonAncestor);
101-
}
100+
do {
101+
lowestCommonAncestor = lowestCommonAncestor.NodeParent;
102+
allHierarchyNodes.Add(lowestCommonAncestor);
103+
} while (lowestCommonAncestor.NodeParent != null) ;
104+
}
102105

103106
// starting from the root, sort the nodes by depth first (add the children before the siblings)
104107
List<IIGameNode> sorted = new List<IIGameNode>();
105-
Stack<IIGameNode> siblings = new Stack<IIGameNode>(); // keep the siblings in a LIFO list to add them after the children
108+
Stack<IIGameNode> siblings = new Stack<IIGameNode>(); // keep the siblings in a LIFO list to add them after the children
106109
siblings.Push(lowestCommonAncestor);
107110

108111
// add the skeletonroot:

0 commit comments

Comments
 (0)