Browse Source

fixing compile errors.

Ben Houston 10 years ago
parent
commit
0be1e5f552

+ 6 - 6
src/animation/AnimationClip.js

@@ -22,20 +22,20 @@ THREE.AnimationClip.prototype = {
 
 
 	getAt: function( clipTime ) {
 	getAt: function( clipTime ) {
 
 
-		clipTime = Math.max( 0, Math.min( clipTime, duration ) );
+		clipTime = Math.max( 0, Math.min( clipTime, this.duration ) );
 
 
 		var results = {};
 		var results = {};
 
 
 		for( var track in this.tracks ) {
 		for( var track in this.tracks ) {
 
 
-			results[ track.name ] = track.getAt( time );
+			results[ track.name ] = track.getAt( clipTime );
 
 
 		}
 		}
 
 
 		return results;
 		return results;
 	},
 	},
-
-	importFromData: function( data ) {
+/*
+/	importFromData: function( data ) {
 
 
 		// TODO: Convert this copy-paste code from AnimationHandler into an importer into Tracks and AnimationClips with some improvements to the track names
 		// TODO: Convert this copy-paste code from AnimationHandler into an importer into Tracks and AnimationClips with some improvements to the track names
 
 
@@ -151,7 +151,7 @@ THREE.AnimationClip.prototype = {
 
 
 		return data;
 		return data;
 
 
-	}
+	}*/
 };
 };
 
 
 
 
@@ -179,7 +179,7 @@ THREE.AnimationClip.CreateMorphAnimation = function( morphTargetNames, duration
 		}
 		}
 
 
 		var morphName = morphTargetNames[i];
 		var morphName = morphTargetNames[i];
-		var trackName = node.name + '.morphTargetInfluences[' + morphName + ']';
+		var trackName = '.morphTargetInfluences[' + morphName + ']';
 		var track = new THREE.KeyframeTrack( trackName, keys );
 		var track = new THREE.KeyframeTrack( trackName, keys );
 
 
 		tracks.push( track );
 		tracks.push( track );

+ 1 - 1
src/animation/AnimationMixer.js

@@ -77,7 +77,7 @@ THREE.AnimationMixer.prototype = {
 				else {
 				else {
 
 
 					var lerpAlpha = action.weight / ( mixerResult.cumulativeWeight + action.weight );
 					var lerpAlpha = action.weight / ( mixerResult.cumulativeWeight + action.weight );
-					mixerResult.cumulativeValue = AnimationUtils.lerp( mixerResult.cumulativeValue, result.value, lerpAlpha );
+					mixerResult.cumulativeValue = AnimationUtils.lerp( mixerResult.cumulativeValue, actionResult.value, lerpAlpha );
 					mixerResult.cumulativeWeight += action.weight;
 					mixerResult.cumulativeWeight += action.weight;
 
 
 				}
 				}

+ 1 - 1
src/animation/KeyframeTrack.js

@@ -70,6 +70,6 @@ THREE.KeyframeTrack.prototype = {
 
 
 		throw new Error( "should never get here." );
 		throw new Error( "should never get here." );
 
 
-	};
+	}
 
 
 };
 };

+ 13 - 13
src/animation/PropertyBinding.js

@@ -33,14 +33,14 @@ THREE.PropertyBinding.prototype = {
  		// ensure there is a value node
  		// ensure there is a value node
 		if( ! this.node ) {
 		if( ! this.node ) {
 			console.log( "  trying to update node for track: " + this.trackName + " but it wasn't found." );
 			console.log( "  trying to update node for track: " + this.trackName + " but it wasn't found." );
-			continue;
+			return;
 		}
 		}
 
 
  		// ensure there is a value property on the node
  		// ensure there is a value property on the node
 		var nodeProperty = this.node[ this.propertyName ];
 		var nodeProperty = this.node[ this.propertyName ];
 		if( ! nodeProperty ) {
 		if( ! nodeProperty ) {
 			console.log( "  trying to update property for track: " + this.nodeName + '.' + this.propertyName + " but it wasn't found." );				
 			console.log( "  trying to update property for track: " + this.nodeName + '.' + this.propertyName + " but it wasn't found." );				
-			continue;
+			return;
 		}
 		}
 
 
 		// access a sub element of the property array (only primitives are supported right now)
 		// access a sub element of the property array (only primitives are supported right now)
@@ -90,7 +90,7 @@ THREE.PropertyBinding.parseTrackName = function( trackName ) {
 	//    parentName/parentName/nodeName.property[index]
 	//    parentName/parentName/nodeName.property[index]
 	// created and tested via https://regex101.com/#javascript
 	// created and tested via https://regex101.com/#javascript
 
 
-	var re = /^(([\w]+\/)*)([\w-]+)(\.([\w]+)(\[([\w]+)\])?)?$/; 
+	var re = /^(([\w]+\/)*)([\w-]+)?(\.([\w]+)(\[([\w]+)\])?)?$/; 
 	var matches = re.exec(trackName);
 	var matches = re.exec(trackName);
 
 
 	if( ! matches ) {
 	if( ! matches ) {
@@ -102,13 +102,13 @@ THREE.PropertyBinding.parseTrackName = function( trackName ) {
     }
     }
 
 
 	var results = {
 	var results = {
-		directoryName: m[0],
-		nodeName: m[2], 	// allowed to be null, specified root node.
-		propertyName: m[4],
-		propertySubElement: m[6]	// allowed to be null, specifies that the whole property is set.
+		directoryName: matches[0],
+		nodeName: matches[2], 	// allowed to be null, specified root node.
+		propertyName: matches[4],
+		propertySubElement: matches[6]	// allowed to be null, specifies that the whole property is set.
 	};
 	};
 
 
-	console.log( "PropertyBinding.parseTrackName", trackName, results );
+	console.log( "PropertyBinding.parseTrackName", trackName, results, matches );
 
 
 	if( results.propertyName === null || results.propertyName.length === 0 ) {
 	if( results.propertyName === null || results.propertyName.length === 0 ) {
 		throw new Error( "can not parse propertyName from trackName: " + trackName );
 		throw new Error( "can not parse propertyName from trackName: " + trackName );
@@ -141,7 +141,7 @@ THREE.PropertyBinding.findNode = function( root, nodeName ) {
 
 
 				if( bone.name === nodeName ) {
 				if( bone.name === nodeName ) {
 
 
-					return childNode;
+					return bone;
 
 
 				}
 				}
 			}
 			}
@@ -150,12 +150,12 @@ THREE.PropertyBinding.findNode = function( root, nodeName ) {
 
 
 		};
 		};
 
 
-		var boneNode = searchSkeleton( root.skeleton );
+		var bone = searchSkeleton( root.skeleton );
 
 
-		if( boneNode ) {
+		if( bone ) {
 
 
 			console.log( '  bone: ' + bone.name + '.' );
 			console.log( '  bone: ' + bone.name + '.' );
-			return boneNode;
+			return bone;
 
 
 		}
 		}
 	}
 	}
@@ -196,7 +196,7 @@ THREE.PropertyBinding.findNode = function( root, nodeName ) {
 
 
 	}
 	}
 
 
-	console.log( "   <null>.  No node found for name: " + name );
+	console.log( "   <null>.  No node found for name: " + nodeName );
 
 
 	return null;
 	return null;
 }
 }