Zylann / godot_voxel

Voxel module for Godot Engine
MIT License
2.68k stars 251 forks source link

Is it possible to interact with godot_voxel classes directly from a C++ Godot native extension? #451

Open Darker opened 2 years ago

Darker commented 2 years ago

I only ever learned about godot because I wanted a C++ game engine. I am not really a game dev but wanted to try it.

Now I downloaded the build with the Voxel module. I also managed to set up a build for my C++ (now empty) project which is imported into Godot as a native library (.so/.dll).

With standard Godot classes, the next step is obvious - extend one of them and override one of the "virtual" methods. But what if I wanted to interact with the voxel classes - which is the only thing I really care about?

Say I wanted to generate some terrain in C++ and push it into the voxel plugin. Or maybe have the voxel plugin ask what coordinates it needs generated. Where can I look for advice on this? I'd rather not glue it via scripts.

MGilleronFJ commented 2 years ago

If you get a version of Godot that includes the voxel module, and if you are referring to using GodotCpp, then you have to generate the extension_api.json file yourself from your version of Godot. Because the default one provided in godot-headers only has classes from the vanilla engine. See https://github.com/godotengine/godot-cpp/blob/master/godot-headers/README.md for how to generate the file. Then, make sure the gen folder in GodotCpp is empty (so up-to-date bindings will be generated), and build with GodotCpp.