PDA

View Full Version : SetAttr and HumanIK


kogen
01-04-2013, 04:33 PM
Hello guys,

I have quite a problem I cannot solve and it's so damn basic... maybe someone with a bit more experience can point out my fault.
I have created a Human IK rig (Create skeleton + Create controllers). Afterwards I want to run those two lines of code:

import maya.cmds as cmds
cmds.setAttr('Character1_Ctrl_LeftArm'+'.scaleX', k = True, l = False)

Which should make the LeftArm Controller.scaleX keyable and should unlock it was well. But it does not unlock it :(
The funny thing is, when I manually hit "Unlock Selected" via the Channel Box, it works. Afterwards I'm able to lock and unlock it via code. To me this behavior is pretty strange and I'd be grateful if someone could help me.

Thanks in advance

ko'gen

kogen
01-04-2013, 09:58 PM
Allright, problem solved.
I was not aware that unlocking "scaleX", "scaleY" and "scaleZ" is not the same as unlocking "scale". So using these lines works:

import maya.cmds as cmds
cmds.setAttr('Character1_Ctrl_LeftArm'+'.scale', k = True, l = False)

CGTalk Moderation
01-04-2013, 09:58 PM
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.