Another mel newbie question here I'm affraid. I'm having trouble working out how to perform arithmetic functions on all the elements of an array. I'm hoping that there's some simple syntax or whatever that I'm missing out on. Basically I'm wanting to define a new array from an existing array, but with the values of the new array having had an arithmetic function performed, without having to go through and perform the function on each element individually. Say, <2,3,4,5>, from an existing array of <1,2,3,4>.
I don't belive you can simply add an array with some number ($myArray = $oldArray+3), but a simple for loop will do the trick. //----------start int $myArray[]={1,2,3,4,5}; int $newArray[]; for($i=0;$i{ $newArray[$i]=$myArray[$i]+1; } //--------------end
There may be times that you need to convert from a vector to an array, or vice versa. It's a shame that there's no built-in way to do this in Maya. Vectors are more commonly seen in dynamics and arrays are more commonly seen in manipulating objects, but that isn't necessarily always the case.