I try to make myself a reusable and scalable attribute switcher. The idea is to have a list of attributes stored in a list, and for each of them trigger the attribute.
I do have a working base for one unique attribute:
string $myAttr = "myObject1.holdOut";
setAttr $myAttr (!`getAttr $myAttr`);
But I struggle when I want to have the scalable version using an array and a for loop:
string $myAttr[] = {"myObject1.holdOut", "myObject2.holdOut"};
for ($i = 0; $i < `size $myAttr`; $i++){
print ($myAttr[$i] + "\n");
setAttr $myAttr[$i] (!`getAttr $myAttr[$i]`);
}
It retrurns line 4.47 "$myAttr" is not an array
What do I have wrong ?