ソースを参照

GLTFLoader: Fix morph target parsing. (#33020)

Michael Herzog 4 日 前
コミット
29c9a7ac1f
1 ファイル変更16 行追加5 行削除
  1. 16 5
      examples/jsm/loaders/GLTFLoader.js

+ 16 - 5
examples/jsm/loaders/GLTFLoader.js

@@ -4512,17 +4512,28 @@ class GLTFParser {
 		const targetName = node.name ? node.name : node.uuid;
 		const targetNames = [];
 
+		function collectMorphTargets( object ) {
+
+			if ( object.morphTargetInfluences ) {
+
+				targetNames.push( object.name ? object.name : object.uuid );
+
+			}
+
+		}
+
+
 		if ( PATH_PROPERTIES[ target.path ] === PATH_PROPERTIES.weights ) {
 
-			node.traverse( function ( object ) {
+			collectMorphTargets( node );
 
-				if ( object.morphTargetInfluences ) {
+			// for multi-primitive meshes, the node is a Group containing the sub-meshes
 
-					targetNames.push( object.name ? object.name : object.uuid );
+			if ( node.isGroup ) {
 
-				}
+				node.children.forEach( collectMorphTargets );
 
-			} );
+			}
 
 		} else {
 

粤ICP备19079148号