Skip to content

Commit

Permalink
Merge pull request #20767 from Mugen87/dev41
Browse files Browse the repository at this point in the history
ColladaLoader: Use Object3D.animations.
  • Loading branch information
mrdoob committed Nov 26, 2020
2 parents ecc14fd + f39dc2d commit ba91312
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
1 change: 0 additions & 1 deletion editor/js/Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ function Loader( editor ) {

collada.scene.name = filename;

collada.scene.animations.push( ...collada.animations );
editor.execute( new AddObjectCommand( editor, collada.scene ) );

}, false );
Expand Down
8 changes: 7 additions & 1 deletion examples/js/loaders/ColladaLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3955,6 +3955,7 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
setupKinematics();

var scene = parseScene( getElementsByTagName( collada, 'scene' )[ 0 ] );
scene.animations = animations;

if ( asset.upAxis === 'Z_UP' ) {

Expand All @@ -3965,7 +3966,12 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
scene.scale.multiplyScalar( asset.unit );

return {
animations: animations,
get animations() {

console.warn( 'THREE.ColladaLoader: Please access animations over scene.animations now.' );
return animations;

},
kinematics: kinematics,
library: library,
scene: scene
Expand Down
1 change: 0 additions & 1 deletion examples/jsm/loaders/ColladaLoader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {


export interface Collada {
animations: AnimationClip[];
kinematics: object;
library: object;
scene: Scene;
Expand Down
8 changes: 7 additions & 1 deletion examples/jsm/loaders/ColladaLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3995,6 +3995,7 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
setupKinematics();

var scene = parseScene( getElementsByTagName( collada, 'scene' )[ 0 ] );
scene.animations = animations;

if ( asset.upAxis === 'Z_UP' ) {

Expand All @@ -4005,7 +4006,12 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
scene.scale.multiplyScalar( asset.unit );

return {
animations: animations,
get animations() {

console.warn( 'THREE.ColladaLoader: Please access animations over scene.animations now.' );
return animations;

},
kinematics: kinematics,
library: library,
scene: scene
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_loader_collada_skinning.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
const loader = new ColladaLoader();
loader.load( './models/collada/stormtrooper/stormtrooper.dae', function ( collada ) {

const animations = collada.animations;
const avatar = collada.scene;
const animations = avatar.animations;

avatar.traverse( function ( node ) {

Expand Down

0 comments on commit ba91312

Please sign in to comment.