Преглед изворни кода

Fixed webgl_animation_skinning_blending example.

Mr.doob пре 11 година
родитељ
комит
519df502a5

+ 1 - 3
editor/js/Sidebar.Animation.js

@@ -38,9 +38,7 @@ Sidebar.Animation = function ( editor ) {
 
 				}
 
-				console.log( child.geometry );
-
-				animations[ child.id ] = new THREE.Animation( child );
+				animations[ child.id ] = new THREE.Animation( child, child.geometry.animation );
 
 			}
 

+ 2 - 4
examples/js/BlendCharacter.js

@@ -8,7 +8,7 @@ THREE.BlendCharacter = function () {
 	this.weightSchedule = [];
 	this.warpSchedule = [];
 
-	this.load = function( url, onLoad ) {
+	this.load = function ( url, onLoad ) {
 
 		var scope = this;
 
@@ -24,10 +24,8 @@ THREE.BlendCharacter = function () {
 
 			for ( var i = 0; i < geometry.animations.length; ++i ) {
 
-				THREE.AnimationHandler.add( geometry.animations[ i ] );
-
 				var animName = geometry.animations[ i ].name;
-				scope.animations[ animName ] = new THREE.Animation( scope, animName );
+				scope.animations[ animName ] = new THREE.Animation( scope, geometry.animations[ i ] );
 
 			}
 

+ 1 - 3
examples/webgl_animation_skinning_morph.html

@@ -207,8 +207,6 @@
 				geometry.computeBoundingBox();
 				var bb = geometry.boundingBox;
 
-				THREE.AnimationHandler.add( geometry.animation );
-
 				var path = "textures/cube/Park2/";
 				var format = '.jpg';
 				var urls = [
@@ -261,7 +259,7 @@
 				helper.visible = false;
 				scene.add( helper );
 
-				var animation = new THREE.Animation( mesh, geometry.animation.name );
+				var animation = new THREE.Animation( mesh, geometry.animation );
 				animation.play();
 
 			}

+ 1 - 1
examples/webgl_loader_collada.html

@@ -59,7 +59,7 @@
 
 					if ( child instanceof THREE.SkinnedMesh ) {
 
-						var animation = new THREE.Animation( child );
+						var animation = new THREE.Animation( child, child.geometry.animation );
 						animation.play();
 
 					}

+ 1 - 1
examples/webgl_loader_collada_skinning.html

@@ -86,7 +86,7 @@
 
 						if ( child instanceof THREE.SkinnedMesh ) {
 
-							var animation = new THREE.Animation( child );
+							var animation = new THREE.Animation( child, child.geometry.animation );
 							animation.play();
 
 							camera.lookAt( child.position );

+ 1 - 1
examples/webgl_loader_json_blender.html

@@ -70,7 +70,7 @@
 
 					if ( child instanceof THREE.SkinnedMesh ) {
 
-						var animation = new THREE.Animation( child );
+						var animation = new THREE.Animation( child, child.geometry.animation );
 						animation.play();
 
 					}

+ 1 - 3
examples/webgl_loader_scene.html

@@ -328,9 +328,7 @@
 
 							if ( object.geometry.animation ) {
 
-								THREE.AnimationHandler.add( object.geometry.animation );
-
-								var animation = new THREE.Animation( object, object.geometry.animation.name );
+								var animation = new THREE.Animation( object, object.geometry.animation );
 								animation.play();
 
 							}

+ 2 - 2
src/extras/animation/Animation.js

@@ -4,10 +4,10 @@
  * @author alteredq / http://alteredqualia.com/
  */
 
-THREE.Animation = function ( root ) {
+THREE.Animation = function ( root, data ) {
 
 	this.root = root;
-	this.data = THREE.AnimationHandler.init( root.geometry.animation );
+	this.data = THREE.AnimationHandler.init( data );
 	this.hierarchy = THREE.AnimationHandler.parse( root );
 
 	this.currentTime = 0;