|Topic was automatically imported from the old Question2Answer platform.
I want to edit how GridMap nodes work and create my own custom version of that node that uses hexagonal prisms instead of a straight cube grid for positioning. I got the source-code for the GridMap module from github but the code is in C++, Python, and XML. Can i get this to run as an in-engine plugin or should I just start from scratch?
If this is feasible to do, my questions would be:
- How can i get the files in these other coding languages to function in the editor?
- What files from the Gridmap folder are actually relevant for this module to function as a plugin?
- Are there any tutorials relevant to this?
Modules have access to more control over Godot than plugins do, so I don’t think it’s possible.
It’s also just more efficient to rotate the grid 45 degrees and place hexes like that but i haven’t tested it yet.
I’m not sure if there’s anything module-related which would make it impossible to port this to a GDScript plugin. The C++ editor plugin initialization works similarly to GDScript.
class GridMapEditorPlugin : public EditorPlugin
is quite similar to:
(you can even write this as a one-liner):
class_name GridMapEditorPlugin tool extends EditorPlugin
All other plugin-related methods reflect the current
If there are some
Controls which are not exposed to the editor via script, these need to be re-implemented unfortunately.
One of the things which is lacking is the support for documentation the way it’s done via modules, but this isn’t a priority anyway.
I haven’t done any existing module ports to GDScript yet, but you can take a look at this repository as a proof that there are certainly some classes which can be ported from C++ back to GDScript. If you do manage to port GridMap to GDScript, feel free to contribute before doing your custom modifications to it.
If you talk about
GDNative plugins specifically, I think that’s also doable.
Checkout editor plugins documentation too. I haven’t seen C++ specific documentation for this.