0 votes

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?

Thank you

asked Feb 3 in Engine by KnightNine (60 points)

2 Answers

0 votes

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.

answered Feb 3 by KnightNine (60 points)
0 votes

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
...
public:
    GridMapEditorPlugin(EditorNode *p_node);

is quite similar to:

tool
class_name GridMapEditorPlugin
extends EditorPlugin

(you can even write this as a one-liner):

class_name GridMapEditorPlugin tool extends EditorPlugin

All other plugin-related methods reflect the current EditorPlugin documentation.

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.

answered Feb 4 by Xrayez (1,236 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.