Explorar o código

GLTFLoader: Clean up node pre-processing.

Don McCurdy %!s(int64=7) %!d(string=hai) anos
pai
achega
fdeb2dcafb
Modificáronse 1 ficheiros con 10 adicións e 8 borrados
  1. 10 8
      examples/js/loaders/GLTFLoader.js

+ 10 - 8
examples/js/loaders/GLTFLoader.js

@@ -2230,24 +2230,26 @@ THREE.GLTFLoader = ( function () {
 
 		// Nothing in the node definition indicates whether it is a Bone or an
 		// Object3D. Use the skins' joint references to mark bones.
-		skins.forEach( function ( skin ) {
+		for ( var skinIndex in skins ) {
 
-			skin.joints.forEach( function ( id ) {
+			for ( var jointIndex in skins[ skinIndex ].joints ) {
 
-				nodes[ id ].isBone = true;
+				nodes[ jointIndex ].isBone = true;
 
-			} );
+			}
 
-		} );
+		}
 
 		// Meshes can (and should) be reused by multiple nodes in a glTF asset. To
 		// avoid having more than one THREE.Mesh with the same name, count
 		// references and rename instances below.
 		//
 		// Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
-		nodes.forEach( function ( nodeDef ) {
+		for ( var nodeIndex in nodes ) {
 
-			if ( nodeDef.mesh ) {
+			var nodeDef = nodes[ nodeIndex ];
+
+			if ( nodeDef.mesh !== undefined ) {
 
 				if ( meshReferences[ nodeDef.mesh ] === undefined ) {
 
@@ -2259,7 +2261,7 @@ THREE.GLTFLoader = ( function () {
 
 			}
 
-		} );
+		}
 
 		return scope._withDependencies( [