def removeNukeCallback(self): '''remove method from Nuke callback list''' yl.debug('nukeDestroyNodeCallback') if '*' in nuke.onCreates and (self.nukeCreateNodeCallback, (), {}, None) in nuke.onCreates['*']: nuke.removeOnCreate(self.nukeCreateNodeCallback) if '*' in nuke.onDestroys and (self.nukeDestroyNodeCallback, (), {}, None) in nuke.onDestroys['*']: nuke.removeOnDestroy(self.nukeDestroyNodeCallback) if '*' in nuke.knobChangeds or (self.nukeSelectionCallback, (), {}, None) in nuke.knobChangeds['*']: nuke.removeKnobChanged(self.nukeSelectionCallback)
def onScriptClose(self): log("onScriptClose") nuke.removeOnDestroy(self.onDestroy) nuke.removeKnobChanged(self.knobChanged) if (self.rvc.connected): log(" disconnecting from rv") #self.rvc.disconnect() self.running = False log(" sleeping after disconnect") time.sleep(0.3)
def onScriptClose (self) : log ("onScriptClose") nuke.removeOnDestroy (self.onDestroy) nuke.removeKnobChanged (self.knobChanged) if (self.rvc.connected) : log (" disconnecting from rv") #self.rvc.disconnect() self.running = False log (" sleeping after disconnect") time.sleep (0.3)
def restoreBegin(self): log("restoreBegin") nuke.removeKnobChanged(self.knobChanged) nuke.removeOnCreate(self.onCreate) nuke.removeOnDestroy(self.onDestroy)
def remove_callbacks(self): """Remove nuke callbacks. """ nuke.removeOnDestroy(ChannelsRename.hide, args=(self)) nuke.removeOnUserCreate(ChannelsRename.hide, args=(self))
def add_callbacks(self): """Add nuke callbacks. """ nuke.removeOnDestroy(ChannelsRename.hide, args=(self)) nuke.addOnUserCreate(ChannelsRename.hide, args=(self))
def coreFunction(self): coreLayout = QtWidgets.QVBoxLayout() tertiary_layout = QtWidgets.QHBoxLayout() label_cwd = QtWidgets.QLabel() label_cwd.setText("Current Working Directory =") tertiary_layout.addWidget(label_cwd) field_cwd = QtWidgets.QLineEdit(label_cwd) field_cwd.setText(self.SCRIPT_DIR) field_cwd.setFont(self.italicFont) field_cwd.setStyleSheet('color: rgb(128, 128, 128)') field_cwd.setReadOnly(1) tertiary_layout.addWidget(field_cwd) coreLayout.addLayout(tertiary_layout) #--- BEGIN TABS ---# #initializes the 'tabBar' 'QtWidgets.QTabWidget()' object, and adds both 'tab_readNodes' and 'tab_writeNodes' to it as 'QtWidgets.QWidget()' objects tabBar = QtWidgets.QTabWidget() self.tab_readNodes = QtWidgets.QWidget() self.tab_writeNodes = QtWidgets.QWidget() tabBar.addTab(self.tab_readNodes, 'Read Nodes') tabBar.addTab(self.tab_writeNodes, 'Write Nodes') #creates 2 instances of 'QtWidgets.QVBoxLayout' within both the 'tab_readNodes' and 'tab_writeNodes' objects based on the current working Nuke script self.tab_readNodes.layout = QtWidgets.QVBoxLayout() self.tab_writeNodes.layout = QtWidgets.QVBoxLayout() #--- BEGIN READ NODES TABLE ---# #initializes the 'table_readNodes' 'QtWidgets.QTableWidget()' object with default parameters self.table_readNodes = QtWidgets.QTableWidget() self.table_readNodes.setColumnCount(3) self.table_readNodes.setHorizontalHeaderLabels( ['Absolute Pathnames', 'Relative Pathnames', 'Disable/Enable']) self.table_readNodes.setWordWrap(0) self.table_readNodes.setRowCount(0) #calls the 'generateReadsData()' private method that will populate the 'table_readNodes' object based on the current Nuke working script self.generateTable_reads() #try: # #removes the custom 'nuke.onCreate()' callback that was created within th the 'pathConverter_window' class. This prevents duplicate callbacks from being created. # nuke.removeOnUserCreate(self.generateTable_reads) # print "TRY statement was succesful." #except: # print "TRY statement has encountered an error. Now printing the EXCEPTION." # nuke.addOnUserCreate(self.generateTable_reads) #if self.generateTable_reads in nuke.onUserCreates.values(): # nuke.removeOnUserCreate(self.generateTable_reads) #nuke.addOnUserCreate(self.generateTable_reads) nuke.removeOnUserCreate(self.myFunction, nodeClass='Read') nuke.removeOnDestroy(self.myFunction, nodeClass='Read') nuke.addOnUserCreate(self.myFunction, nodeClass='Read') nuke.addOnDestroy(self.myFunction, nodeClass='Read') #if self.myFunction in nuke.onUserCreates['Read']: # print str(self.myFunction) + ' exists within the nuke.addOnUserCreates dictionary.' # nuke.removeOnUserCreate(self.myFunction) #----------------------- self.tab_readNodes.layout.addWidget(self.table_readNodes) self.tab_readNodes.setLayout(self.tab_readNodes.layout) #----------------------- #within the 'self.table_readNodes' object, whenever a selection change occurs, invoke the 'self.__changeSelection_reads' function self.table_readNodes.itemSelectionChanged.connect( self.__changeSelection_reads) #--- END READ NODES TABLE ---# #--- WRITE NODES TABLE ---# #initializes the 'table_writeNodes' 'QtWidgets.QTableWidget()' object with default parameters self.table_writeNodes = QtWidgets.QTableWidget() self.table_writeNodes.setColumnCount(3) self.table_writeNodes.setHorizontalHeaderLabels( ['Absolute Pathnames', 'Relative Pathnames', 'Disable/Enable']) self.table_writeNodes.setWordWrap(0) self.table_writeNodes.setRowCount(0) #calls the '__generateWritesData()' private method that will populate the 'table_writeNodes' object based on the current working Nuke script self.generateTable_writes() #within the 'self.table_writeNodes' object, whenever a selection change occurs, invoke the 'self.__changeSelection_writes' function self.table_writeNodes.itemSelectionChanged.connect( self.__changeSelection_writes) #-------------------------- self.tab_writeNodes.layout.addWidget(self.table_writeNodes) self.tab_writeNodes.setLayout(self.tab_writeNodes.layout) #-------------------------- #--- END WRITE NODES TABLE ---# #adds the 'tabBar' object to the 'coreLayout' 'QtWidgets.Layout()' object coreLayout.addWidget(tabBar) #--- END TABS ---# txt_os = QtWidgets.QLabel() txt_os.setText(platform.platform()) txt_os.setAlignment(QtCore.Qt.AlignRight) coreLayout.addWidget(txt_os) self.primary_layout.addLayout(coreLayout)
def removeNukeCallBacks(self): try: nuke.removeOnUserCreate(self.refreshListOfNodes) nuke.removeOnDestroy(self.refreshListOfNodes) except: pass
def restoreBegin (self) : log ("restoreBegin") nuke.removeKnobChanged (self.knobChanged) nuke.removeOnCreate (self.onCreate) nuke.removeOnDestroy (self.onDestroy)
def __removeCallbacks(self): ''' Call this method when the UI is being closed in order to remove any callbacks to update the UI which will no longer be required''' nuke.removeOnCreate(self.updateNodeTree) # Remove callback responsible for updating the UI when nodes are created nuke.removeOnDestroy(self.updateNodeTree) # Remove callback responsible for updating the UI when nodes are destroyed