Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an AudioStreamRandomizer when dropping several files on an AudioStream field #7798

Open
mieldepoche opened this issue Sep 22, 2023 · 4 comments

Comments

@mieldepoche
Copy link

mieldepoche commented Sep 22, 2023

Describe the project you are working on

stuff

Describe the problem or limitation you are having in your project

AudioStreamRandomisers's individual streams have to be set one by one:

  1. add element
  2. drag the stream to the new empty slot

this is hell

Describe the feature / enhancement and how it helps to overcome the problem or limitation

when selecting a bunch of say, wav files, and dragging those on a AudioStream field anywhere, it should create an AudioStreamRandomiser with the streams set automatically.
(note: a more general solution to this hellish problem would be allowing dropping several files on any Array field, but this is still valid as creating a resource each time is painful (even more so considering it's basically the only AudioStream you'll create manually more than once or twice in the list))

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

  1. you select your files
  2. you drag them on the field
  3. a new AudioStreamRandomiser is created and setup

If this enhancement will not be used often, can it be worked around with a few lines of script?

used very often

Is there a reason why this should be core and not an add-on in the asset library?

it's about relieving pain

@Calinou
Copy link
Member

Calinou commented Sep 22, 2023

I doubt we have support for dragging multiple files onto a property in general (even for Array properties), so this will require the inspector to be able to react to multiple files being dragged first.

PS: This would also make sense for creating StandardMaterial3D based on the names of textures dragged (albedo, normal, etc). See #2316.

@Trotim
Copy link

Trotim commented Sep 29, 2023

Trying it in 4.1.1.stable, an export Array[AudioStream] can in fact already have multiple sound files dragged onto it and creates an element for each as expected? The AudioStreamPlayer Stream property and AudioStreamRandomizer however don't support that

@narredev
Copy link

narredev commented Oct 8, 2023

The AudioStreamRandomizer array is a custom one (for the weight slider I assume), bus as @Trotim noted, the regular Array exports already support drag and droping multiple files or nodes already.

I think the problem with the custom array is that it lacks the slot/button where you click to open an exported array:
image
That's where you drop them

The AudioStreamRandomizer only has the "add element" button:
image

I would prefer this proposal solution but if it really can't be accomplished yet, could a simple or temporary one be to add the "multiple drop" code from the regular arrays to the custom "add element" button? Edit: I don't know c++ or much of how the engine source works but I read the audio_stream.cpp file, I thought the "Add element" button was some kind of special _get_property_list button or a custom inspector thing, but it seems it's actually the same exact button from the exported array (I think, not really sure tbh), so my solution would require to modify it, I don't know if that would fall unto another proposal.

Maybe there could be a way to export the streams as a regular array and add the weight slider on the AudioStream PropertyList itself? But since it's read only it may not be possible...

@aXu-AP
Copy link

aXu-AP commented Jan 22, 2024

I just stumbled upon this idea today, while making a randomizer with 15 ambient sounds. It was painful, especially with default layout (inspector and filesystem are at the at the opposing corners of the editor).

I think it might be doable within AudioStreamRandomizerEditorPlugin by adding a custom control below the array which acts as a drop area. Dropping audiostreams to it would add them to the arrays. Maybe this area could be visible only when user is dragging files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants