I’m wondering what is the best and most efficent way to set diffuse color for multiple objects programmatically.
To be more precise:
I got around 480-520 objects which are named unique. The all got the same material applied. After a certain user interaction I need to “group” these objects. Therefor I got an array with 4 different colors. These colors need to be applied to all the objects by their names. It is also necessary to apply the inital material after a certain user interaction.
My current approach would be, to create 4 new materials (directly in js) with the different colors I need. And then apply each material to the appropriate object.
When I dont need the colors anymore I would simply apply the intial material.
Would this be the best way, or are there other approaches?