Animation loopMode.Dontloop broken ? JME 3.1

Edit: Sorry , I though this was a keybinding issue at first but upon further testing I find the loopmode is broken.

I’m playing an animation.

gameManager.animationManager.play(gameManager.player.node.getName(), "Attack", 1f, LoopMode.DontLoop);

// in function

control.getChannel(i).setLoopMode(loopMode);
control.getChannel(i).setAnim(animation);
control.getChannel(i).setSpeed(speed);

However it doesn’t stop looping. The loopMode doesn’t seem to effect it.

I also use DontLoop with 3.1 and it works.

How are you running your animations.

I’m using the controls created by the importer. Like so

                       control.getChannel(i).setLoopMode(loopMode);
                       control.getChannel(i).setAnim(animation);
                       control.getChannel(i).setSpeed(speed);

Yes exactly that way. I also use the importers added control.

Strange indeed. Are you using the 3.1 beta snapshot ?

hmmmm yes. Maybe try to reproduce your issue in simple isolated test.

I’m curious if it may be just this model. If you change the the loop back mode in the scene explorer play back parameters to dontLoop then play the animation does your scene explorer crash ?

loopmode has to be set after setAnim.
This is something that I hate about our animations, setAnim actually resets the speed and the loopmode.

1 Like

Thank you very much , problem solved.

I spoke too soon. Now it won’t loop. The animations only play once if I set it to loop.

Edit: okay fixed. I had to update a few other things.

Ah then it was just luck in my case. I mean I did it in the right order without knowing :wink:

What other designs would a better fit?

Removing Lines 214 and 215 :stuck_out_tongue:
I mean when the user updates a new animation, he should know that he needs to adopt those values.

On the other hand I guess it’s mostly a SDK Problem, since every user would do like setAnim() and then set parameters for that anim (so that the order makes sence)

For backwards compatibility, we’d have to leave the clearing for a while anyway… or we potentially break some games.

But maybe we could have a setAnim() that takes the parameters it normally resets so the user can set them at the same time. Then gut the old setAnim() to simply call the new one with the values it currently resets… and then document that it does that.

What got me was the tutorial called setAnim before setSpeed so I assumed it was okay.

Yes, that order is fine. setAnim() has to be called first.

I thought it reset the speed too ?

Edit - Never mind , I need my morning coffee. Happy fathers day to all the dads.

1 Like