Browse Source

FBXLoader fix undefined worldmatrices map error, better checking for bind pose node

Lewy Blue 7 years ago
parent
commit
513daa9adb
1 changed files with 12 additions and 10 deletions
  1. 12 10
      examples/js/loaders/FBXLoader.js

+ 12 - 10
examples/js/loaders/FBXLoader.js

@@ -1932,22 +1932,24 @@
 		// Now with the bones created, we can update the skeletons and bind them to the skinned meshes.
 		// Now with the bones created, we can update the skeletons and bind them to the skinned meshes.
 		sceneGraph.updateMatrixWorld( true );
 		sceneGraph.updateMatrixWorld( true );
 
 
-		// Put skeleton into bind pose.
-		var BindPoseNode = FBXTree.Objects.subNodes.Pose;
-		for ( var nodeID in BindPoseNode ) {
+		var worldMatrices = new Map();
 
 
-			if ( BindPoseNode[ nodeID ].attrType === 'BindPose' ) {
+    // Put skeleton into bind pose.
+		if ( 'Pose' in FBXTree.Objects.subNodes ) {
 
 
-				BindPoseNode = BindPoseNode[ nodeID ];
-				break;
+			var BindPoseNode = FBXTree.Objects.subNodes.Pose;
+			for ( var nodeID in BindPoseNode ) {
 
 
-			}
+				if ( BindPoseNode[ nodeID ].attrType === 'BindPose' ) {
 
 
-		}
-		if ( BindPoseNode ) {
+					BindPoseNode = BindPoseNode[ nodeID ];
+					break;
+
+				}
+
+			}
 
 
 			var PoseNode = BindPoseNode.subNodes.PoseNode;
 			var PoseNode = BindPoseNode.subNodes.PoseNode;
-			var worldMatrices = new Map();
 
 
 			for ( var PoseNodeIndex = 0, PoseNodeLength = PoseNode.length; PoseNodeIndex < PoseNodeLength; ++ PoseNodeIndex ) {
 			for ( var PoseNodeIndex = 0, PoseNodeLength = PoseNode.length; PoseNodeIndex < PoseNodeLength; ++ PoseNodeIndex ) {