Bladeren bron

GLTFExporter: Morph Target weights support

Takahiro 7 jaren geleden
bovenliggende
commit
268c22fc5b
1 gewijzigde bestanden met toevoegingen van 5 en 0 verwijderingen
  1. 5 0
      examples/js/exporters/GLTFExporter.js

+ 5 - 0
examples/js/exporters/GLTFExporter.js

@@ -792,6 +792,7 @@ THREE.GLTFExporter.prototype = {
 			// Morph targets
 			if ( mesh.morphTargetInfluences !== undefined && mesh.morphTargetInfluences.length > 0 ) {
 
+				var weights = [];
 				gltfMesh.primitives[ 0 ].targets = [];
 
 				for ( var i = 0; i < mesh.morphTargetInfluences.length; ++ i ) {
@@ -808,8 +809,12 @@ THREE.GLTFExporter.prototype = {
 
 					gltfMesh.primitives[ 0 ].targets.push( target );
 
+					weights.push( mesh.morphTargetInfluences[ i ] );
+
 				}
 
+				gltfMesh.weights = weights;
+
 			}
 
 			outputJSON.meshes.push( gltfMesh );