X Tutup
Skip to content

Make bottom panel into available dock slot#108647

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
KoBeWi:docking_abyss
Nov 21, 2025
Merged

Make bottom panel into available dock slot#108647
Repiteo merged 1 commit intogodotengine:masterfrom
KoBeWi:docking_abyss

Conversation

@KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Jul 15, 2025

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) and title_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_VERTICAL flag was effectively unused). I also added a LAYOUT_FLOATING flag, 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.

@KoBeWi KoBeWi added this to the 4.x milestone Jul 15, 2025
Copy link
Contributor

@lodetrick lodetrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial thoughts. Regarding the popup interfering with the buttons I can fix that in the refactor.

Comment on lines 951 to 952
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));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary with the array of DockSlots? I see what you mean about the need for EditorDockContainer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I just removed highlight if the slot can't be dropped to.

@arkology
Copy link
Contributor

Also, a side-effect of these changes is that bottom docks can be rearranged, but I think it's not really a problem

It will be set to default state (i.e. position) after selection "Reset layout" it top bar menu, right?

@KoBeWi
Copy link
Member Author

KoBeWi commented Jul 16, 2025

Currently no. Bottom editors are not part of default layout, their order is semi-random.

@arkology
Copy link
Contributor

Not sure this is intended :)

godot.windows.editor.x86_64_slot_HfoZb7nt9F.mp4

@KoBeWi

This comment was marked as resolved.

@arkology
Copy link
Contributor

arkology commented Oct 24, 2025

Something bad is happening with the bottom panel size:

BTW does it happen in master?
I suppose size changes because of #109915
UPD: Yes, it does... Should we treat this as a bug?

@KoBeWi
Copy link
Member Author

KoBeWi commented Oct 30, 2025

UPD: Yes, it does... Should we treat this as a bug?

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.

@KoBeWi
Copy link
Member Author

KoBeWi commented Oct 30, 2025

I think I resolved all problems.
#106164 still needs to be rebased and merged, so this is going to be a draft for a bit more.

@KoBeWi KoBeWi marked this pull request as ready for review November 7, 2025 22:45
@KoBeWi KoBeWi requested review from a team as code owners November 7, 2025 22:45
@KoBeWi KoBeWi requested a review from a team November 7, 2025 22:45
@KoBeWi KoBeWi requested review from a team as code owners November 7, 2025 22:45
@KoBeWi KoBeWi force-pushed the docking_abyss branch 2 times, most recently from 507418b to 2f66f2e Compare November 9, 2025 09:18
Copy link
Contributor

@kitbdev kitbdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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">
Copy link
Contributor

@kitbdev kitbdev Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be inverted and use permanent, since they cannot close. Or closable.

@KoBeWi KoBeWi force-pushed the docking_abyss branch 3 times, most recently from e91afe3 to 1eaa543 Compare November 15, 2025 18:41
@KoBeWi KoBeWi requested a review from a team as a code owner November 15, 2025 18:41
@KoBeWi
Copy link
Member Author

KoBeWi commented Nov 15, 2025

Ok, I pushed some major changes:

  • dock_hidden was removed
  • dock tabs are no longer being hidden, instead you are supposed to open/close the dock
  • added new open()/close() methods to EditorDock
  • added transient property. Transient docks don't store their open/closed in editor layout

@KoBeWi KoBeWi requested a review from kitbdev November 15, 2025 18:43
Copy link
Contributor

@kitbdev kitbdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening the Polygon2D bottom panel editor freezes, the console spams Object was deleted while awaiting a callback.

@KoBeWi KoBeWi requested a review from a team as a code owner November 16, 2025 16:32
}
}

pending_update = false;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixed the Polygon2D editor freeze. The line dates back to Godot being open-source and doesn't look relevant anymore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

@KoBeWi KoBeWi Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

if (!is_inside_tree()) {
pending_update = false;
return;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_level

You 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.

Copy link
Member

@Mickeon Mickeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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.

Copy link
Contributor

@kitbdev kitbdev Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case it is opened and made floating directly, which seemed different than making an already opened dock floating.

Copy link
Contributor

@kitbdev kitbdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Repiteo Repiteo merged commit 884bf2f into godotengine:master Nov 21, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 21, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

X Tutup