int numChannels = model.getControl(AnimControl.class).getNumChannels(); for(int i = 0; i < numChannels; i++){ ((HashMap<Integer, AnimChannel>)s).put(i, model.getControl(AnimControl.class).getChannel(i));
private static void setAnimSpeeds(Node node, float speed) { for (Spatial child : node.getChildren()) { AnimControl animControl = child.getControl(AnimControl.class); if (animControl != null) { animControl.getChannel(0).setSpeed(speed); } } }
int numChannels = model.getControl(AnimControl.class).getNumChannels(); for(int i = 0; i < numChannels; i++){ ((HashMap<Integer, AnimChannel>)s).put(i, model.getControl(AnimControl.class).getChannel(i));
spat.setCullHint(Spatial.CullHint.Inherit); if (animControl != null) { // Not all are anims AnimChannel channel = animControl.getChannel(0); LoopMode loopMode = channel.getLoopMode(); channel.setAnim(ANIM_NAME, 0);
@Override public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { // Start the real animation Spatial spat = root.getChild(resource.getName()); AnimControl animControl = spat.getControl(AnimControl.class); spat.setCullHint(Spatial.CullHint.Inherit); AnimChannel c = animControl.getChannel(0); LoopMode loopMode = c.getLoopMode(); c.setAnim(ANIM_NAME, 0); if (loopMode != null) { c.setLoopMode(loopMode); } animControl.setEnabled(true); // Hide us control.setEnabled(false); control.getSpatial().setCullHint(Spatial.CullHint.Always); }
@Override public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { cyclesCount++; // Signal that the main animation cycle is done animationControl.onAnimationCycleDone(); // See if we need to stop if (animationControl.isStopAnimation() || channel.getLoopMode() == LoopMode.DontLoop) { // Stop us control.setEnabled(false); // We need to stop if (resource.getFlags().contains(ArtResource.ArtResourceFlag.HAS_END_ANIMATION)) { // Hide us control.getSpatial().setCullHint(Spatial.CullHint.Always); Spatial spat = root.getChild(END_ANIMATION_NAME); AnimControl animControl = spat.getControl(AnimControl.class); spat.setCullHint(Spatial.CullHint.Inherit); AnimChannel c = animControl.getChannel(0); LoopMode loopMode = c.getLoopMode(); c.setAnim(ANIM_NAME, 0); if (loopMode != null) { c.setLoopMode(loopMode); } animControl.setEnabled(true); } else { // Signal stop animationControl.onAnimationStop(); } } }