Ah, wasn't aware of the MUserEventMessage class... thanks Amorano - Ofer www.mrbroken.com
On Fri, Jan 28, 2011 at 5:31 PM, Amorano <[email protected]> wrote: > N.B. Off the top of my head, but the jist: > > import maya.OpenMaya as om > callback_traceScript = 'traceScriptCall' > > class testEvent(object): > """ > """ > def __init__(self): > """ > """ > om.MUserEventMessage.registerUserEvent(callback_traceScript) > callbackid = > om.MUserEventMessage.addUserEventCallback(callback_traceScript, > self.__callback_traceScriptCall) > > def __callback_traceScriptCall(self, scriptName): > """ > Do Something Magical > """ > pass > > ev = testEvent() > om.MUserEventMessage.postUserEvent(callback_traceScript, 'I am super > fancy pants') > > ============================================ > > So, like Ofer said, you still have to "explicitly" cast your event at > Maya so Maya can then pass it around. > > HTH > > > On Jan 26, 2:05 pm, cuchullain <[email protected]> wrote: > > I'm working on a Python plugin and I'd like it to be able to emit an > event > > so that other python scripts running in Maya can respond to this event. > > > > I guess what I want is to be able to define and then emit a custom > > OpenMaya.MSceneMessage - say for example kCoffeeReady. My other scripts > > would be able to do something like: > > > > OpenMaya.MSceneMessage.addCallback(OpenMaya.MSceneMessage.kCoffeeReady, > > self.add_milk) > > > > Is that possible? I'm having a hard time grokking the documentation. > > > > D > > -- > http://groups.google.com/group/python_inside_maya > -- http://groups.google.com/group/python_inside_maya
