Explorar o código

GLTFLoader: Fixes to improve mesh name uniqueness.

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

+ 3 - 5
examples/js/loaders/GLTFLoader.js

@@ -1807,13 +1807,10 @@ THREE.GLTFLoader = ( function () {
 
 		] ).then( function ( dependencies ) {
 
-			return _each( json.meshes, function ( meshDef ) {
+			return _each( json.meshes, function ( meshDef, meshIndex ) {
 
 				var group = new THREE.Group();
 
-				if ( meshDef.name !== undefined ) group.name = meshDef.name;
-				if ( meshDef.extras ) group.userData = meshDef.extras;
-
 				var primitives = meshDef.primitives || [];
 
 				return scope.loadGeometries( primitives ).then( function ( geometries ) {
@@ -1896,7 +1893,8 @@ THREE.GLTFLoader = ( function () {
 
 						}
 
-						mesh.name = group.name + ( i > 0 ? ( '_' + i ) : '' );
+						mesh.name = meshDef.name || ( 'mesh_' + meshIndex );
+						mesh.name += i > 0 ? ( '_' + i ) : '';
 
 						if ( primitive.targets !== undefined ) {