godot
godot copied to clipboard
Fix non const animation node `_process` virtual function
Quick fix for https://github.com/godotengine/godot/issues/74807
I'm working on a motion matching implementation, and am currently improving its API. I currently think the best way to do this by extending AnimationRootNode, but the docs mention the _process method is deprecated, and that many APIs are missing to be able to extend animation nodes. I guess my question is, is this the case? If so, is there anything planned to support this in coming releases?
- Bugsquad edit, closes: https://github.com/godotengine/godot/issues/74807
I'm not seeing how I can register compatibility methods for GDVIRTUAL functions, is that implementer?
Also, how do changes to the C++ bindings work? Is extension_api.json automatically updated, or should I open a PR for that?
I'm not seeing how I can register compatibility methods for
GDVIRTUALfunctions, is that implementer?
There is no way to safely change a virtual method in a binary compatible way. Instead, you need to add a new virtual method under a new name, and then selectively call whichever one is implemented (usually preferring the new one first). You can check if a virtual method is implemented via the GDVIRTUAL_IS_OVERRIDDEN() macro
Actually, looking at the PR in more detail, I'm not sure changing const-ness actually breaks compatibility. It may be fine. Someone should test if a GDExtension that overrides this virtual method compiled for Godot 4.3 works fine when loaded into Godot compiled with this PR.
@dsnopek Thanks for your reply, sorry I got to this so late. I can give that a try as I'm working on one such GDExtension, I'll get back to you on that.
@dsnopek just tested what you suggested, loading a GDExtension that overrides the const version of this method, on godot compiled with these changes. Works great, no errors!
The commits will need to be squashed before this can be merged.
Thanks!