Filter Mode Dropdown Bug
-
-
@tod-slaughter The combo box returns a number starting at 1 and it seems the order of the filter names doesn't line up with the numbers so you have three options, reorder the names in your combo box, convert the numbers to the correct filter numbers via script, or wait for Christoph to offer a better solution :)
@Christoph-Hart This doesn't seem to work
const var modes = Engine.getFilterModeList(); for (k in modes) { Console.print(k); }
-
@d-healey
re-ordering the names causes a crash unfortunately -
@tod-slaughter Could you post a snippet demonstrating the crash?
-
I'd have to reproduce it via trial and error
-
The filter IDs are not subsequent because it would prevent me from adding new filters without breaking backwards compatibility. That's why the FilterModeList object is there. Basically you create a custom array containing all filters you need and add get the correct filter ID via this code:
const var modes = Engine.getFilterModeList(); const var myFunkyFilters = [modes.LowPass, modes.StateVariableNotch]; comboBox.addItem("LowPass"); comboBox.addItem("Notch Funky Yeah"); inline function onComboBoxControl(component, value) { local filterIndex = value - 1; filter.setAttribute(filter.Mode, myFunkyFilters[filterIndex]); }
Protip: If you type
modes.
and press Escape you get a dropdown with all filter modes available.