// SCALE THE SKELETON BY .1 .1 .1 // Program: // attach(); // This script attaches a set of locators from a .v file to a skeleton from a .vsk (use the vicon importer). // NOTE: this script scales the skeleton by .1 // // Usage: // 1. Import .vsk. Import .v // 2. Select skel root and locator root (parent). Source script. // 3. Run "attach()" in the script editor to attach the skeleton to the locators. // // Author: // Ronit Slyper, rys@cs.cmu.edu // // Date: // May 18, 2007 // ====================================== ATTACH JOINTS TO LOCATORS CODE =============================================== global proc attach() { $using_local_bodies = 0; // grab the selected nodes $sel = `selectedNodes`; string $jointroot = $sel[0]; // get the skeleton root string $locatorroot = $sel[1]; // get the locator root // scale the skeleton $c = "setAttr " + $jointroot + ".scale .1 .1 .1"; eval($c); // get a list of all the joints string $alljoints[] = `listRelatives -fullPath -type joint -children -allDescendents $jointroot`; // hook up each joint for ($joint in $alljoints) { // clear selection select -cl; // construct the locator name string $locator = `joint -query -name $joint`; //int $k = size($locator); //$locator = `substring $locator 2 50`; if ($using_local_bodies==1) { $locator = $locator + "_local"; } if (!objExists($locator)) { print "Doesn't exist "; print $locator; print "\n"; continue; } $locator = $locatorroot + "|" + $locator; // print out a little debug $m = "Selecting locator " + $locator + "\n"; print $m; // select the locator and the joint select $locator; select -add $joint; // constrain/connect attributes of the locator to the joint pointConstraint; orientConstraint; } }