From 30400aad3017a6b82d9e49e988047e747f260abb Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Wed, 20 Mar 2019 10:04:13 -0400 Subject: [PATCH] GLTFExporter: handle morph target attribute specially, per review comment --- examples/js/exporters/GLTFExporter.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/js/exporters/GLTFExporter.js b/examples/js/exporters/GLTFExporter.js index 8644def233..9bbdca54c3 100644 --- a/examples/js/exporters/GLTFExporter.js +++ b/examples/js/exporters/GLTFExporter.js @@ -1162,6 +1162,9 @@ THREE.GLTFExporter.prototype = { var modifiedAttribute = null; for ( var attributeName in geometry.attributes ) { + // Ignore morph target attributes, which are exported later. + if ( attributeName.substr( 0, 5 ) === 'morph' ) continue; + var attribute = geometry.attributes[ attributeName ]; attributeName = nameConversion[ attributeName ] || attributeName.toUpperCase(); @@ -1194,15 +1197,11 @@ THREE.GLTFExporter.prototype = { } - if ( attributeName.substr( 0, 5 ) !== 'MORPH' ) { - - var accessor = processAccessor( modifiedAttribute || attribute, geometry ); - if ( accessor !== null ) { + var accessor = processAccessor( modifiedAttribute || attribute, geometry ); + if ( accessor !== null ) { - attributes[ attributeName ] = accessor; - cachedData.attributes.set( attribute, accessor ); - - } + attributes[ attributeName ] = accessor; + cachedData.attributes.set( attribute, accessor ); } -- GitLab