« Return to Thread: [GreatWhite] DAE and MD2 now implement basic animation

Re: [GreatWhite] DAE and MD2 now implement basic animation

by paperworld :: Rate this Message:

Reply to Author | View in Thread

tim, that's awesome - and not a moment too soon!
 
thanks for putting in the work on this.
 
T

On Thu, May 22, 2008 at 6:23 PM, Tim Knip <tim.knip@...> wrote:
Hi all,

Just added simple animation for DAE and MD2.
Both now implement the IAnimatable interface, which has 2 methods:
1] IAnimatable.play( clip : String = null )  : void; => Starts the
animation (@param clip is mostly used by MD2: md2.play( "run" ),
md2.play( "wave" ), etc.
2] IAnimatable.stop() : void;  => stops the animation

Changes:
1] DAE and MD2 have a new @param 'autoPlay' in their constructors. If
true the animation will start automatically.
2] When file is completely parsed FileLoadEvent.LOAD_COMPLETE is
dispatched (was Event.COMPLETE)
    => NOTE: animation-data still needs to get parsed at this point,
see below...
3] When all animation-data is parsed from the file then
FileLoadEvent.ANIMATIONS_COMPLETE is dispatched.

Usage:
var dae : DAE = new DAE( false );  // lets show when 'autoPlay' is false...
dae.addEventListener( FileLoadEvent.LOAD_COMPLETE, onLoadComplete );
dae.addEventListener( FileLoadEvent.ANIMATIONS_COMPLETE, onAnimationsComplete );
dae.load( "myfile.dae" );
scene.addChild( dae );

private function onAnimationsComplete( event:FileLoadEvent ) : void
{
   if ( event.target is DAE )
   {
       var dae : DAE = event.target as DAE;
       dae.play();
   }
   else if ( event.target is MD2 )
   {
        var md2 : MD2 is event.target as MD2;

        md2.play();
        // or :
        // md2.play( "wave" );  // 'wave' is one of the clips defined
in the md2.
   }
}

private function onLoadComplete( event:FileLoadEvent ) : void
{
  // not used
}

Have fun!
Tim

_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org



--
Trevor Burton
http://www.paperworld3d.com
_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

 « Return to Thread: [GreatWhite] DAE and MD2 now implement basic animation