AnimationEnd Callback not called for 1 frame animation

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
n00bc0de
Posts: 133
Joined: Tue Oct 04, 2022 1:21 am

AnimationEnd Callback not called for 1 frame animation

Post by n00bc0de »

I have an animation that is 1 frame: It starts on frame 70 and ends on frame 70 and I have set the animation speed to 1 frame per second.

I expect the callback to be called after 1 second but it doesn't trigger unless I have atleast 2 frames. Is there a way to have 1 frame and still get this to work?
CuteAlien
Admin
Posts: 10021
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: AnimationEnd Callback not called for 1 frame animation

Post by CuteAlien »

That's probably tricky to fix. You can look at the code in CAnimatedMeshSceneNode::buildFrameNr where it runs that callback. Basically StartFrame==EndFrame is already a special case.
Maybe you can just add 1 still-frame to your animation then you can use that.
Or maybe you need a setLoopMode with a timer? That would be relatively easy to patch I guess?
Or do you have any other patch ideas?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
n00bc0de
Posts: 133
Joined: Tue Oct 04, 2022 1:21 am

Re: AnimationEnd Callback not called for 1 frame animation

Post by n00bc0de »

I did just add a frame of animation to it. To be honest, I was never going to use the single frame of animation in my final build but I was using here for testing other stuff. If StartFrame==EndFrame is already a special case then maybe there is something else I am doing that I am not aware of. I will dig into my code further to see. If you end up patching it, please let me know and I will go on head and pull your latest changes. Thanks for the reply.
CuteAlien
Admin
Posts: 10021
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: AnimationEnd Callback not called for 1 frame animation

Post by CuteAlien »

Well, not patching this case - as it looks correct to me. But if you need something like a paused animation - like a timed loop - that can be added. Depends a bit what the use-case is here.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply