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.


Log in to reply
 

6
Online

546
Users

2.0k
Topics

16.0k
Posts