浏览代码

fix obvious bugs.

Ben Houston 10 年之前
父节点
当前提交
e3604c6e53
共有 1 个文件被更改,包括 11 次插入7 次删除
  1. 11 7
      src/animation/AnimationMixer.js

+ 11 - 7
src/animation/AnimationMixer.js

@@ -13,8 +13,7 @@ THREE.AnimationMixer = function( root ) {
 	this.time = 0;
 	this.timeScale = 1.0;
 	this.actions = [];
-	this.propertyBindings = {};
-	this.propertyBindingsArray = [];
+	this.propertyBindings = [];
 
 };
 
@@ -33,15 +32,20 @@ THREE.AnimationMixer.prototype = {
 
 			var track = tracks[ i ];
 
-			var propertyBinding = this.propertyBindings[ track.name ];
+			var j = this.getPropertyBindingIndex( track.name )
 
-			if( ! this.propertyBindings[ track.name ] ) {
+			var propertyBinding;
+
+			if( j < 0 ) {
 			
 				propertyBinding = new THREE.PropertyBinding( this.root, track.name );
-				this.propertyBindingsArray.push( propertyBinding );
+				this.propertyBindings.push( propertyBinding );
 			
 			}
-
+			else {
+				propertyBinding = this.propertyBindings[ j ];
+			}
+			
 			// track usages of shared property bindings, because if we leave too many around, the mixer can get slow
 			propertyBinding.referenceCount += 1;
 
@@ -92,7 +96,7 @@ THREE.AnimationMixer.prototype = {
 		}
 
 		// unbind all property bindings
-		for( var i = 0; i < this.propertyBindingsArray.length; i ++ ) {
+		for( var i = 0; i < this.propertyBindings.length; i ++ ) {
 
 			this.propertyBindings[i].unbind();