View Single Post
# 2 05-03-2015 , 08:51 AM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
The strings for the object and attribute your setAttr statement is supposed to act on, are not concatenated correctly. Use parentheses to create an expression that joins these strings properly to create a valid object name and since Maya will evaluate its contents first, now the rest of the statement knows what its working with.

setAttr -k on ("PLC." + $name);

or

setAttr -k on ("PLC" + "." + $name);

I put double quotes around PLC to denote that its a string so Maya doesn't freak out and tell me I'm using PLC incorrectly because it doesn't know for sure what it is.

Also, sometimes you might want to avoid hardcoding names into your script as it cuts down on flexibility but thats another thing altogether.

Hope that helps.


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::