X Tutup
Skip to content

Rework editor docks#106503

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
KoBeWi:docker_exe
Oct 1, 2025
Merged

Rework editor docks#106503
Repiteo merged 1 commit intogodotengine:masterfrom
KoBeWi:docker_exe

Conversation

@KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented May 16, 2025

Closes godotengine/godot-proposals#12435
Fixes #106927

There are some differences from the proposal. The new class is called EditorDock and inherits MarginContainer.

I still need to expose it. For now I changed all docks to use the new system.

EDIT:
Done. I made an example plugin that uses the new system:
dock-test.zip
It can be moved to bottom and supports saving layout.

Also supersedes #106428

@lodetrick
Copy link
Contributor

lodetrick commented May 16, 2025

This isn't an issue with this PR, but since we're changing how the dock customization works would it be possible to take #106428 into account? In my opinion it is better to have the brittle Texture2D to be the priority rather than the fallback because it would allow for overrides and the more dynamic StringName (it is able to be drawn in dark mode, for example) to be the fallback.

@KoBeWi KoBeWi force-pushed the docker_exe branch 5 times, most recently from 441e53c to bb9c614 Compare May 16, 2025 23:05
@KoBeWi KoBeWi marked this pull request as ready for review May 16, 2025 23:11
@KoBeWi KoBeWi requested a review from a team May 16, 2025 23:11
@KoBeWi KoBeWi requested a review from a team as a code owner May 16, 2025 23:11
@KoBeWi
Copy link
Member Author

KoBeWi commented May 16, 2025

Should be ready now. I included #106428 too.
Makes me wonder whether icon_name should be renamed to fallback_icon maybe?

@lodetrick
Copy link
Contributor

I still think the icon_name has a use because it is a lot more flexible (it can be used in light or dark mode), maybe it could be icon -> override_icon and icon_name -> default_icon.

@KeyboardDanni
Copy link
Contributor

I mentioned this already in the Godot Contributors Chat, but I'm concerned about every dock being added to the menubar under "Editor Docks". The problem is that this shows every possible context-sensitive dock to the user, even when they wouldn't normally be visible. For example, the "Tilemap" dock usually only appears when you are editing a Tilemap. I'm not exactly sure under what circumstances you'd want to access that dock when you're not editing a Tilemap. As goofy as the Microsoft Office Ribbon is, I feel that this is one aspect they did get right at least. In versions of Microsoft Office before 2007 the UI was crammed with a lot of toolbars, docks, selectable windows, that sort of thing, for features that aren't even active so they're just taking up space.

I could see the need to be able to access a dock that isn't context-relevant if you want to adjust where it is in the layout, but I'm not sure how best to approach that. Some programs temporarily show any stuff that would normally be hidden when you go into the "layout edit mode" but Godot doesn't really have that.

I do like the idea of being able to move docks that would normally be bottom-locked, and put them in other parts of the UI. But also a lot of bottom docks are situational, and them being at the bottom communicates that. So moving them elsewhere doesn't really fit the established paradigm.

@KoBeWi
Copy link
Member Author

KoBeWi commented May 17, 2025

That's unrelated to this PR though. It only changes internals, the editor so far works the same as before.

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.

The main content looked good from what I could see, although there were quite a few object leaks:

WARNING: 5 RIDs of type "CanvasItem" were leaked.
     at: _free_rids (servers/rendering/renderer_canvas_cull.cpp:2678)
ERROR: 6 RID allocations of type 'N10RendererRD14TextureStorage7TextureE' were leaked at exit.
WARNING: 8 RIDs of type "Texture" were leaked.
     at: finalize (servers/rendering/rendering_device.cpp:7164)
ERROR: 73 RID allocations of type 'PN18TextServerAdvanced22ShapedTextDataAdvancedE' were leaked at exit.
ERROR: 18 RID allocations of type 'PN18TextServerAdvanced12FontAdvancedE' were leaked at exit.
ERROR: 1 RID allocations of type 'PN18TextServerAdvanced27FontAdvancedLinkedVariationE' were leaked at exit.
WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
     at: cleanup (core/object/object.cpp:2489)
ERROR: 2 resources still in use at exit (run with --verbose for details).
   at: clear (core/io/resource.cpp:637)

It might be an issue with master. I'll check. Yeah it has to do with master. Disregard above.

@KoBeWi KoBeWi force-pushed the docker_exe branch 2 times, most recently from 45c3698 to dda9767 Compare May 17, 2025 11:07
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.

It looks good now from what I can see. Thanks for your effort!

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.

I do still find a bit weird that available_layouts exists as a future-proof measure. Docs are fine, now it's a matter to see if the PR is good to go.

@KoBeWi KoBeWi force-pushed the docker_exe branch 2 times, most recently from 5ab5179 to b6454cb Compare July 7, 2025 10:25
@KoBeWi
Copy link
Member Author

KoBeWi commented Jul 7, 2025

Rebased. I also marked EditorDock as experimental for now.

<return type="void" />
<param index="0" name="dock" type="EditorDock" />
<description>
Adds a new dock.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Adds a new dock.
Adds a new dock. Use [member DockSlot.default_slot] first to set the dock slot it will open to.

Maybe we should add a mention of the default slot here to ease the transition? Not sure.

Comment on lines +654 to +655
const String section_name = p_section + "/" + dock->get_effective_layout_key();
dock->save_layout_to_config(p_layout, section_name);
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a problem with saving an Editor Layout using different section names, each section is detected as a separate layout. This causes extra layouts:

Image

So either they shouldn't be separate sections or some of the code that gets the layout list at EditorNode::_update_layouts_menu() and EditorLayoutsDialog::_post_popup() needs to be updated to account for this.

Copy link
Member Author

@KoBeWi KoBeWi Sep 27, 2025

Choose a reason for hiding this comment

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

Fixed, but IMO keeping all layouts in one config file is a bad idea.

Copy link
Contributor

Choose a reason for hiding this comment

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

If a layout can have multiple sections like here, then it makes sense to put them in separate files.

Getting the list works now.
Deleting doesn't delete the full layout, it leaves [custom1/FileSystem] and etc sections in the file. It doesn't really cause issues so we can fix this later if we want.

@kitbdev kitbdev modified the milestones: 4.x, 4.6 Sep 28, 2025
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.

Looks good.

@Repiteo Repiteo merged commit bf926c2 into godotengine:master Oct 1, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 1, 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.

Commit tab resets position in docks Rework dock management - introduce a Dock class

7 participants

X Tutup