From 61cbaa72ee9af6c5e1508c060c2eafda3d394f7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me?= Date: Mon, 6 Apr 2020 20:38:09 +0200 Subject: [PATCH] Migrate TestBlenderObjectAnim to new anim system --- .../model/anim/TestBlenderObjectAnim.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/jme3-examples/src/main/java/jme3test/model/anim/TestBlenderObjectAnim.java b/jme3-examples/src/main/java/jme3test/model/anim/TestBlenderObjectAnim.java index 68855176a..b8066dd6a 100644 --- a/jme3-examples/src/main/java/jme3test/model/anim/TestBlenderObjectAnim.java +++ b/jme3-examples/src/main/java/jme3test/model/anim/TestBlenderObjectAnim.java @@ -32,8 +32,9 @@ package jme3test.model.anim; -import com.jme3.animation.AnimChannel; -import com.jme3.animation.AnimControl; +import com.jme3.anim.AnimClip; +import com.jme3.anim.AnimComposer; +import com.jme3.anim.util.AnimMigrationUtils; import com.jme3.app.SimpleApplication; import com.jme3.asset.BlenderKey; import com.jme3.light.DirectionalLight; @@ -45,9 +46,6 @@ import com.jme3.scene.Spatial; public class TestBlenderObjectAnim extends SimpleApplication { - private AnimChannel channel; - private AnimControl control; - public static void main(String[] args) { TestBlenderObjectAnim app = new TestBlenderObjectAnim(); app.start(); @@ -72,10 +70,13 @@ public class TestBlenderObjectAnim extends SimpleApplication { Spatial model = this.findNode(rootNode, "Cube"); model.center(); - control = model.getControl(AnimControl.class); - channel = control.createChannel(); + // Because it's old .blend file need to migrate object. + AnimMigrationUtils.migrate(model); - channel.setAnim("Action"); + AnimComposer animComposer = model.getControl(AnimComposer.class); + animComposer.getAnimClips().forEach(animClip -> System.out.println("AnimClip name: " + animClip.getName())); + AnimClip animClip = animComposer.getAnimClip("Action"); // Action, Action.001 + animComposer.setCurrentAction(animClip.getName()); } /**