public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { if(channel.getLoopMode() == LoopMode.DontLoop) { channel.reset(true); } }
if (action.equals(SpatialAnimMgr.ControlAction.PLAY)) { myLogger.info("Playing thing animation {}", uri); LoopMode desiredLoopMode = channel.getLoopMode(); channel.setAnim(uri.getLocalName(), 0f);
@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(); } } }
if (animControl != null) { // Not all are anims AnimChannel channel = animControl.getChannel(0); LoopMode loopMode = channel.getLoopMode(); channel.setAnim(ANIM_NAME, 0); if (loopMode != null) {
@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); }