X Tutup
Skip to content

Use new dock system for Shader Editor Dock#113181

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
lodetrick:shader-dock
Dec 3, 2025
Merged

Use new dock system for Shader Editor Dock#113181
Repiteo merged 1 commit intogodotengine:masterfrom
lodetrick:shader-dock

Conversation

@lodetrick
Copy link
Contributor

@lodetrick lodetrick commented Nov 26, 2025

See #113024

Upgraded the Shader Editor Dock to use the new system. I also added a make_dock_floating() function in EditorDockManager to force a dock to be floating through code.

Now that this is a dock, I removed the internal floating logic and button to use the Dock methods. The dock has to be made floating by right-clicking the tab or using the shortcut. Since all docks should be made floating this is standard behavior.

My primary motive in removing the floating button is leaving the door open to refactors that might make individual shader file editors docks (ie able to edit multiple shaders on screen at once). Leaving the button in would necessitate moving almost the entirety of the plugin into a new class extending dock, which would have to be reversed if it were refactored to edit multiple shaders on screen at once.

I also reordered the constructor to be more in line with the rest of the editor.

@KoBeWi
Copy link
Member

KoBeWi commented Nov 26, 2025

The shader editor could easily fit in the side docks, the only problems are minimap and large line number gutter 🤔
image

Comment on lines 447 to 448
if (file_menu->get_parent() != nullptr) {
file_menu->get_parent()->remove_child(file_menu);
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated, but I wonder why the button isn't just made invisible?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't like this but currently that single button gets transferred between all of the editors, so it needs to be reparented to the active editor. In the future it would probably be best to just put that logic and button in the ShaderEditor class

@lodetrick
Copy link
Contributor Author

lodetrick commented Nov 27, 2025

Unless you think the vertical orientation is fine as you reviewed it earlier I think it won't be introduced just yet in this PR, I would want to reduce the size of the gutter and add a shortcut to toggle the minimap before I'd personally be comfortable with a vertical orientation. Although this is only an issue for small widths, so another option would be to temporarily have a "large" minimum width

Edit: There is an existing editor setting to toggle the minimap, I don't know how much that impacts the issue

@lodetrick lodetrick force-pushed the shader-dock branch 2 times, most recently from c8ad651 to 4af933a Compare November 27, 2025 21:17
@KoBeWi KoBeWi modified the milestones: 4.x, 4.6 Nov 27, 2025
@akien-mga
Copy link
Member

Needs rebase.

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.

image

I think we could allow moving it to a side dock if we automatically disable the minimap and file list while it's in a side dock. #113230 would also need to be merged to reduce the gutter's width.

Also, the Make Floating button in the general dock editor no longer has a screen selector like the old one had. For multi-monitor setups, this means you now need to move the shader editor window manually after making it floating. In the future, we should reintroduce a screen selector in the general dock editor to avoid regressing usability on this front.

PS: I wonder if people will be looking for the old Make Floating button now that it's been removed. The new way to do it is arguably harder to discover (3 vertical dots at the right of the bottom panel). Should we keep the existing button available during 1 minor version as a transition period, with a toast explaining the new way to make the shader editor floating?

@KoBeWi
Copy link
Member

KoBeWi commented Dec 2, 2025

Should we keep the existing button available during 1 minor version as a transition period, with a toast explaining the new way to make the shader editor floating?

Maybe let's see if it's really a problem first. We can reintroduce the button if there are bug reports about it.

@lodetrick
Copy link
Contributor Author

lodetrick commented Dec 3, 2025

I think for the purpose of getting a basic implementation merged, the Shader dock should not be vertical in this PR.

My reasoning is it would be a very large refactor to make it support changes on vertical layout (almost all of the plugin would need to be moved into a new class extending EditorDock, or have an external method to get updated when the layout is changed), and #113230 isn't merged yet, so it would take a while for a vertical PR to be merged.

@Repiteo Repiteo merged commit 8c8927e into godotengine:master Dec 3, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Dec 3, 2025

Thanks!

@arkology
Copy link
Contributor

arkology commented Dec 3, 2025

I suppose this dock should have default offset to mimic old size (same way as audio tab). Right now it opens like this (I have deleted .godot folder before opening editor for "clean launch"):

image

@KoBeWi
Copy link
Member

KoBeWi commented Dec 3, 2025

That might be because of #113181 (comment) 🙃
Looks like the tabs are be hidden when nothing is opened. The minimum size should be moved to the main container.

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.

8 participants

X Tutup