def clearing(self): self.clearCBs() try: MMessage.removeCallback(self.afterNewSceneCBId) MMessage.removeCallback(self.afterOpenSceneCBId) except: pass
def disconnectCallback(self, signal): """ Disconnect a single callback when it is no longer used. Called when the last signal for this callback is disconnected. """ if signal in self._callbackMap: callback = self._callbackMap.pop(signal) # print 'disconnectCallback', signal MMessage.removeCallback(callback)
def clearing(self): """Clearing method called from maya menu""" self.clearCBs() try: MMessage.removeCallback(self.afterNewSceneCBId) MMessage.removeCallback(self.afterOpenSceneCBId) except: pass
def clearCBs(self, event=None): try: print "removing scriptjob" cmds.scriptJob(kill=self.layerChangedJob, force=True) for cache in self.ABCViewerNode.values(): cache.setSelection("") print "removing callbacks" MMessage.removeCallback(self.newNodeCBMsgId) MMessage.removeCallback(self.delNodeCBMsgId) MNodeMessage.removeCallback(self.NodeNameMsgId) except: pass
def clearCBs(self, event=None): try: print "removing scriptjob" cmds.scriptJob( kill=self.layerChangedJob, force=True) for cache in self.ABCViewerNode.values(): cache.setSelection("") print "removing callbacks" MMessage.removeCallback( self.newNodeCBMsgId ) MMessage.removeCallback( self.delNodeCBMsgId ) MNodeMessage.removeCallback( self.NodeNameMsgId ) except: pass
def set_callback(self, state): """ Toggle selection event callback :param state: checkbox's state :type state: bool | int """ if state and not self.callback: self.callback = MEventMessage.addEventCallback('SelectionChanged', self.update_attributes) self.update_attributes(cmds.ls(sl=True)) elif not state and self.callback: MMessage.removeCallback(self.callback) self.callback = None
def set_callback(self, state): """ Toggle selection event callback :param state: checkbox's state :type state: bool | int """ if state and not self.callback: self.callback = MEventMessage.addEventCallback( 'SelectionChanged', self.update_attributes) self.update_attributes(cmds.ls(sl=True)) elif not state and self.callback: MMessage.removeCallback(self.callback) self.callback = None
def __exit__(self, *args): MMessage.removeCallback(self.cbid)
def clearing(self): self.clearCBs() MMessage.removeCallback( self.afterNewSceneCBId ) MMessage.removeCallback( self.afterOpenSceneCBId )