godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

`Script` methods are not `virtual`

Open derkork opened this issue 2 years ago • 3 comments

I'm currently looking at compiling the Visual Scripting support as a GDExtension module using godot-cpp. However all methods in the generated Script class are not marked as virtual making it impossible to have a custom Script class in a GDExtension. They are already marked as virtual: false in the extension_api.json that is used for the code generator. From a look into the generation of extension_api.json i figure this is because Script is marked as "core" method and is therefore never exported as virtual.

Is this something that could be adressed or are custom derived Script classes not a thing for GDExtensions?

derkork avatar Aug 25 '22 20:08 derkork

@derkork see https://github.com/godotengine/godot-visual-script/pull/26 . My understanding is that to implement custom Scripts you need to implement:

  • ScriptLanguageExtension
  • Custom ScriptInstance via GDNativeExtensionScriptInstanceInfo C struct directly.
  • ScriptExtension.

Faless avatar Aug 26 '22 08:08 Faless

Note, for Script, you should use ScriptExtension instead:

https://github.com/godotengine/godot/blob/master/core/object/script_language_extension.h#L40

Faless avatar Aug 26 '22 09:08 Faless

Ah i see, I'll try to make it work with these classes then. Thank you!

derkork avatar Aug 26 '22 12:08 derkork

Closing, as Faless answered the question

dsnopek avatar Aug 07 '23 18:08 dsnopek