Play AudioStreams when selected in Quick Load with Instant Preview#115746
Play AudioStreams when selected in Quick Load with Instant Preview#115746Meorge wants to merge 1 commit intogodotengine:masterfrom
Conversation
9693f55 to
a728247
Compare
|
Pause and stop controls now appear in the corner of the window when an AudioStream is selected: Godot.Instant.Preview.Audio.v2.Controls.mp4 |
Shouldn't it play using the edited node though? When you preview a texture for a sprite, it displays with proper materials and color, so the same should apply to audio players I think. |
a728247 to
aca4671
Compare
|
I could give that a try! My concern with it was that (as far as I could think) it would involve enabling the In more complex cases, where for example a user has an exported I suppose then we could have it run two ways like this?
|
aca4671 to
b3333d0
Compare
b3333d0 to
40ab923
Compare
|
I've applied the approach I described in my previous comment. If the user is editing an |
|
I think this is a great addition. Just yesterday, I was kind of struggling with the current UX where you have to double-click each audio stream in the file system and then press play in the inspector which felt very cumbersome. Here's what I noticed though:
CleanShot.2026-02-22.at.10.23.37.mp4 |
|
Thanks for your feedback! To address each of your concerns:
That does seem like something it should do. I will add that to the to-do list for this PR 🙂
This is consistent with how the rest of Quick Load/Instant Preview works. If you try to do QL/IP on a Sprite2D's texture property, the texture highlighted in the window won't be previewed in the scene until the user specifically highlights one. While this behavior could be changed so that opening QL/IP immediately previews the first selection, I think that's something that would be better to discuss in its own proposal and implement in a separate PR.
This has a tricky conflict with the existing QL window: it interprets a press of the space bar as typing a space into the search at the top. I definitely agree that having a keyboard shortcut to pause/play tracks would be nice, but we'd have to either a) figure out how the QL/IP window should handle a spacebar press in this situation, or b) find another keyboard shortcut that wouldn't conflict with anything. |
KoBeWi
left a comment
There was a problem hiding this comment.
This is consistent with how the rest of Quick Load/Instant Preview works. If you try to do QL/IP on a Sprite2D's texture property, the texture highlighted in the window won't be previewed in the scene until the user specifically highlights one. While this behavior could be changed so that opening QL/IP immediately previews the first selection, I think that's something that would be better to discuss in its own proposal and implement in a separate PR.
You could at least show audio controls immediately when an AudioStream is selected (highlighted).
| audio_player = memnew(AudioStreamPlayer); | ||
| add_child(audio_player); |
There was a problem hiding this comment.
This could be created on demand.
| bottom_bar->add_theme_constant_override("separation", 3); | ||
| add_child(bottom_bar); | ||
|
|
||
| // Audio controls |
There was a problem hiding this comment.
These could also be created on demand (although that will require more changes I guess).
Makes sense, I will try to add that soon alongside showing/hiding them when IP is toggled! As for the creation of the AudioStreamPlayer and control buttons on-demand, is there a particular benefit this would have (or conversely, a reason why always creating them would have a notable downside)? My thought right now is that if their always being a part of the QL window has a negligible performance cost, it's probably safer to just let them exist quietly and show/hide them as necessary, rather than trying to create them when necessary and needing to always ensure they happen to exist at a given time. The other edits sound good, I'll try to add those soon too. |
Well, the benefit is that it makes the QuickOpenDialog lighter. Not all quick open dialogs are going to be used to pick audio streams. Although not sure how many dialogs are out there, I suppose it's not worth it if the code is going to become much more complex. |
|
Working on the following fixes:
While working on this, I discovered a bug with IP that I'll file shortly and then hopefully work on a fix for. If the QL window is opened when IP is disabled, then IP is enabled and another resource is selected, the preview will not take effect. Only when a second resource is selected will the preview update. (This seems to be unrelated to the audio in IP, so I won't be including it in this PR.) |
c2f3d35 to
cae99bf
Compare
119b447 to
52fe029
Compare
52fe029 to
eb74557
Compare
This PR adds a form of support for AudioStreams in the Quick Load Instant Preview. When a stream is chosen, a child AudioStreamPlayer node of the Quick Open dialog box begins playing the stream. This allows the user to quickly hear the sound or song they selected:
Godot.Instant.Preview.Audio.v2.Controls.mp4