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
-
@David-Healey Can't even get it to accept the folder to tell you truth, only through browser I can import a folder. It's frustrating, I'm not going to lie, because HISE's own samplemap builder does multi file drag and drop. I can only it to accept a single file at a time.
-
@CyberGen Are you using the latest develop branch?
-
@David-Healey embarasingly no, I'm always afraid to upgrade. I'll try to upgrade.
-
@CyberGen Actually I just tested and dropping multiple files is working for me.
HiseSnippet 827.3ocsU8+SSCDE+tAGBSQkD+CnteZPHPKaNkPLBrwjoBr3PhI9CjasWoGb8tl1afKF9e1+Cz201w1jIfKw9Ca26a26SeuOuWaGqbYIIpXDt3w8iXH7SHc5K0A0CnbIpUCD9oDetf4EqhzrDMZ29QzjDlGBim48FevKLKJ84muaWpfJcYCUgPmn3trOwC45gZau8G4BQSpG6Xd3HdWc6VtJYckP0CvyLDaTD08B5YrCoF2JPP6SSBP3UHT2JN11Uq4UoKk10aiMq5ypTqVUmJ9aZWktIsl8l0rq5fvysmGWqh6no.5Q3Y2U40uSf5JYVBNgmv6JXFAGTGHyYpapDdlWQiVT8.tvq8fBUBBtk1CKayjU1dA4.tG+F8CKeOO0f0vHFs.hKLN7lYL3472f2DfDdDHMaFjVhzwMlGoGZwfmGSZI0rXeJzmFEJY9hJ7MLotB7PpWKjdAqYLHbSDkqYaupE7yxaUr35q+Rq1TIS3TDZaI5bAq2ZM3BNioqqBiTRPnboLykLglcbsDltIvsZ.bq5TgnKzsKWxHYcjTzuzpVkVYsUf+76Ic0bkrrp64KW7GEW.RPhRvVKJlC2rN1.MiM3tud4sF3tkRdnRyNRVNMnhWWz5OM46OQalWfXkPvhmnYCsM9tBrrrWXWV7pVWRE8X23HzZFueO2Cqe6lUOGwQkrkjqOJhkKe2DVTdCAN8kVMnZpgvjqC7KhEq4F3favtDFWynOKPZvRtPqhR8MuKhvORmZcwAjKSmDwgTOOIqqh9NBSvmC4pu4v9vgq3d5.ivGvHT.ieVf1HE.RPaWc0flO.gmQ1QHrFp.cadMLQo75In5wGyLKixM.8hw31F9qLgq6O5xp+gYO66b16gBwkHs4Z2fIiwBS.iPW5+AFy2XsHYOeelqdH.mkz7qS65o6I8eV0Sykmc.UGyM7iC6E1A1x6xfrKAVShgOTvvTyjsMxlJPGlzKU3WvStQGiLN2ny.inPpar5T2rIPyNw4S0.XRl98iEHGXjsbPoSkiVmCgUzm55N9Ucq.2XZCrxzFX0oMvWMsAVaZC70Safu49Cz7Ezc5oUgYiMHzAs2KcMFFumjBLvT1J52HaIsgK -
@David-Healey That did it! I updated to the latest develop branch and multi-file drag/drop istarted working immediately. Thank you much.