godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.15k stars 97 forks source link

Node3DEditor: expose add_control_to_menu_panel (etc) or wrappers to gdscript #8141

Closed wareya closed 1 year ago

wareya commented 1 year ago

Describe the project you are working on

A custom node with a custom 3d editor where gizmos don't work and a side panel is too big/clunky to be desireable.

Describe the problem or limitation you are having in your project

I want to add top menu bar controls to my custom node editor to control its settings. I checked the code for GridMap to see how it sets up these controls:

image

But it uses a function on Node3DEditor that's not exposed to gdscript:

image image

(As an aside, Node3DEditor isn't exposed as a type, so it's a little funny that it's binding these methods. Maybe they're being bound for gdextension? I'm not sure how gdextension works. This also means I have to get the Node3DEditor by doing main_screen.get_child(1), but enough plugins do that already.)

Describe the feature / enhancement and how it helps to overcome the problem or limitation

These functions (or a forwards-compatible wrapper around them) would be exposed to gdscript. This would allow editor plugins to use this area of godot's UI without resorting to horrible forwards-incompatible hacks like manually getting specific children of the Node3DEditor.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

ClassDB::bind_method would be called for the relevant methods in Node3DEditor's _init function. I'm not sure what problems might come as a result of this but it seems like it should be okay?

If this enhancement will not be used often, can it be worked around with a few lines of script?

The workaround is manually getting specific children of the Node3DEditor and manipulating them directly in forwards-incompatible ways.

Is there a reason why this should be core and not an add-on in the asset library?

Part of the interface for addons.

KoBeWi commented 1 year ago

It's exposed under different name: add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU)

wareya commented 1 year ago

I failed to find that in the docs. Thanks!