-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add editor singletons to expose more editor UI components #47520
Conversation
I think it would be better to do this in steps, in several PRs. "Expose all the editor UI" sounds impossible or at least controversial to begin with. But say exposing all the docks in a nice way is totally doable and I was eyeing it for some time now. As docks are already somewhat encapsulated in the I would generally prefer to keep plugin API smaller and instead provide a more general help to navigating the editor UI, like naming more nodes. |
Yeah, I wanted to do it too, but since that for only exposing the docks I need to change 33 files, it'll come with lots of PR that depends on each other.
I was worried that it is misleading, so I'll change it to something softer (the idea behind the PR doesn't change for now).
Like godotengine/godot-proposals#1018? The issue with it is that if something change in the structure (like moving nodes) you lose the compatibility. Instead, if the interested component provides getters for relevant subcomponents, the problem came less frequently. |
Yes, frequently used parts or parts of higher interest should be exposed via specific, stable APIs. I was refering to your original title more, because to make the entirety of the UI tree more accessible the better option is to name nodes, even if they would break from time to time. Generally I think that the approach should be:
|
Points 1 and 3 are exactly what I thought. |
After thinking a bit, I decide to keep this PR only for exposing singleton as described in godotengine/godot-proposals#2537 and open other PRs after this. |
17ab408
to
cb1dd79
Compare
I defined all the singletons for this PR, now it's time to give me some feedbacks 😉. |
4242128
to
f9f7390
Compare
Remove docks getter from EditorInterface. Add EditorDocks getter to EditorPlugin
Remove panel related methods from EditorPlugin Add EditorBottomPanels getter to EditorPlugin
Add EditorWorkspaces getter to EditorPlugin
Remove plugin related methods from EditorPlugin Add EditorPluginInterfaces getter to EditorPlugin Register all the newly exposed classes Fix tests (hopefully)
Add EditorTopBars getter to EditorPlugin Add a missing getter
Fix mono attempt 1.
f9f7390
to
21be17e
Compare
The implementation of this PR was not accepted in a PR meeting, and in the last live Q&A Akien says that a refractor of editor plugin API will be done after 4.0. |
Rejected in a discussion, the Godot contributor chat. |
Part of godotengine/godot-proposals#2537
This PR exposes every editor component (only the main ones, not subcomponents) through dedicated singletons.
The naming scheme follows this section, including the use of "workspace" instead of "main screen".
I took the opportunity to move some methods from EditorPlugin and EditorInterface to dedicated singletons to clean up that classes. As I pointed out in godotengine/godot-proposals#2537, the Godot editor is too big and complex to expose its API mostly through 2 classes.
Singletons:
Notes for reviewers: