From ff50ff1d4b4df856b9b2979dd2df53085f175378 Mon Sep 17 00:00:00 2001 From: Don McCurdy Date: Sat, 17 Jun 2017 09:22:44 -0700 Subject: [PATCH] [gltf] Use skins directly, don't iterate nodes. --- examples/js/loaders/GLTF2Loader.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/examples/js/loaders/GLTF2Loader.js b/examples/js/loaders/GLTF2Loader.js index d4daa7cf7deb35..2d6616d2db83f8 100644 --- a/examples/js/loaders/GLTF2Loader.js +++ b/examples/js/loaders/GLTF2Loader.js @@ -2532,22 +2532,18 @@ THREE.GLTF2Loader = ( function () { var scope = this; var nodes = json.nodes || []; + var skins = json.skins || []; // Nothing in the node definition indicates whether it is a Bone or an - // Object3D. So, traverse the hierarchy once in advance, using node.skins - // references to mark bones. - nodes.forEach( function ( node ) { + // Object3D. Use the skins' joint references to mark bones. + skins.forEach( function ( skin ) { - if ( node.skin !== undefined ) { - - json.skins[ node.skin ].joints.forEach( function ( id ) { + skin.joints.forEach( function ( id ) { nodes[ id ].isBone = true; } ); - } - } ); return _each( json.nodes, function ( node ) {