GetAllComponents
-
IS there a way to get an array of all components in my interface?
I'd like to be able to inspect them and change some colours programatically - so this would be a nice to have...
-
That would be very handy. I propose to do it in two stages though, first get an
idList
of all components (similar to Synth.getIdList();) and then have another function to get an object containing all of the components in the ID list.This way you can filter the list with the usual string commands before grabbing the components. It also means that if you are just changing a parameter like the colour you don't need to actually store a reference to the component you could just do something like
Content.getComponentName(idList[i]).set("colour", 0xFF00FF00);
-
Yes, it's an easy addition in fact it's so easy that David could do it himself :)
But I would add a regex filter and directly return a list of references:
// Empty string will return all components for(c in Content.getComponentList("")) c.set("saveInPreset", false);
This will be faster than just returning a array of IDs which has to iterate over the entire list again to get the actual component in the for loop.
-
Bump bump :)
-
Could we also have functions to getAllEffects and getAllModulators?
-
Well I discovered the other day we already have
getAllModulators
and it's fantastically useful!My new requests
getAllComponents();
getAllEffects();
getAllScriptProcessors();
Or is this just as efficient?const var processorIds = Synth.getIdList("Script Processor"); const var scriptProcessors = []; for (id in processorIds) scriptProcessors.push(Synth.getMidiProcessor(id));
-
@d-healey That'll be useful for sure! But why do you push everything in an array, is it not an array you get in the first place?
-
@ustk
getIdList
just returns the names of all of the scripts, so I use that to get the actually scripts which are pushed to the array. -
@d-healey Don't pay attention... Was just an idiot...
Synth.getMidiProcessor(id)
-
@Christoph-Hart said in GetAllComponents:
in fact it's so easy that David could do it himself :)
Turns out you were correct! I've done it. I'll try doing it for effects and script processors too then I'll make a pull request!
Update: I've added a
getAllEffects
function. I don't think I'll bother with one for script processors as the simple solution I posted above works just fine.I've created pull requests but if you want the changes sooner they are available in the getAllFunctions branch of my fork.