X Tutup
Skip to content

Change Theme to EditorDock and add closable property#113108

Merged
akien-mga merged 1 commit intogodotengine:masterfrom
KoBeWi:Thock
Dec 3, 2025
Merged

Change Theme to EditorDock and add closable property#113108
akien-mga merged 1 commit intogodotengine:masterfrom
KoBeWi:Thock

Conversation

@KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Nov 24, 2025

Part of #113024
Changes Theme to Editor dock. I also added closable property that allows non-global docks to be closed. Also added a related closed signal (emitted when the dock is closed with the button).

From more controversial changes, I also removed the close button from Theme. The dock has to be closed by right-clicking the tab

godot.windows.editor.dev.x86_64_Fzhp3WuUsH.mp4

There are 2 downsides:

  • It's less discoverable
  • Not all bottom docks can be closed, so it's even less discoverable

If it's a problem, I can restore the button, but then there are 2 ways to close the dock, and also code would be more complex.

@KoBeWi KoBeWi added this to the 4.x milestone Nov 24, 2025
@KoBeWi KoBeWi requested review from a team as code owners November 24, 2025 15:07
@KoBeWi KoBeWi requested a review from a team November 24, 2025 15:07
@KoBeWi KoBeWi requested a review from a team as a code owner November 24, 2025 15:07
@Mickeon
Copy link
Member

Mickeon commented Nov 24, 2025

I am glad to see you were open to mention it, but the button has to stay, at least for now.
If the Theme bottom panel is truly one-of-a-kind in this regard it requires a readily-available close button because it's entirely unexpected and an exception to the norm.

The alternative is, for the sake of consistency and developer sanity, to display something special for every dock that can be closed but isn't global. That also sounds a bit unusual, but I guess there's going to be quite a few of them.

@KoBeWi
Copy link
Member Author

KoBeWi commented Nov 24, 2025

Restored the button.

</member>
<member name="global" type="bool" setter="set_global" getter="is_global" default="true">
If [code]true[/code], the dock appears in the [b]Editor &gt; Editor Docks[/b] menu and can be closed. Non-global docks can still be closed using [method close].
If [code]true[/code], the dock appears in the [b]Editor &gt; Editor Docks[/b] menu and can be closed. Non-global docks can still be closed using [method close] or when [member closable] is [code]true[/code].
Copy link
Member

@Mickeon Mickeon Nov 24, 2025

Choose a reason for hiding this comment

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

We're starting to make exceptions to what "global" means in this context. Or just starting to make exceptions in general. The API is getting a bit wrangled. Can we not have both global and closable coexist without interfering with one another?

Copy link
Member Author

Choose a reason for hiding this comment

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

global is true by default and closable is false. So if they were to co-exist, you'd need to enable closable every time you want the dock closable. There is no reason not to allow closing a dock that can be brought back using a menu.

Alternative I considered is a 3-state enum, something like Global, Closable, Non-Closable.

Copy link
Member

@Mickeon Mickeon Nov 24, 2025

Choose a reason for hiding this comment

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

You could begin discussing this on RocketChat. I personally think the if-elses and special cases required for both right now are unwieldy, so whatever the solution is, I welcome it.

I don't mind the enum myself but there is a possibility it'll become unreasonable as you keep porting more docks.

@arkology
Copy link
Contributor

If it's a problem, I can restore the button, but then there are 2 ways to close the dock, and also code would be more complex.

Is there any way to show it only when dock is not floating?

Comment on lines +82 to +84
<member name="closable" type="bool" setter="set_closable" getter="is_closable" default="false">
If [code]true[/code], the dock can be closed with the Close button in the context popup. Docks with [member global] enabled are always closable.
</member>
Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking that all transient docks should be closable by default in the future.
It's just some bottom docks that aren't closable that this would be needed for, or they could be just made global (Output, Debugger, Audio, Animation, Shader).

Copy link
Member Author

Choose a reason for hiding this comment

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

Why would you want to close them though? They will disappear when you are not editing, and even if you close them, they will appear again when needed. It's futile.

@KoBeWi
Copy link
Member Author

KoBeWi commented Nov 29, 2025

Is there any way to show it only when dock is not floating?

Yes, but then you can't close it directly. You have to close the window then close the dock. Not sure if it's better.

@KoBeWi
Copy link
Member Author

KoBeWi commented Dec 2, 2025

The discussion kind of went nowhere. Should I just remove the new property? I guess there is no harm in that, other than docks being closable for no useful reason. Though I'm not sure if it's expected that your dock can be closed at any time by the user, but the new signal allows to handle it.

@KoBeWi KoBeWi changed the title Change Theme to EditorDock and add closable property Change Theme to EditorDock and add closable property Dec 2, 2025
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it works as expected. Code looks good to me.

While you can't move it to a side dock for space reasons, this allows you to make the dock floating:

image

@akien-mga akien-mga modified the milestones: 4.x, 4.6 Dec 3, 2025
@akien-mga akien-mga merged commit 11ffcb3 into godotengine:master Dec 3, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@KoBeWi KoBeWi deleted the Thock branch December 3, 2025 09:39
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.

6 participants

X Tutup