can't access Attr in Block of Code?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 08 August 2005   #1
can't access Attr in Block of Code?

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");
 
 
 
Old 08 August 2005   #2
to connect to a constraint its w (for weight) then a NUMBER (for index)

you had "W" then the letter "O" rather than the number "0"...

they look the same.. remember its an index.. if you had constrained it to 2 things, the next would be ($constraintName[0] + "." + "whatEverYouConstrainedTo" + "W1")

the below works, I just changed letters for numbers...

.j

// 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 + "W0");
 	setDrivenKeyframe -dv 1 -v 1 -itt "flat" -ott "flat" -cd ("specialtyController." + $spec) ($constraintName[0] + "." + $locName + "W0");
  
 	// CONNECT ATTR = not working
 	//connectAttr -f ("specialtyController." + $spec) ($constraintName[0] + "." + $locName + "W0");
  
 // MANUAL ATTEMPT = not working
 // connectAttr -f specialtyController.LGT pCube1_pointConstraint1.pCube2W0;
  
  
 }
  
 gmConstrainToLocator("pCube1", "pCube2", "abc");
__________________
Make something idiot proof and they'll just build a better idiot
 
Old 08 August 2005   #3
thanks a million

Homer rocks again.

In Navajo you would be called "Oho Agilla" (sp?). Which means "Eagle Eye".

I think it's Navajo. Could be Spanish.

Thanks. I was pulling my hair out. I knew it should've been a zero, but I must have typed an "O".

If you're ever in SF, I'll buy you 2 beers!
 
Old 08 August 2005   #4
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:27 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.