HI all,
on the learning path, I’m playing with turning Godot’s 2d editor into a vector graphics animator that uses the native node hierarchy and AnimationPlayer to generate a spritesheet in SVG format.
I got it to work using custom nodes in tool mode, heirs of Node2D, with everything necessary accessible and animatable from the inspector and AnimationPlayer. All the magic happens from a spritesheet function that is executed from a button in the inspector without needing to run the program. The AnimationPlayer’s callback process is set to manual and immediate, which allows me to loop through the entire animation.
I even managed to render the preview of each sprite with Inkscape. Amazed at how easy it was, I decided to go one step further and lift the whole assembly from an EditorPlugin.
The thing is that when I try to build the SVG file from a function of the plugin that calls the spritesheet function, it doesn’t find the animation cache. Also, with the editor just opened the same function works from the inspector until I call it from the plugin and I get the same error in both: No animation in cache.
I have tried to rebuild the cahe every time I export with clear_cache, which I understand is the way to rebuild it, but with no luck. I have tried all possible combinations of play, pause, seek and advance, along with await get_tree().process_frame which forced me to rebuild the process in asynchronous mode, but again no luck. I have searched queries around the subject with very few results and none of them helped me. As the cache system was rebuilt in version 4.2, there is hardly any information in the forums and the IAs are outdated. I have explored related classes and tutorials, such as SceneTree or AnimationMixer, but I can’t find an explanation.
Any idea what is going on?
Thank you in advance and sorry for the long read.