Can some one share examples of custom context tool realisation via python ?
There are a lot of examples on C++ in books and documentation. 
But no python scripts. The python scripts i googled are more like a dummy.

Here is a dummy script:
import maya.cmds as cmds
import maya.OpenMaya as om
import maya.OpenMayaMPx as mpx
import sys

pluginCtxName = "CustomContext"

class CustomSelectContext(mpx.MPxSelectionContext):
    def __init__(self):
        mpx.MPxSelectionContext.__init__(self) 
    
    def doPress(self, event):
        print ('SHLOOOOOOOOOOOOOOOOMP')
        
class CommandCreator(mpx.MPxContextCommand):
    def __init__(self):
        mpx.MPxContextCommand.__init__(self)
    
    def makeObj(self):
        return mpx.asMPxPtr(CustomSelectContext())    


def initializePlugin(mobject):
    mplugin = mpx.MFnPlugin(mobject)
    try:
        mplugin.registerContextCommand( pluginCtxName, CommandCreator )  
    except:
        print "Failed to register context command: %s" % pluginCtxName
        raise


def uninitializePlugin(mobject):
    mplugin = mpx.MFnPlugin(mobject)
    try:
        mplugin.deregisterContextCommand(pluginCtxName)
    except:
        print "Failed to deregister context command: %s" % pluginCtxName
        raise

I am looking for something more complex.

-- 
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/58cfba89-c5ba-4bc5-b0da-9946bb37f997%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to