For works in mel add this script in start :
import maya.mel as mel
import pymel.core as pmc
from pymel.all import mel as pm
mel.eval("""
global proc callLastCommand(string $function)
{
repeatLast -ac $function -acl "blah-blah....";
}
"""
)
and with mel proedure:
def repeat_command(function):
def wrapper(*args, **kwargs):
modules = ''
arguments = args
if [x for x in ['cls', 'self'] if x in function.func_code.co_varnames]:
arguments = args[1:]
modules = '%s.' % args[0]
args_string = ''
if args:
for each in arguments:
args_string = '%s, ' % each
kwargs_string = ''
if kwargs:
for key, item in kwargs.iteritems():
kwargs_string = '%s=%s, ' % (key, item)
ret = function(*args, **kwargs)
repeat_command = '%s%s(%s%s)' % (modules, function.__name__,
args_string, kwargs_string)
if not args_string == '' and not kwargs_string == '':
repeat_command = '%s%s(%s, %s)' % (modules, function.__name__,
args_string, kwargs_string)
# pmc.repeatLast(addCommand='import qdTools\n%s\n' % repeat_command,
addCommandLabel='qdCommand')
try:
pm.callLastCommand('python("import qdTools;%s")' % repeat_command)
except:
pass
return ret
return wrapper
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/d4485559-eb30-4aa8-8d31-d6eec4f695f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.