Saturday, April 02, 2011

scripting your "bind" joints into a Quick Select Set

As I mentioned in the videos in the previous post, here is the basic idea of how you'd create a Quick Select Set from your "_BIND_" joints. (thought I'd break it out into a separate post to make it easier to read) . . .
{
string $bind[] = `ls -type joint "*_BIND_*"`;

sets -text "gCharacterSet" -name BindJoints;

for ($obj in $bind) {
    sets -edit -forceElement BindJoints $obj;
    }
}

(it's MEL, btw)
The weird bit of that is the syntax for creating a QSS (sets -text "gCharacterSet" etc). Not sure what that's about . . .
You'll have to change stuff for your own setup (the name you're looking for), but otherwise it's pretty straightforward. It looks for joints, then within that selection, looks for the name you've got (in my case "_BIND_") and adds those to a QSS called BindJoints. I find the QSS a bit easier to use for this purpose than a regular set.
Now if I want a selection that isn't easily grab-able (like in the ribbon spine) I can just grab the QSS from the "Edit" --- "QuickSelectSets" menu and then grab my geo and off I go to binding-world. I'll usually end up adding some code to remove any joint that I don't end up wanting in the bind afterwards (though I try to name things with this in mind, so the end joints on toes, for example, WON'T get the "_BIND_" added to their name, as I don't need them bound.) I'll just add this code to the tail end of any rig I'm scripting (or as a stand alone chunk of code for a custom built rig) and the QSS will be there waiting for me every time I build the rig or want to bind/unbind. Definitely makes things faster to test things out in your rigs. Hope this helps!

No comments:

Post a Comment