Browse Source

Removed protection of external names.

tschw 9 years ago
parent
commit
326c6d98ed
3 changed files with 13 additions and 13 deletions
  1. 3 3
      src/animation/AnimationClip.js
  2. 2 2
      src/animation/AnimationUtils.js
  3. 8 8
      src/animation/KeyframeTrack.js

+ 3 - 3
src/animation/AnimationClip.js

@@ -68,8 +68,8 @@ Object.assign( THREE.AnimationClip, {
 	parse: function( json ) {
 
 		var tracks = [],
-			jsonTracks = json[ 'tracks' ],
-			frameTime = 1.0 / ( json[ 'fps' ] || 1.0 );
+			jsonTracks = json.tracks,
+			frameTime = 1.0 / ( json.fps || 1.0 );
 
 		for ( var i = 0, n = jsonTracks.length; i !== n; ++ i ) {
 
@@ -77,7 +77,7 @@ Object.assign( THREE.AnimationClip, {
 
 		}
 
-		return new THREE.AnimationClip( json[ 'name' ], json[ 'duration' ], tracks );
+		return new THREE.AnimationClip( json.name, json.duration, tracks );
 
 	},
 

+ 2 - 2
src/animation/AnimationUtils.js

@@ -25,7 +25,7 @@ THREE.AnimationUtils = {
 		if ( ! array || // let 'undefined' and 'null' pass
 				! forceClone && array.constructor === type ) return array;
 
-		if ( typeof type[ 'BYTES_PER_ELEMENT' ] === 'number' ) {
+		if ( typeof type.BYTES_PER_ELEMENT === 'number' ) {
 
 			return new type( array ); // create typed array
 
@@ -116,7 +116,7 @@ THREE.AnimationUtils = {
 
 			} while ( key !== undefined );
 
-		} else if ( value[ 'toArray' ] !== undefined ) {
+		} else if ( value.toArray !== undefined ) {
 			// ...assume THREE.Math-ish
 
 			do {

+ 8 - 8
src/animation/KeyframeTrack.js

@@ -386,7 +386,7 @@ Object.assign( THREE.KeyframeTrack, {
 
 	parse: function( json ) {
 
-		if( json[ 'type' ] === undefined ) {
+		if( json.type === undefined ) {
 
 			throw new Error( "track type undefined, can not parse" );
 
@@ -394,16 +394,16 @@ Object.assign( THREE.KeyframeTrack, {
 
 		var trackType = THREE.KeyframeTrack._getTrackTypeForValueTypeName( json.type );
 
-		if ( json[ 'times' ] === undefined ) {
+		if ( json.times === undefined ) {
 
 			console.warn( "legacy JSON format detected, converting" );
 
 			var times = [], values = [];
 
-			THREE.AnimationUtils.flattenJSON( json[ 'keys' ], times, values, 'value' );
+			THREE.AnimationUtils.flattenJSON( json.keys, times, values, 'value' );
 
-			json[ 'times' ] = times;
-			json[ 'values' ] = values;
+			json.times = times;
+			json.values = values;
 
 		}
 
@@ -416,7 +416,7 @@ Object.assign( THREE.KeyframeTrack, {
 
 			// by default, we asssume a constructor compatible with the base
 			return new trackType(
-					json[ 'name' ], json[ 'times' ], json[ 'values' ], json[ 'interpolation' ] );
+					json.name, json.times, json.values, json.interpolation );
 
 		}
 
@@ -448,13 +448,13 @@ Object.assign( THREE.KeyframeTrack, {
 
 			if ( interpolation !== track.DefaultInterpolation ) {
 
-				json[ 'interpolation' ] = interpolation;
+				json.interpolation = interpolation;
 
 			}
 
 		}
 
-		json[ 'type' ] = track.ValueTypeName; // mandatory
+		json.type = track.ValueTypeName; // mandatory
 
 		return json;