Don McCurdy 6 年 前
コミット
57a6b073ed

+ 9 - 6
src/animation/AnimationUtils.js

@@ -1,3 +1,6 @@
+import { PropertyBinding } from './PropertyBinding.js';
+import { InterpolateLinear } from '../constants.js';
+
 /**
  * @author tschw
  * @author Ben Houston / http://clara.io/
@@ -253,8 +256,8 @@ var AnimationUtils = {
 		for ( var i = 0; i < sourceTracks.length; ++ i ) {
 
 			var sourceTrack = sourceTracks[ i ];
-			var sourceTrackBinding = THREE.PropertyBinding.parseTrackName( sourceTrack.name );
-			var sourceTrackNode = THREE.PropertyBinding.findNode( root, sourceTrackBinding.nodeName );
+			var sourceTrackBinding = PropertyBinding.parseTrackName( sourceTrack.name );
+			var sourceTrackNode = PropertyBinding.findNode( root, sourceTrackBinding.nodeName );
 
 			if ( sourceTrackBinding.propertyName !== 'morphTargetInfluences' ) {
 
@@ -271,14 +274,14 @@ var AnimationUtils = {
 
 					// This should never happen, because glTF morph target animations
 					// affect all targets already.
-					throw new Error( 'THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.' );
+					throw new Error( 'THREE.AnimationUtils: Cannot merge tracks with glTF CUBICSPLINE interpolation.' );
 
 				}
 
-				console.warn( 'THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead.' );
+				console.warn( 'THREE.AnimationUtils: Morph target interpolation mode not yet supported. Using LINEAR instead.' );
 
 				sourceTrack = sourceTrack.clone();
-				sourceTrack.setInterpolation( THREE.InterpolateLinear );
+				sourceTrack.setInterpolation( InterpolateLinear );
 
 			}
 
@@ -336,7 +339,7 @@ var AnimationUtils = {
 			// be written again, but keyframes are de-duplicated.
 			for ( var j = 0; j < sourceTrack.times.length; j ++ ) {
 
-				var keyframeIndex = THREE.AnimationUtils.insertKeyframe( mergedTrack, sourceTrack.times[ j ] );
+				var keyframeIndex = AnimationUtils.insertKeyframe( mergedTrack, sourceTrack.times[ j ] );
 				mergedTrack.values[ keyframeIndex * targetCount + targetIndex ] = sourceTrack.values[ j ];
 
 			}

+ 10 - 5
test/unit/src/animation/AnimationUtils.tests.js

@@ -3,7 +3,12 @@
  */
 /* global QUnit */
 
+import { AnimationClip } from '../../../../src/animation/AnimationClip';
 import { AnimationUtils } from '../../../../src/animation/AnimationUtils';
+import { BufferAttribute } from '../../../../src/core/BufferAttribute';
+import { BufferGeometry } from '../../../../src/core/BufferGeometry';
+import { Mesh } from '../../../../src/objects/Mesh';
+import { Object3D } from '../../../../src/core/Object3D';
 import { NumberKeyframeTrack } from '../../../../src/animation/tracks/NumberKeyframeTrack';
 import { VectorKeyframeTrack } from '../../../../src/animation/tracks/VectorKeyframeTrack';
 import {
@@ -86,20 +91,20 @@ export default QUnit.module( 'Animation', () => {
 				InterpolateLinear
 			);
 
-			var geometry = new THREE.BufferGeometry();
-			var position = new THREE.BufferAttribute( new Float32Array( [ 0, 0, 0, 0, 0, 1, 1, 0, 1 ] ), 3 );
+			var geometry = new BufferGeometry();
+			var position = new BufferAttribute( new Float32Array( [ 0, 0, 0, 0, 0, 1, 1, 0, 1 ] ), 3 );
 			geometry.addAttribute( 'position',  position );
 			geometry.morphAttributes.position = [ position, position ];
 
-			var mesh = new THREE.Mesh( geometry );
+			var mesh = new Mesh( geometry );
 			mesh.name = 'foo';
 			mesh.morphTargetDictionary.a = 0;
 			mesh.morphTargetDictionary.b = 1;
 
-			var root = new THREE.Object3D();
+			var root = new Object3D();
 			root.add( mesh );
 
-			var clip = new THREE.AnimationClip( 'waltz', undefined, [ trackA, trackB ] );
+			var clip = new AnimationClip( 'waltz', undefined, [ trackA, trackB ] );
 			clip = AnimationUtils.mergeMorphTargetTracks( clip, root );
 
 			assert.equal( clip.tracks.length, 1, 'tracks are merged' );