DangerAhead
08-16-2005, 10:12 PM
I'm trying to connect the weight attr of a point constraint to a locator's Attribute.
Neither setDrivenKeyframe or connectAttr are working.
I'm using a function to create the pointConstraint, Then trying to connect it to the locator.
but the error keeps telling me the attribute doesn't exist.
Cut and Paste Into Script Editor and see if you can figure out why it ain't workin`
// two objects to try out
polyCube -n pCube1;
polyCube -n pCube2;
// locator to control point constraint
spaceLocator;
string $sel[] = `ls -sl`;
rename $sel[0] specialtyController;
global proc gmConstrainToLocator (string $constrained, string $locName, string $spec){
select -cl;
string $constraintName[] = `pointConstraint -offset 0 0 0 -weight 0 $locName $constrained`;
select -cl;
addAttr -ln $spec -at double -min 0 -max 1 -dv 0 specialtyController;
setAttr -e -keyable true ("specialtyController." + $spec);
// SET DRIVEN KEY = not working
setDrivenKeyframe -dv 0 -v 0 -itt "flat" -ott "flat" -cd ("specialtyController." + $spec) ($constraintName[0] + "." + $locName + "WO");
setDrivenKeyframe -dv 1 -v 1 -itt "flat" -ott "flat" -cd ("specialtyController." + $spec) ($constraintName[0] + "." + $locName + "WO");
// CONNECT ATTR = not working
//connectAttr -f ("specialtyController." + $spec) ($constraintName[0] + "." + $locName + "WO");
// MANUAL ATTEMPT = not working
// connectAttr -f specialtyController.LGT pCube1_pointConstraint1.pCube2W0;
}
gmConstrainToLocator("pCube1", "pCube2", "abc");
Neither setDrivenKeyframe or connectAttr are working.
I'm using a function to create the pointConstraint, Then trying to connect it to the locator.
but the error keeps telling me the attribute doesn't exist.
Cut and Paste Into Script Editor and see if you can figure out why it ain't workin`
// two objects to try out
polyCube -n pCube1;
polyCube -n pCube2;
// locator to control point constraint
spaceLocator;
string $sel[] = `ls -sl`;
rename $sel[0] specialtyController;
global proc gmConstrainToLocator (string $constrained, string $locName, string $spec){
select -cl;
string $constraintName[] = `pointConstraint -offset 0 0 0 -weight 0 $locName $constrained`;
select -cl;
addAttr -ln $spec -at double -min 0 -max 1 -dv 0 specialtyController;
setAttr -e -keyable true ("specialtyController." + $spec);
// SET DRIVEN KEY = not working
setDrivenKeyframe -dv 0 -v 0 -itt "flat" -ott "flat" -cd ("specialtyController." + $spec) ($constraintName[0] + "." + $locName + "WO");
setDrivenKeyframe -dv 1 -v 1 -itt "flat" -ott "flat" -cd ("specialtyController." + $spec) ($constraintName[0] + "." + $locName + "WO");
// CONNECT ATTR = not working
//connectAttr -f ("specialtyController." + $spec) ($constraintName[0] + "." + $locName + "WO");
// MANUAL ATTEMPT = not working
// connectAttr -f specialtyController.LGT pCube1_pointConstraint1.pCube2W0;
}
gmConstrainToLocator("pCube1", "pCube2", "abc");
