I thought it looked pretty limited to have to approach this by formatting the last command into a string, because that would really limit the functionality to having the correct scope, and wouldn't work very well with arguments that don't string format to a useful value. There is a neat approach in the last comment of this blog post:
http://blog.3dkris.com/2011/08/python-in-maya-how-to-make-commands.html In that example, instead of trying to save the command to a string, he saves the actual python object to a private module global, and sets the repeat command to point at a simple function callback in the same module. On Sat, May 23, 2015 at 5:29 AM Rémi Deletrain <[email protected]> wrote: > with a command format in mel I have a problem. > > The first time you run the script the decorator working properly because > we past a python command. Only when you press G key you past a mel command > in the decorator and it's don't work > > So the command is excecuted properly because it was well implemented, but > the decorator give an error message. It is for this reason that there is a > try / except the party comment. > > -- > 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/3f639559-31c4-47fa-a7a7-630fe4cf1ab6%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/3f639559-31c4-47fa-a7a7-630fe4cf1ab6%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAPGFgA3M%2BTSg7QCUJU%2B1xmfF4FeNuWcY7zeYx5_HMXLPmhTOOQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
