Drag and drop multiple audio files onto a ScriptPanel?
-
Hi everyone,
I’m building a custom samplemap editor / instrument builder inside a scripted UI. The goal is to let users drag audio samples from Finder onto a
ScriptPanelkeymap, preview where the zones will land, then drop them to import and map the samples.Single-file drag and drop is working well. I’m using:
Panel.setFileDropCallback("All Callbacks", "*.wav;*.aif;*.aiff", function(f) { if (f.hover) { // update keymap preview from f.x / f.y } if (f.drop) { // import f.fileName } });The problem is multi-file drag/drop from Finder. When I select multiple audio files and drag them over the scripted panel, HISE rejects the drag and the files fly back to Finder. The callback does not seem to fire, so I never get a chance to inspect whether
f.fileNameis an array.I tried:
*.wav;*.aif;*.aiff*.wav,*.aif,*.aiff*.**- a narrow
*.aiftest with only.aiffiles selected
Single-file drop works, but multi-file drop still gets rejected before the callback. The docs say
f.fileNameshould be an array if more than one matching file is dropped, so I assume this should be possible from script.What I’m trying to reproduce is similar to HISE’s native SampleMap Editor behavior: drag multiple samples into the map, then choose a mapping mode like Drop Point, Filename Token Parser, etc. I don’t need to invoke the native dialog directly, but I do need the scripted panel to receive the full dropped file list.
Questions:
- Is
ScriptPanel.setFileDropCallback()expected to accept multi-file drags from Finder on macOS? - Is there a specific wildcard format or callback level required for this?
- Does multi-file drag only work from HISE’s internal file browser rather than Finder?
- Is the native SampleMap Editor using a different internal drag/drop path that isn’t exposed to scripting?
- Is there a workaround, eg. folder drop, Broadcaster, FloatingTile, or using the Sampler/SampleMap editor API?
Any guidance would be hugely appreciated.
-
@CyberGen said in Drag and drop multiple audio files onto a ScriptPanel?:
s there a workaround, eg. folder drop
Folder drop
if you want to only allow folders to be dropped, you need to supply the string "{FOLDER}" as wildcard.
https://docs.hise.audio/scripting/scripting-api/scriptpanel/index.html#setfiledropcallback