Bug using sequenced actions with new anim system

I spent some time trying to use tweens to call a stopAnimation() method when an action is done, but it seems to cause all layers of the animation rig to bug out and pause half way through playing the next animation, even when the stopAnimation() method is blank.

So either something is wrong with tweens ,or my code below is wrong.

Here was the code I tried using for a non-loop mode that I thought should work.

           if(!loopMode.equals(LoopMode.Loop)){ ///non looping
                Action tempAction = animComposer.action(currentAnimation);
                Tween doneTween = Tweens.callMethod(this, "stopCurrentAnim");
                singleAction = animComposer.actionSequence(currentAnimation + "_nonLooping", tempAction, doneTween);
                
                animComposer.setCurrentAction(currentAnimation + "_nonLooping", layerName);
            }else{
                animComposer.setCurrentAction(currentAnimation, layerName);                
            }

And here is the stop animation method it should call when done.

    public void stopCurrentAnim(){
        
//        if(armatureMask != null){
//            animComposer.removeCurrentAction(layerName);
//        }
//        
//        currentAnimation = null;
    }

I commented out all the code so this method does nothing, but still I get interruptions in the following animations when I use tweens to call the method when an action is done, even on layers that were running an entirely different looping animation the whole time

I’m personally not very invested in solving this because I got things to work without tweens (using timers instead) and the bugginess goes away. But I might use tweens for other stuff in the future so I thought I should at least report this to see if its something I’m doing wrong, or if its an issue with using tweens to call a method after an action.

I have a strong suspicion that there is more going on than what’s been shown.

Just in case, to confirm… if the ONLY Thing you change is removing the “, doneTween” in the below…

Then things stop glitching?

Or does the “doesn’t do anything” doneTween actually have nothing to do with what you are seeing?

There’s just not a lot of magic here that could be causing strange things. So that’s why I think the issue must be elsewhere.

1 Like

Here is how I was changing my code to avoid the glitching, I just commented out all of the tween-related code:

    public void setAnim(String animName) {
        if(hasLayer(animComposer, layerName)){
            currentAnimation = animName;
            
//            if(!loopMode.equals(LoopMode.Loop)){ ///non looping
//                Action tempAction = animComposer.action(currentAnimation);
//                Tween doneTween = Tweens.callMethod(this, "stopCurrentAnim");
//                singleAction = animComposer.actionSequence(currentAnimation + "_nonLooping", tempAction, doneTween);
//                
//                animComposer.setCurrentAction(currentAnimation + "_nonLooping", layerName);
//            }else{
                animComposer.setCurrentAction(currentAnimation, layerName);                
//            }
        }
    }

But as suggested by your reply, I just tried changing the code I originally posted to remove the doneTween from the sequence

Action tempAction = animComposer.action(currentAnimation);
singleAction = animComposer.actionSequence(currentAnimation + "_nonLooping", tempAction);
                
animComposer.setCurrentAction(currentAnimation + "_nonLooping", layerName);

And the glitching persists. So you’re right the doneTween wasn’t casuing it, but instead it seems to be the call to animComposer.actionSequence() or creating the tempAction.