I deliberately remove the possibility of catche an exception to see the 
various error. The problem of try / except it is difficult to debug with 
that.

If I understand what you say. The problem in my code is to combine repeat 
and callback into a single function.
So if I repeated my command I also repeated the decorator. I am wrong?

If that's right, I did a test with a print in my wrapper. When I apply my 
command once it print correctly. But when I apply the repeat (G key) my 
print is not enabled.
So I guess it does not raise the decorator but just my command.



This will be useful for repeated small script like that one. It's not my 
script completely, just a tip for you to try: 


import pymel.core as pmc
from path import yourDecorator

class MyClass():

    #   Snap Position
    @classmethod
    @decorator.undo_chunk
    @decorator.repeat_command()
    def snap_position(cls, driver=None, driven=None, position=True, 
rotation=True, space='world'):

        #   Get Selection
        if driver is None:
            driver = pmc.selected()[0]
        if driven is None:
            driven = pmc.selected()[1:]


        #   Get Position
        world_position = driver.getTranslation(space=space)
        world_rotation = driver.getRotation(space=space)


        #   Set
        for MNode in driven:

            if position is True:
                MNode.setTranslation(world_position, space=space)

            if rotation is True:
                MNode.setRotation(world_rotation, space=space)



I did not even try on large script. But he'll have to do it to see if it 
still works properly or not.

-- 
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/8c4690d9-7689-474c-92dc-89db526034b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to