Make bottom panel into available dock slot#108647
Conversation
| p_tab_container->set_popup(dock_context_popup); | ||
| p_tab_container->connect("pre_popup_pressed", callable_mp(dock_context_popup, &DockContextPopup::select_current_dock_in_dock_slot).bind(p_dock_slot)); |
There was a problem hiding this comment.
I personally chose not to have this popup appear for the bottom panel (because it is out of place with the other buttons), but it could also appear as one of the bottom panel's dedicated buttons
| p_tab_container->set_use_hidden_tabs_for_min_size(true); | ||
| p_tab_container->get_tab_bar()->connect(SceneStringName(gui_input), callable_mp(this, &EditorDockManager::_dock_container_gui_input).bind(p_tab_container)); | ||
| p_tab_container->hide(); | ||
| p_tab_container->set_meta("dock_layout", p_layout); |
There was a problem hiding this comment.
Is this necessary with the array of DockSlots? I see what you mean about the need for EditorDockContainer.
There was a problem hiding this comment.
It was a quick hack, the problem is that _move_dock() takes the new parent directly instead of slot ID. It requires some changes.
| DockConstants::DockSlot occupied_slot = DockConstants::DOCK_SLOT_MAX; | ||
| TabBar *drop_tabbar = nullptr; | ||
|
|
||
| Color valid_drop_color; |
There was a problem hiding this comment.
In my opinion, this PR should be the one to introduce the invalid_drop_color and relevant layout checks in EditorDockDragHint (to visually tell the user that they can/cannot drag onto the bottom dock.
There was a problem hiding this comment.
For now I just removed highlight if the slot can't be dropped to.
It will be set to default state (i.e. position) after selection "Reset layout" it top bar menu, right? |
|
Currently no. Bottom editors are not part of default layout, their order is semi-random. |
|
Not sure this is intended :) godot.windows.editor.x86_64_slot_HfoZb7nt9F.mp4 |
This comment was marked as resolved.
This comment was marked as resolved.
BTW does it happen in master? |
Soo the problem is that previously when you selected Audio tab, the panel would expand height, but then shrink down once you select a smaller dock. Now the new height is permanent, and also bigger than before for some reason. So yeah, it is a bug. |
|
I think I resolved all problems. |
507418b to
2f66f2e
Compare
a3e5610 to
6209660
Compare
There was a problem hiding this comment.
It looks like this creates a warning, the C# code for the MSBuild panel should be changed to not use the deprecated method https://github.com/godotengine/godot/actions/runs/19279142673/job/55126147042?pr=108647#step:17:149 'EditorPlugin.AddControlToBottomPanel(Control, string)' is obsolete
I was thinking we should add a transient or temporary mode for docks that cannot open freely and depend on something, like many bottom panel docks are.
Also for the future, I think EditorDockManager can be refactored, as it does too much. Some of its code can be moved to EditorDock and some of its code can be delegated to a new EditorDockContainer class extending TabContainer (the bottom panel would inherit it too). Also the main screen could potentially become a dock slot.
There can also be a Node for the EditorDockManager so it has a place to respond to notifications like theme change and drag start and process shortcuts without workarounds.
| <member name="dock_shortcut" type="Shortcut" setter="set_dock_shortcut" getter="get_dock_shortcut"> | ||
| The shortcut used to open the dock. This property can only be set before this dock is added via [method EditorPlugin.add_dock]. | ||
| </member> | ||
| <member name="global" type="bool" setter="set_global" getter="is_global" default="true"> |
There was a problem hiding this comment.
This could be inverted and use permanent, since they cannot close. Or closable.
e91afe3 to
1eaa543
Compare
|
Ok, I pushed some major changes:
|
kitbdev
left a comment
There was a problem hiding this comment.
Opening the Polygon2D bottom panel editor freezes, the console spams Object was deleted while awaiting a callback.
1eaa543 to
a7699e4
Compare
| } | ||
| } | ||
|
|
||
| pending_update = false; |
There was a problem hiding this comment.
This fixed the Polygon2D editor freeze. The line dates back to Godot being open-source and doesn't look relevant anymore.
There was a problem hiding this comment.
I think I have to be reasonably skeptical on why this would be the case, maybe even "by the book" by telling you to make a separate PR about it.
There was a problem hiding this comment.
I was thinking about making a separate PR, but a) it's difficult to justify on its own (it's a corner case here that I'm not sure how to reproduce otherwise) and b) if the PRs get merged separately, reverting this change will cause the editor freeze, so any problems would need to be fixed without a revert.
The reason this causes problems is that there is some nasty stack of deferred calls that causes queue_redraw() to bypass the pending_update check and make deferred calls infinitely. A "better" fix would be untangling the deferred calls, but either way this line is useless. There is no way that a CanvasItem ends up outside tree with a pending redraw, thanks to this check:
godot/scene/main/canvas_item.cpp
Lines 134 to 137 in ef34c3d
There was a problem hiding this comment.
Confirmed that it does fix the issue.
Seems fine to remove to me, I don't see why it would need to force queue the redraw when it is already queued.
It is hard to reproduce, but this code freezes in the same way:
extends Control
func _draw() -> void:
top_level = !top_levelYou need to run it with a console or debugger attached though, since it seems it is the error spam that freezes it.
Removing this pending_update line fixes it.
Mickeon
left a comment
There was a problem hiding this comment.
One thing to keep in mind is that this PR may cause a ripple effect:
We may want to standardize any references to "bottom panel" into "dock", or maybe "bottom dock", in order to finally get rid of the ambiguous "panel" nomenclature. That would be very taxing, but consistent.
| <method name="open"> | ||
| <return type="void" /> | ||
| <description> | ||
| Opens the dock. It will appear in the last used dock slot. If the dock has no default slot, it will be opened floating. |
There was a problem hiding this comment.
Following the last suggestion, I suppose. Once again, the editor refers to this as "make floating" if we really need to put it this way.
| Opens the dock. It will appear in the last used dock slot. If the dock has no default slot, it will be opened floating. | |
| Opens the dock. It will appear in the last used dock slot. If the dock has no default slot, it will be made floating. |
There was a problem hiding this comment.
In this case it is opened and made floating directly, which seemed different than making an already opened dock floating.
a7699e4 to
18fda91
Compare
kitbdev
left a comment
There was a problem hiding this comment.
There is still a deprecated warning for the MSBuild bottom panel (it shows at the bottom of the Github Files Changed tab).
And it needs a rebase.
Otherwise it looks good to me.
18fda91 to
67735cf
Compare
|
Thanks! |
Supersedes #106426
Adds a
DOCK_SLOT_BOTTOM, which corresponds to bottom panel. All bottom panel controls are now docks. For compatibility, the old bottom editors are just wrapped in EditorDock.This mostly brings changes to the dock popup, but also allows dragging docks between sides and bottom (currently only FileSystem):
godot.windows.editor.dev.x86_64_A0DP2XbvLh.mp4
Other than that, the current dock slot is now properly highlighted, slots unavailable for the current dock are darkened. The "Move to Bottom" button is replaced with a bottom dock slot.
I also added 3 new EditorDock properties:
global(whether it appears in dock menu and can be closed),hidden(whether its tab is hidden) andtitle_color. All old bottom docks are non-global.Dock's layout is now properly respected, i.e. you can make a dock that is horizontal only (in #106503 the
LAYOUT_VERTICALflag was effectively unused). I also added aLAYOUT_FLOATINGflag, which determines whether the dock can float (all legacy bottom docks can't float).In follow-ups I plan to update legacy docks to the new system, which would allow stuff like vertical ShaderEditor (it's already possible, but the editor is not adjusted for that, so the option is blocked). I will probably open a tracker for that.
A side-effect of these changes is that bottom docks can be rearranged, but I think it's not really a problem 🤔
Also for the future, I think EditorDockManager can be refactored, as it does too much. Some of its code can be moved to EditorDock and some of its code can be delegated to a new EditorDockContainer class extending TabContainer (the bottom panel would inherit it too). Also the main screen could potentially become a dock slot.