Make visual shader editor create node window a popup #99568
+23
−32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes the Visual Shader editor's "Create Shader Node" window to be a popup instead of a dialog, thus being easily dismissed by clicking outside the window like in most other DCC applications that use a node editor. It addresses godotengine/godot-proposals#11213. It also solves the issue where the window would appear outside the screen area.
Please note that i have only tested this on Linux and X11.
The main negative with this patch is that unlike the window, the popup is not resizable and instead a 300px (scaled by
EDSCALE
) minimum width is used to ensure that the node names are visible. While it is possible to make the window resizable by setting theWindow::FLAG_RESIZE_DISABLED
tofalse
, there is no visual indicator that the window is resizable and the window closes as soon as the resize finishes (seems a race condition between the window manager and the X11 mouse handling code for popups). Ideally there should be a control that can be placed on popups (like a small triangle at the bottom right corner, as that is common in various toolkits) to handle client-side resizing, but i can't find anything like that in Godot.A potential alternative would be to use the popup-based approach in this PR for right clicking but use a dialog when "Add Node" is selected from the popup menu. This will most likely require a larger change though as from what i can tell a window can't switch "modes" between being a Popup and a Dialog.