Open trollodel opened 3 years ago
As for the docks and bottom panels in general, I think that calling the components "docks" or "bottom panels" is kinda short-sighted, since in the future these components might be floating, or be located on a main screen, etc.
Dock
, panel
, floating window
etc are just options for the arrangement of components/plugins/editors imo.
I think it would be more sensible to have a Components
and Plugins
singletons.
Components
singleton - for built-in components/editors/plugins (such as ScriptEditor
, FileSystem dock/view
, SceneTreeEditor
, Inspector
, ShaderEditor
etc.),
This Components
singleton could have methods like
get_component(component_name - String or enum)`
And Plugins
singleton could have methods and singnals for working with user plugins such as:
get_plugin(name: String)
set_enabled(plugin_name: String, enable: bool),
get_enabled(name)
get_plugin_list()
#as well as maybe:
add_inspector_plugin()`
and others like that.
As for the docks and bottom panels in general, I think that calling the components "docks" or "bottom panels" is kinda short-sighted, since in the future these components might be floating, or be located on a main screen, etc. ,
Dock
,panel
,floating window
etc are just options for the arrangement of components/plugins/editors imo.
This would be nice when it happens, but unfortunately this is not the case right now. Each place has a different API, and they are not trivial to merge in a unified API, especially the main screen/workspace one.
I think it would be more sensible to have a Components and Plugins singletons.
I had though about having a Plugins
singletons (I'm always talking about editor plugins, as other kind of addons should be separated IMO), but it is a bit out of scope of this proposal. However, Plugins
should not contain methods like add_component_plugin()
as they are mostly a convenient shortcut for get_component_dock().add_plugin()
.
Instead, a Components
singleton would become a giant class with dozens of methods (to give you some numbers, there are 6 docks, 14 bottom panels and 4 workspaces, and I'm missing other components such as the main menu) and it's something that I want to avoid as, in the current state, there is a hard separation between component "types".
get_component(component_name - String or enum)
I prefer having separated getters as each component has a dedicated API for its customization, and for type safety/autocompletion stuff.
All the linked PRs were rejected, but I'm not going to close this because the listed issues still exist and an alternative solution (but related) was discussed in the Godot contributor chat. Also, this is the only existing proposal where there is a generic solution for the listed issues.
Related to #300, #1761, #2276 See also godotengine/godot#47520
Glossary
Describe the project you are working on
Unrelated to the proposal.
Describe the problem or limitation you are having in your project
Currently, the editor API are quite limited.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Provide simplified access for most parts of the UI
The idea is to provide different levels of access to the components:
EditorPlugin
or in a proper singleton.Group editor components in singletons
In a complex UI like the Godot Editor, it is necessary to split and group all the component interfaces. So I propose to have several singletons, obtainable though
EditorPlugin
.EditorDocks
for docks and to get the builtin ones.EditorWorkspaces
for workspaces and to get the builtin ones.EditorBottomPanels
(or justEditorPanels
) for panels and to get the bultin ones.EditorComponentPluginInterface
(! better name required) for managing component-specific editor plugins. This acts mostly as a helper and the same interfaces (mostly adding/removing plugins) must be exposed by each component Note that some panels are showed depending on the context (e.g. Animation) so they may not be available.... and other ....
EditorInterface
(I preferEditorRoot
) for top level plugins and getting the main menu, the playtest or other interfaces that does not belong to other singletons.Other enhancement
EditorPlugin
).Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Most was described above, but an editor plugin entry point should look like this (in GDScript):
If this enhancement will not be used often, can it be worked around with a few lines of script?
Not always, while it is possible to get every node navigating the scene tree, some nodes have internal objects to manage their status and appearance, and they are not available mostly.
Is there a reason why this should be core and not an add-on in the asset library?
Requires changes in the editor.
Unrelated to the proposal