run the script with ctrl and without ctrl press button

20 views
Skip to first unread message

delibrax

unread,
Sep 28, 2018, 11:47:27 AM9/28/18
to Python Programming for Autodesk Maya
Hi there,

I have two function here,

def locator(obj):
    mc.select(cl=1)
    loc = mc.spaceLocator()
    cls = mc.cluster(obj)
    mc.parentConstraint(cls, loc, mo=0)
    mc.delete(cls)
    return obj


and another one is here

def snapLocator(obj):
    for i in obj:
        mc.select(cl=1)
        loc = mc.spaceLocator()
        cls = mc.cluster(i)
        mc.parentConstraint(cls, loc, mo=0)
        mc.delete(cls)
    return obj

Because both of them is quite similar so I'm thinking to make those in one function. And with that situation I would like to run in maya with pressing ctrl button and without ctrl button keyboard like hotkeys  as maked difference command. Any idea about if else statement on this case? Thank you.

Justin Israel

unread,
Sep 28, 2018, 3:24:43 PM9/28/18
to python_in...@googlegroups.com
What about making one call the other? 

def snapLocator(obj):
    for i in obj:
        locator(I)
    return obj

--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/fe48e04a-98dd-4441-839f-80a003e2f0c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages