123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- /**
- * @author mrdoob / http://mrdoob.com/
- */
- Sidebar.Animation = function ( editor ) {
- var signals = editor.signals;
- var options = {};
- var possibleAnimations = {};
- var container = new UI.CollapsiblePanel();
- container.setCollapsed( editor.config.getKey( 'ui/sidebar/animation/collapsed' ) );
- container.onCollapsedChange( function ( boolean ) {
- editor.config.setKey( 'ui/sidebar/animation/collapsed', boolean );
- } );
- container.setDisplay( 'none' );
- container.addStatic( new UI.Text( 'Animation' ).setTextTransform( 'uppercase' ) );
- container.add( new UI.Break() );
- var animationsRow = new UI.Row();
- container.add( animationsRow );
- /*
- var animations = {};
- signals.objectAdded.add( function ( object ) {
- object.traverse( function ( child ) {
- if ( child instanceof THREE.SkinnedMesh ) {
- var material = child.material;
- if ( material instanceof THREE.MultiMaterial ) {
- for ( var i = 0; i < material.materials.length; i ++ ) {
- material.materials[ i ].skinning = true;
- }
- } else {
- child.material.skinning = true;
- }
- animations[ child.id ] = new THREE.Animation( child, child.geometry.animation );
- } else if ( child instanceof THREE.MorphAnimMesh ) {
- var animation = new THREE.MorphAnimation( child );
- animation.duration = 30;
- // temporal hack for THREE.AnimationHandler
- animation._play = animation.play;
- animation.play = function () {
- this._play();
- THREE.AnimationHandler.play( this );
- };
- animation.resetBlendWeights = function () {};
- animation.stop = function () {
- this.pause();
- THREE.AnimationHandler.stop( this );
- };
- animations[ child.id ] = animation;
- }
- } );
- } );
- signals.objectSelected.add( function ( object ) {
- container.setDisplay( 'none' );
- if ( object instanceof THREE.SkinnedMesh || object instanceof THREE.MorphAnimMesh ) {
- animationsRow.clear();
- var animation = animations[ object.id ];
- var playButton = new UI.Button( 'Play' ).onClick( function () {
- animation.play();
- } );
- animationsRow.add( playButton );
- var pauseButton = new UI.Button( 'Stop' ).onClick( function () {
- animation.stop();
- } );
- animationsRow.add( pauseButton );
- container.setDisplay( 'block' );
- }
- } );
- */
- return container;
- }
|