PDA

View Full Version : setting a key after selecting hierarchy


DEVILSAN
11-25-2012, 06:43 AM
I am trying to set key by
cmds.button(l='Set Key', c=maya.cmds.setKeyframe)

and before that I have to select hierarchy so i call this function

def selectHierarchy(self,*args):
maya.cmds.ls(sl=True)
maya.cmds.select(hi=True)

but on clicking set key button i get error saying
# Error: No object matches name: False
# ValueError: No object matches name: False #

how do i set key by after selecting the hiearchy?

djx
11-25-2012, 01:08 PM
setKeyframe is being evaluated when you create the button, and returns false.
Try using lambda instead...

maya.cmds.button(l='Set Key', c=lambda x: maya.cmds.setKeyframe())

David

CGTalk Moderation
11-25-2012, 01:08 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.