Allow Quick Open dialog to preview change in scene#106947
Allow Quick Open dialog to preview change in scene#106947Repiteo merged 1 commit intogodotengine:masterfrom
Conversation
ef6f3ca to
6fd23a4
Compare
|
I've added a toggle to the window that allows the user to switch between the old and new behavior for the dialog box. |
Calinou
left a comment
There was a problem hiding this comment.
Tested locally, there seems to be an issue with how Instant Preview works beyond the first cursor change.
Testing project: test_pr_106947.zip
instant_preview.mp4
Also, Instant Preview was off by default in my local setup. I don't see any instances of EDITOR_DEF() in this PR, so it's probably missing a default (which is also why it doesn't appear in the class reference).
I like the idea still; it's a good way to make sure you actually applied the correct texture in 3D (since thumbnails can often look very close to each other).
|
Thanks for testing! I'll look into fixing the navigation and preview updating. As for the default setting, I don't remember providing an initial setting for it - will get that done as well! I think it might be best to have it off by default so it matches the existing behavior. But that may also risk it going unnoticed and unused by people. Notes for myself: When clicking an item in Quick Open's grid view, the item becomes selected. However, to allow the arrow keys to change the selection, I first have to tap the right arrow key as many times as the current selected item is items from the right. For example, if there are 3 columns, then I have to tap the right key 3 times. Then the search bar highlights, and after that, if I press the right key again, the selection starts moving again. |
6fd23a4 to
f3ed06f
Compare
|
You can now navigate with the keyboard after clicking on an item, and the Instant Preview setting now officially defaults to false. (Again, totally open to make it default to enabled if others would prefer it.) I think this would be a better fit for a later PR, but it appears the way that the focused Quick Open item is selected is... nonstandard. It seems to be some sort of hack around the search bar's inputs, rather than using Godot's built-in UI focus system. When the keyboard controls didn't work for selecting items after clicking one, that was because the item itself had become selected according to Godot - but in order for items to appear selected in Quick Open, the search bar has to actually be selected so it can pass the inputs through to display one of the items as selected... again, rather strange, and probably worth looking into replacing with Godot's normal focus system. Hm, so I thought I reproduced the issue you were experiencing with my test project, and fixed that. However, just to confirm I just downloaded your test project and I can see the material isn't updating when Instant Preview is enabled. Will have to look more at this tomorrow 😅 3 June 2025, 10:34 PM: So, the good news is, I think I've found the underlying issue causing this bug. The bad news is, it seems to have to do with how the editor handles property/resource pickers, which is definitely gnarlier than just the Quick Load menu. Basically, it appears that whenever a new texture is selected for the Material, the entire Material EditorResourcePicker is removed from the tree, and a new(?) one is added back in its place. Because the old one provided the I'm not totally sure yet how to address this, but I'll see what I can think of. If anyone has suggestions (or recognizes any inaccuracies in my current diagnosis), they would be very helpful! 😄 |
f3ed06f to
05c75b6
Compare
|
After a short break, I think I've made some headway on this, but it still seems it's going to be much more involved than I'd previously hoped. Currently the Quick Load window is passed the object and property path it is setting. When the user selects a new resource, it simply calls Godot.Quicker.Load.with.Material.Texture.No.UndoRedo.or.Saving.mp4However, undo/redo is currently not supported, and the editor does not recognize that modifications have been made to the scene/project that trigger the "unsaved" status for the window. |
05c75b6 to
bd517a9
Compare
bd517a9 to
acff698
Compare
b1459fd to
086696c
Compare
|
I think you could do similar to ColorPicker - change things instantly, but allow canceling them. If you press Enter, the resource gets accepted and makes undo/redo action. If you press Escape, the resource goes back to the initial value, so no undo action is needed. |
086696c to
a69fc36
Compare
|
Done! I think I'd avoided doing that before because I misunderstood how the undo/redo actions worked, and thought it would be much harder to do than it actually was (assuming it worked, of course 😅 ) |
This comment was marked as resolved.
This comment was marked as resolved.
|
Instant preview should be disabled for global quick open dialogs, like the one for opening scenes: godot.windows.editor.dev.x86_64_wpFBUYHBjp.mp4Maybe hide the button if the dialog is not open for a property? |
ae881e5 to
0a901f4
Compare
|
Now with 4.6 in development, I've returned to try and see this PR through. For now, I've rolled back the attempt at copying the Bugs I'm aware of currently:
(These notes are mostly just for myself to keep track of things, but if anyone can read them and has useful insights, I would really appreciate them!) Having MultiNodeEdit support Instant Preview would be very nice, but if it seems like it's going to be a major hurdle to overcome due to deep structural stuff, I think it might be wise to have Instant Preview simply not activate for MultiNodeEdit, and then perhaps focus on that in a future PR. |
58462e6 to
d71562e
Compare
|
I've done a bit of testing, and so far editing both single nodes and groups of nodes at a time has seemed to work correctly! To handle MultiNodeEdit, I've made the EditorQuickOpenDialog class a friend of it, so it can access the |
ed1a1f0 to
32d6f0f
Compare
|
MultiNode no longer crashes, but it creates wrong undo action when you cancel the dialog. |
|
That should be fixed now, I think! Sorry for all the runaround with the bugs, but thank you very much for testing it! 😅 I've also made it so that the first selection in each Quick Open dialog (i.e., the one that happens automatically when the window opens) does not trigger the "preview" behavior, overwriting whatever property value was previously set. The Quick Open window itself still displays the first item in its list as being selected; in the future, it could be nice to have the currently resource for the property be highlighted instead, but IMO the behavior now should be good enough. |
KoBeWi
left a comment
There was a problem hiding this comment.
Looks fine now. The MultiNodeEdit part is hacky and could be done cleaner, but this solution is safer.
5db0646 to
e8bd457
Compare
Add toggle for instant preview Always keep search box selected so that keyboard navigation works Add default setting for Instant Preview Directly set property value for resource via Quick Load menu (no undo/redo or dirty-scene functionality yet) Add undo/redo functionality Update class reference Update doc/classes/EditorSettings.xml Co-authored-by: Micky <66727710+Mickeon@users.noreply.github.com> Slight improvement(?) to wording of setting Allow previewing without committing change Address various suggestions/improvements Only allow Instant Preview to be used if Quick Open menu is being used to modify a property Only allow property-based Quick Load when resource to modify is defined (otherwise default to old behavior) Apply suggestions from code review Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com> Address comments/suggestions Get rid of duplicated code and use original callback strategy (Attempt to) fix Instant Preview for editing multiple nodes at once and undo/redo stack for single nodes Fix cancelling Quick Open when multiple nodes are selected Prevent initially selected item in Quick Open dialog from overwriting the currently selected property Apply suggestions from code review Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com> Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Make a few changes/improvements based on feedback - Combine some duplicated code into `_finish_dialog_setup()` - Move `ERR_FAIL_NULL(p_obj);` to top of checks - Fix renaming of `is_instant_preview_enabled()` across code, and remove now-redundant conditions where it is used - Make `EditorResourcePicker::property_path` be `StringName` not `String`
e8bd457 to
2f1e8da
Compare
|
Thanks! |
|
I definitely agree, being able to click through audio files and quickly hear them would be great! Due to how the implementation of Instant Preview works alongside most resource types and how Godot nodes act when they are assigned a new audio resource, Instant Preview doesn't really do anything in their case. We'd specifically have to code the Quick Open dialog to recognize when it's looking for audio resources, and when that is true, start playing the audio resource from a player somewhere. This is something that could be possible for 4.7 or beyond. |
|
I've submitted a PR that adds a (very simple) implementation of AudioStream previewing for Instant Preview 🙂 |

Implements and closes godotengine/godot-proposals#7809.
With this PR, resource references are updated as soon as a new resource is highlighted in the Quick Open dialog. This allows the user to very quickly scroll through resources and preview how they look in the scene.
Video (with music for dramatic effect, of course):
Godot.Quicker.Load.mp4