godotengine / godot-cpp

C++ bindings for the Godot script API
MIT License
1.73k stars 570 forks source link

Revisit godot-cpp interfaces bindings #463

Open m4gr3d opened 4 years ago

m4gr3d commented 4 years ago

Some of the server wrapper classes (e.g: ARVRServer) provide the ability to register subclasses to be invoked at runtime (e.g: ARVRService::add_interface(...)) by the core engine.

However since the provided subclasses are actually instances of the godot-cpp wrapper instead of the target class, these APIs are no-op as there is no logic to forward the calls from the target class to the wrapper class.

m4gr3d commented 4 years ago

cc @BastiaanOlij

BastiaanOlij commented 4 years ago

As discussed privately, to fix the issue for ARVR we're thinking about moving 'ARVRInterfaceGDNative' class into godot-cpp core. For those calls that are called internally by Godot the 'godot_arvr_interface_gdnative' struct will be populated to call into the related wrapper class methods. There may need to be a small upstream fix to allow setting the struct pointer.

This approach should allow for Godot to work properly with GDnative classes while also adding the ability to extend the class.