Forráskód Böngészése

PropertyBinding: Added morphTarget support with BufferGeometry

Mugen87 8 éve
szülő
commit
f375cf243b
1 módosított fájl, 33 hozzáadás és 8 törlés
  1. 33 8
      src/animation/PropertyBinding.js

+ 33 - 8
src/animation/PropertyBinding.js

@@ -616,19 +616,44 @@ Object.assign( PropertyBinding.prototype, { // prototype, continued
 
 				}
 
-				if ( ! targetObject.geometry.morphTargets ) {
+				if ( targetObject.geometry.isBufferGeometry ) {
 
-					console.error( '  can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets', this );
-					return;
+					if ( ! targetObject.geometry.morphAttributes ) {
 
-				}
+						console.error( '  can not bind to morphTargetInfluences becasuse node does not have a geometry.morphAttributes', this );
+						return;
+
+					}
+
+					for ( var i = 0; i < this.node.geometry.morphAttributes.position.length; i ++ ) {
 
-				for ( var i = 0; i < this.node.geometry.morphTargets.length; i ++ ) {
+						if ( targetObject.geometry.morphAttributes.position[ i ].name === propertyIndex ) {
+
+							propertyIndex = i;
+							break;
+
+						}
+
+					}
 
-					if ( targetObject.geometry.morphTargets[ i ].name === propertyIndex ) {
 
-						propertyIndex = i;
-						break;
+				} else {
+
+					if ( ! targetObject.geometry.morphTargets ) {
+
+						console.error( '  can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets', this );
+						return;
+
+					}
+
+					for ( var i = 0; i < this.node.geometry.morphTargets.length; i ++ ) {
+
+						if ( targetObject.geometry.morphTargets[ i ].name === propertyIndex ) {
+
+							propertyIndex = i;
+							break;
+
+						}
 
 					}