Page 1 of 1
Add ability to draw_animation to stop on last frame
Posted: Wed Jul 31, 2019 10:23 am
by rude_grass
Add a flag to LuaRendering.draw_animation that makes the animation stop on the last (or a specified) frame and display this frame indefinitely.
Usecase: I want to use draw_animation calls to add custom animations to a modded inserter and would like the animation to stop at each of the two endpoints (picking up/dropping off) until i invoke a new draw call when the state changes again.
Re: Add ability to draw_animation to stop on last frame
Posted: Wed Aug 14, 2019 4:34 pm
by rude_grass
while i guess no answer probably means no, could i get a feedback on if this might happen or not?
This would help me with deciding how to implement the wanted behavior.
Re: Add ability to draw_animation to stop on last frame
Posted: Wed Aug 14, 2019 6:31 pm
by mat1k
No answer could also mean they are still looking to see how feasible it is to add. It may need complex code or have a significant performance impact that needs investigating first.
Re: Add ability to draw_animation to stop on last frame
Posted: Wed Aug 14, 2019 8:22 pm
by Boodals
Something like this would be pretty easy to add, it just isn't a high priority. Your use case is very specific and pretty hacky, plus the devs are going for stable at the moment so they are more hesitant to implement new features.
I recommend trying to find another solution for your issue for now, then if it gets implemented in the future you can decide what method is better.
Re: Add ability to draw_animation to stop on last frame
Posted: Wed Aug 14, 2019 8:25 pm
by Bilka
Boodals says it pretty well. The request raises the question of "how would this be useful for anything else". Since you can just spawn a sprite when the animation ends, so you can already do what you want, I am not seeing anything that would convince me to add this.
Another option for you is to set the animation speed to 0 and then animation offset to your frame count once the animation is "over".
Re: Add ability to draw_animation to stop on last frame
Posted: Wed Aug 14, 2019 9:01 pm
by rude_grass
Bilka wrote: Wed Aug 14, 2019 8:25 pm
Since you can just spawn a sprite when the animation ends, so you can already do what you want, I am not seeing anything that would convince me to add this.
i can do that but it requires me too track the state of all animations continuously. my thought was that since the animation itself already knows at which frame it currently is, it would be better performance wise to just have the animation stop at a given frame than me adding a lot of overhead for tracking its state.
for other use cases: i guess any hypothetical modded entity that sometimes moves and sometimes just stays inmobile could benefit from such an option
in the end i am fine using the existing tools to get the behavior i want, my only concern was possible performance implications.
Re: Add ability to draw_animation to stop on last frame
Posted: Fri Aug 16, 2019 4:44 pm
by slippycheeze
rude_grass wrote: Wed Aug 14, 2019 9:01 pm
in the end i am fine using the existing tools to get the behavior i want, my only concern was possible performance implications.
I'd strongly advise waiting until they turn into real, concrete, and demonstrable, performance issues first. In almost every case the "possible" performance issues and the actual performance issues are entirely different sets. Until you have something to reliably demonstrate the problem -- which is critical to demonstrate you no longer have the problem after you try and fix it -- you can invest huge effort in fixing non-problems, and still have the performance tank somewhere.