lt-ethe
February 6, 2004, 10:41pm
1
I want to create a Mel script to connect and disconnect the orientation, rotation, and translation of two identical or similar skeletons, thus allowing for rapid attachment and detachment of a control skeleton to a deformation skeleton.
I have no background in scripting, but this functionality is important enough to me, that I'm already diving into every book I can find on MEL scripting to try and make it happen.
While I'm working on this, I want to put out a general query, see if this script already exists, or something similar is out there already.
Let me know, I'm curious, and interested in any feedback.
Ok... I think I've got enough MEL knowledge to be able to attempt this.
How would I go about moving up and down a skeleton hierarchy though?
gdc
February 7, 2004, 4:42pm
3
You will want to get the hierarchy into an array and then loop over it. Some thig like...
string $h1[]=listRelatives -ad -type joint -f "RootJoint"; for($i=0; $i < size($h1); $i++) { // do stuff }
--g
lt-ethe
February 10, 2004, 1:57am
4
Thanks a ton g for the help. That part is definitely usefull. But I apparently have less of a firm handle on MEL then I originally thought.
chews on fist
How do I get MEL to interface with what I select, and then shift select?
I've got something REAL basic, but it's still too much for me,
string $controlSkeleton[] = ls -sl -hd 1; string $deformSkeleton[] = ls -sl -tl 1; connectAttr -f $controlSkeleton.rotate $deformSkeleton.rotate;
// Error: Invalid object or value: joint6 //
I need a little nudge guys... Basic kicked my ass all through highschool, so my head hurts real bad right now.
Thanks
dbiggs
February 10, 2004, 3:10am
5
With Mel you can't just push together variables and attributes like you have. You'll have to do it in a eval() statement something like this..
evalEcho("connectAttr -f "+$controlSkeleton+".rotate "+$deformSkeleton+".rotate");
evalEcho is the same as eval just it will echo the command it run to the script window.
Hope that helps you along.
Dave Biggs
joojaa
February 10, 2004, 9:15am
6
Is a case where you dont need eval, this works also an is easier in many ways.
connectAttr -f ($controlSkeleton+".rotate") ($deformSkeleton+".rotate");
Also you could concatenete teh strings piror into an array containing the entire list of switches and pass tharray simply on to the command it also works!
lt-ethe
February 10, 2004, 11:04pm
7
I wish I could say success. I ripped apart the MEL documenation... Learning a lot for sure, but I can't figure this one out. Anyone else?
string $controlSkeleton[] = ls -sl -hd 1; string $deformSkeleton[] = ls -sl -tl 1;
connectAttr -f ($controlSkeleton+".rotate") ($deformSkeleton+".rotate"); // Error: connectAttr -f ($controlSkeleton+".rotate") ($deformSkeleton+".rotate"); // // Error: Illegal operation "+" on data of type string[]. //
something that might help you is this script:
zooSortToHeirarchy
basically, just give it an array of objects, and it sorts them into a heirarchy order. something like this:
string $sourceRoot = "source_root"; //root of source skeleton string $targetRoot = "target_root"; //root of target string $srcHeirarchy[] = zooSortToHeirarchy( listRelatives -ad -type joint $sourceRoot ); string $tgtHeirarchy[] = zooSortToHeirarchy( listRelatives -ad -type joint $targetRoot ); for( $n=0; $n anyway, i haven't tried that, but something like that should be good...