提交 e5b6981c 编写于 作者: M Mr.doob

GLTFLoader: Reverted animations to clips rename. See 9aab3c6b.

上级 d908b3e9
......@@ -54,14 +54,14 @@ THREE.GLTFLoader = ( function () {
} );
parser.parse( function ( scene, cameras, clips ) {
parser.parse( function ( scene, cameras, animations ) {
console.timeEnd( 'GLTFLoader' );
var glTF = {
"scene": scene,
"cameras": cameras,
"clips": clips
"animations": animations
};
callback( glTF );
......@@ -243,7 +243,8 @@ THREE.GLTFLoader = ( function () {
/* ANIMATION */
function createClip( name, interps ) {
function createAnimation( name, interps ) {
var tracks = [];
for ( var i = 0, len = interps.length; i < len; i ++ ) {
......@@ -265,9 +266,11 @@ THREE.GLTFLoader = ( function () {
interp.values,
interp.type
) );
}
return new THREE.AnimationClip( name, undefined, tracks );
}
/*********************************/
......@@ -609,7 +612,7 @@ THREE.GLTFLoader = ( function () {
"scenes",
"cameras",
"clips"
"animations"
] ).then( function ( dependencies ) {
......@@ -624,16 +627,15 @@ THREE.GLTFLoader = ( function () {
}
var clips = [];
var animations = [];
for ( var name in dependencies.clips ) {
for ( var name in dependencies.animations ) {
var clip = dependencies.clips[ name ];
clips.push( clip );
animations.push( dependencies.animations[ name ] );
}
callback( scene, cameras, clips);
callback( scene, cameras, animations );
}.bind( this ) );
......@@ -1246,9 +1248,7 @@ THREE.GLTFLoader = ( function () {
};
GLTFParser.prototype.loadClips = function () {
GLTFParser.prototype.loadAnimations = function () {
var scope = this;
......@@ -1298,7 +1298,7 @@ THREE.GLTFLoader = ( function () {
}
return createClip( "animation_" + animationId, interps );
return createAnimation( "animation_" + animationId, interps );
} );
......
......@@ -314,19 +314,25 @@
}
if (gltf.clips && gltf.clips.length) {
var animations = gltf.animations;
mixer = new THREE.AnimationMixer(object);
if ( animations && animations.length ) {
mixer = new THREE.AnimationMixer( object );
for ( var i = 0; i < animations.length; i ++ ) {
var animation = animations[ i ];
var i, len = gltf.clips.length;
for (i = 0; i < len; i++) {
var clip = gltf.clips[i];
// There's .3333 seconds junk at the tail of the Monster animation that
// keeps it from looping cleanly. Clip it at 3 seconds
if (sceneInfo.animationTime)
clip.duration = sceneInfo.animationTime;
mixer.clipAction(clip).play();
// keeps it from looping cleanly. Animation it at 3 seconds
if ( sceneInfo.animationTime )
animation.duration = sceneInfo.animationTime;
mixer.clipAction( animation ).play();
}
}
scene.add( object );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册