godot-visual-script
godot-visual-script copied to clipboard
[Help wanted] Convert to GDExtension.
Some minimal initial work to start the project of converting the module to a GDExtension.
The PR does not yet properly compile, but the build system is there, you can try by just typing scons.
The godot-cpp submodule uses this branch: https://github.com/godotengine/godot-cpp/pull/819 .
Bare minimum things to implement:
- "
ScriptInstanceExtension" via aGDNativeExtensionScriptInstanceInfowrapper. ScriptLanguageExtensionmethods name (prefix with_?).- ...
see (https://github.com/godotengine/godot-visual-script/commit/741f1315f782a1c213d998ad8396ac513399bdd7).
I sadly don't have time to work on this right now, but I hope this PR can at least open a path to external contributions.
I am working on this, I already fixed about a million compile errors. Currently working on some final parts of the VisualScriptCustomNode and then there are some things left over which seem to be currently not exposed to GDExtensions:
- there seems to be no way to access the ScriptDebugger from a GDExtension (e.g.
EngineDebugger::get_script_debugger) is missing. godot::Callable::CallErrordoes not seem to be available for a GDExtensiongodot::MultiplayerAPI::RPCModedoes not seem to be available for a GDExtension- also
ScriptServeris missing, so the extension cannot register its custom language
I am pretty new to this so I wonder how the workflow is. Should I open Tickets in godot-cpp for these or make pull requests in godot-cpp? Or is this not supposed to be exposed for GDExtensions - in which case I would need to know what is the intended replacement for these facilities.
godot::MultiplayerAPI::RPCModedoes not seem to be available for a GDExtension
That's defined in gen/include/godot_cpp/classes/multiplayer_api.hpp
also
ScriptServeris missing, so the extension cannot register its custom language
I think it can be registered via: Engine::get_singleton()->register_script_language(language);
- there seems to be no way to access the ScriptDebugger from a GDExtension (e.g.
EngineDebugger::get_script_debugger) is missing.
Yeah, you can access the debugger but not the script-specific part, I don't think that's required to be able to implement the language (only for it to support debugging), but it's something that will need to look into at some point.
godot::Callable::CallErrordoes not seem to be available for a GDExtension
Yeah, I think those will have to be exposed to GDExtension so proper call error handling can be implemented, at least knowing if the callable call has succeeded.
Should I open Tickets in godot-cpp for these or make pull requests in godot-cpp?
Both are fine, if in doubt open a ticket or ask on the contributor chat.
~~Those wanting to do this, feel free to start with this template: https://github.com/nathanfranke/gdextension~~
This isn't endorsed by Godot, but it is licensed as unlicense/public domain so no copyright troubles.
(P.S., can a similar template be hosted at godotengine/gdextension?)
Edit: Oh, I didn't realize this was a PR, so I guess the first step is already done :smiley:
My current progress is in https://github.com/derkork/godot-visual-script/tree/spike/extension . It is still quite a long way to go, as godot-cpp is not exposing quite a few engine functions/classes that the VisualScript module uses. I'll report these in godot-cpp one by one as I encounter them.
I don't think this is a particularly efficient way of doing things, though as every missing thing first needs to be added in godot-cpp, e.g. a PR needs to be made and reviewed and eventually the changes will be in. This can take quite a while during which I am basically blocked. In some cases I also have resorted to copy/paste from the engine source code (in hacks.cpp) to get some progress, but I will eventually need to clean this up.
I am very new to this so I probably am doing things the wrong way. If someone more experienced could give me a few tips on how this can be done more efficiently, I'd greatly appreciate it.