Home Technical Talk

[Maya-Melscript] How would I set Values on an Array of attributes? (Using an array of values)

StephenVyas
polycounter lvl 18
Offline / Send Message
StephenVyas polycounter lvl 18
Hi guys,
Say, I have two Arrays. 
     A name array
     A value array

I'd like to change the values of the nameArray, by using the values from the valueArray.
Essentially this...
setAttr nameArray[0] valueArray[0];
setAttr nameArray[1] valueArray[1];

Unfortunately, I only know how to access or move through one array at a time.

say we have this...

string $nameArray[] = {"object.attribute0", "object.attribute1", "etc..."};
string $valueArray[] = {"0","1", "etc...."};

proc $setattrOnNameArray(string $nameArray[], string $valueArray[]){

      for ($node in $nameArray){
      $node = `setAttr $node $valueArray[0... I'd like to increase this number to correspond with the next node];

      }

}

How would I go about doing this.. Any ideas? 

Replies

Sign In or Register to comment.