PDA

View Full Version : repeatLast command & python


meuH
12-08-2010, 12:19 PM
I would like to revisit some quick workflow scripts I made lately by adding the various button commands to the repeatLast queue.
all those scripts are 100% python and I can't get the repeatLast command to work for some reason that eludes me. I hope it's just me being dumb, but I just don't get it.

here's an example pulled from the maya command examples (watch out for the broken indents):

import maya.cmds as cmds
def defaultButtonPush(*args):
print 'Default was pushed.'
cmds.repeatLast(ac=defaultButtonPush, acl="testtest")


cmds.window( width=150 )
cmds.columnLayout( adjustableColumn=True )
cmds.button( label='Default', command=defaultButtonPush )
cmds.showWindow()

when executed and the button pushed, all things are fine.
when I press 'g' to repeat last, I get this error:
<function defaultButtonPush at 0x1C1B0370>;
// Error: <function defaultButtonPush at 0x1C1B0370>; //
// Error: Line 1.1: Syntax error //
I've tried a few variations with some extra functions, but I still get this error.

I would appreciate any infos anyone could have about it.
thanks :)

NaughtyNathan
12-08-2010, 02:12 PM
those errors are MEL errors.. looks like the python repeatLast command is expecting/executing MEL code. This is a known bug with several other python commands that contain some kind of callback and have only been half converted from their native MEL...

:nathaN

meuH
12-08-2010, 02:33 PM
that's what I was afraid of.
I'll look around for a way to easily wrap things with some mel evals if I can.

thanks for you reply :)

CGTalk Moderation
12-08-2010, 02:33 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.