Browse Source

Merge pull request #12479 from looeee/FBXLoader_fix_undefined_worldMatrices_map_error

Fbx loader fix undefined world matrices map error
Mr.doob 7 years ago
parent
commit
958266472a
1 changed files with 11 additions and 9 deletions
  1. 11 9
      examples/js/loaders/FBXLoader.js

+ 11 - 9
examples/js/loaders/FBXLoader.js

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