3232
3333package jme3test .model .anim ;
3434
35- import com .jme3 .animation .AnimChannel ;
36- import com .jme3 .animation .AnimControl ;
35+ import com .jme3 .anim .AnimClip ;
36+ import com .jme3 .anim .AnimComposer ;
37+ import com .jme3 .anim .util .AnimMigrationUtils ;
3738import com .jme3 .app .SimpleApplication ;
3839import com .jme3 .asset .BlenderKey ;
3940import com .jme3 .light .DirectionalLight ;
4546
4647public class TestBlenderObjectAnim extends SimpleApplication {
4748
48- private AnimChannel channel ;
49- private AnimControl control ;
50-
5149 public static void main (String [] args ) {
5250 TestBlenderObjectAnim app = new TestBlenderObjectAnim ();
5351 app .start ();
@@ -72,10 +70,13 @@ public void simpleInitApp() {
7270 Spatial model = this .findNode (rootNode , "Cube" );
7371 model .center ();
7472
75- control = model . getControl ( AnimControl . class );
76- channel = control . createChannel ( );
73+ // Because it's old .blend file need to migrate object.
74+ AnimMigrationUtils . migrate ( model );
7775
78- channel .setAnim ("Action" );
76+ AnimComposer animComposer = model .getControl (AnimComposer .class );
77+ animComposer .getAnimClips ().forEach (animClip -> System .out .println ("AnimClip name: " + animClip .getName ()));
78+ AnimClip animClip = animComposer .getAnimClip ("Action" ); // Action, Action.001
79+ animComposer .setCurrentAction (animClip .getName ());
7980 }
8081
8182 /**
0 commit comments