godotengine / godot-cpp

C++ bindings for the Godot script API
MIT License
1.71k stars 573 forks source link

[GDExtension] EditorPlugin Tool #640

Closed CornLizard closed 1 year ago

CornLizard commented 3 years ago

Godot version

v4.0.dev.custom_build [ed5267f69]

System information

Manjaro 21 KDE, 1950x threadripper, 1080 TI, Vulkan, 16GB Memory

Issue description

My problem isn't really an error more or less a missing feature? I'm unable to find a solution to using tool. I found some posts about using the old GDNative and modules. I cannot find the equivalent in GDExtensions if there is any.

Module solution

EditorPlugins::add_by_type<MyPlugin>();

GDNative solution

register_tool_class<MyPlugin>();

Zylann commented 2 years ago

I thought in GDExtension all classes were tool? (just like every class in the Godot core source code. tool is only a feature of scripts, and GDExtensions are not scripts)

Zylann commented 2 years ago

Although there seem to be confusion between two things on this issue: 1) Yes, I think GDExtension classes are all "tool" in the sense that they will run in editor if nodes are added to scene tree. 2) No, GDExtension does not seem to have any way to register EditorPlugins like modules can. This is an issue that needs solving.