Maya M.E.L : Is it possible to store an array of type joint? -


hi new mel user , have been playing around , searching around can't figure out:

i trying move joint transform rotation values joint orient values can clean attributes of transforms without losing joint orientation, mel attempt this:


string $joints[]=`ls -type "joint"`;  //print($joints);  int $jnt_count = size($joints);  ($i = 0; $i <= $jnt_count; $i++)  {      int $attr1 = `getattr $joints[i].rotatex`;     int $attr2 = `getattr $joints[i].rotatey`;     int $attr3 = `getattr $joints[i].rotatez`;      setattr $joints[i].jointorientx $attr1;     setattr $joints[i].jointorienty $attr2;     setattr $joints[i].jointorientz $attr3; } 

i hoping array of joints (names), change attributes in manner calling them 1 one, seems cannot way

however! when objecttype $joints[1] test, still return type "joints" , don't why value of array type joints, can't access joint's joint.xxx attributes, can enlighten me on matter or point me in right direction?

must appreciated!

dave

in mel ever strings, floats or integers work - names of objects in scene, not wrappers or handles objects themselves.

in specific example, you'd want this:

string $joints[]=`ls -type "joint"`;  int $jnt_count = size($joints);  ($i = 0; $i <= $jnt_count; $i++)  {       float $attr1 = `getattr ($joints[$i] + ".rotatex")`;      // etc. see how done adding strings       // create string "youjointhere.rotatex", periods , all...      // parens make sure string composed before command called       setattr ($joints[$i] + ".jointorientx") $attr1;      // etc.  same trick } 

if you're new this, can save world of hurt , jumping straight maya python -- it's lot more powerful mel. optional pymel makes easier - original code posted more or less pymel lets do.

edit: forgot $ variable identifier , parens in first version.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -