def runPane(): paneExistsCheck = nuke.getPaneFor('org.vfxwiki.nuketoolkit') if not paneExistsCheck: pane = nuke.getPaneFor('Properties.1') nukescripts.registerWidgetAsPanel('toolSetWidget', 'openNuke', 'org.vfxwiki.nuketoolkit', True).addToPane(pane) else: nuke.message("errr. unable to load pane, as it already exists. \nClose the 'WebTools' pane, and try again.")
def runPane(): paneExistsCheck = nuke.getPaneFor('org.vfxwiki.nuketoolkit') if not paneExistsCheck: pane = nuke.getPaneFor('Properties.1') nukescripts.registerWidgetAsPanel('toolSetWidget', 'openNuke', 'org.vfxwiki.nuketoolkit', True).addToPane(pane) else: nuke.message( "errr. unable to load pane, as it already exists. \nClose the 'WebTools' pane, and try again." )
def main(): if not nuke.getPaneFor('HCom-guillaumej'): pane = nuke.getPaneFor('Properties.1') panels.registerWidgetAsPanel( __name__ + '.HComLauncherPanelWidget', 'HCom', 'HCom-guillaumej', create=True).addToPane(pane) t = threading.Thread(target=checkForHCom) t.start() else: nuke.message('HCom already opened')
def main(): if not nuke.getPaneFor('HCom-guillaumej'): pane = nuke.getPaneFor('Properties.1') panels.registerWidgetAsPanel(__name__ + '.HComLauncherPanelWidget', 'HCom', 'HCom-guillaumej', create=True).addToPane(pane) t = threading.Thread(target=checkForHCom) t.start() else: nuke.message('HCom already opened')
def dock(cls): """Dock pyblish panel in same pane of properties, or pop it out. """ window_ = cls.instance if not window_: try: mainwindow_ = mainwindow() pane = nuke.getPaneFor('Properties.1') if pane: panel = restorePanel('com.wlf.pyblish') panel.addToPane(pane) else: window_ = Window(mainwindow_) window_.show() except RuntimeError: window_ = Window() window_.show() else: try: window_.activate() except RuntimeError: LOGGER.error('Window already deleted.') cls.instance = None cls.dock()
def registerUiPySide(func, title=None, panel=None): """ Register the UI as a panel Args : func = Name of Function to be called (str) title = title of the tool (str) panel = Panel name (default='Properties', 'Viewer') Example : nl.gui.registerUiPySide("Boilerplate") nl.gui.registerUiPySide("Boilerplate", panel="Viewer") nl.gui.registerUiPySide("Boilerplate", panel="Viewer", title="MyNewWidow") :param func: str :param title: str :param panel: :return: """ if panel == 'Properties' or panel == None: panel = 'Properties.1' elif panel == 'Viewer': panel = 'Viewer.1' if title == None: title = '{}_UI'.format(func) pane = nuke.getPaneFor(str(panel)) pane_ui = nukescripts.panels.registerWidgetAsPanel( widget=str(func), name=str(title), id='uk.co.thefoundry.{}_pane'.format(title), create=True) pane_ui.addToPane(pane)
def add_to_pane(): """Add or move PythonEditor to the current or default pane. Only one instance of the PythonEditor widget is allowed at a time. BUG: This now seems to disagree greatly with the "Reload Package" feature, causing many a segfault. """ # nuke-specific imports in here so that PythonEditor works outside of nuke. import nuke from nukescripts.panels import __panels # is the active pane one of the ones we want to add Python Editor to? candidates = ['Viewer.1', 'Properties.1', 'DAG.1'] for tab_name in candidates: dock = nuke.getPaneFor(tab_name) if dock is None: continue break else: # no "break"? use thisPane dock = nuke.thisPane() import PythonEditor try: # if the panel exists already, it's # likely the user is trying to move it. ide = PythonEditor.__dock ide.addToPane(dock) except AttributeError: nuke_panel = __panels.get(PANEL_NAME).__call__(pane=dock)
def checkForHCom(): ''' This is used to check if HCom Panel has been closed. If Yes, disconnect the client from the server ( it acts like a "close panel callback" ) ''' while 1: if nuke.getPaneFor('HCom-guillaumej'): continue if HComNukeClient.bgsrv: try: HComNukeClient.bgsrv.stop() except: pass if HComNukeClient.server_conn: try: HComNukeClient.server_conn.close() except: pass NukeGlobals.HCOMCLIENT = None NukeGlobals.MAIN_UI = None break time.sleep(1)
def dock_in_nuke(): import nuke from nukescripts import panels pane = nuke.getPaneFor("io.cyclopsvfx.Brontes_nuke") panels.registerWidgetAsPanel('nuke_brontes.Brontes_nuke', 'Brontes_nuke', 'io.cyclopsvfx.Brontes_nuke', True).addToPane(pane)
def install(): import nuke import nukescripts.panels nukescripts.panels._kabaret_studio_widget = KabaretPanel pane_name = 'Kabaret Studio' pane_id = 'com.supamonks.kabaret.studio' class Panel(nukescripts.panels.PythonPanel): def __init__(self): super(Panel, self).__init__(pane_name, pane_id) self.customKnob = nuke.PyCustom_Knob( pane_name, '', '__import__("nukescripts").panels.WidgetKnob(' '__import__("nukescripts").panels._kabaret_studio_widget' ')') self.addKnob(self.customKnob) addPanel = lambda: Panel().addToPane() menu = nuke.menu('Pane') menu.addCommand(pane_name, addPanel) nukescripts.panels.registerPanel(pane_id, addPanel) pane = nuke.getPaneFor('DAG.1') Panel().addToPane(pane)
def run_nuke(): """Run in Nuke Note: If you want the UI to always stay on top, replace: `boil.ui.setWindowFlags(QtCore.Qt.Tool)` with: `boil.ui.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)` If you want the UI to be modal: `boil.ui.setWindowModality(QtCore.Qt.WindowModal)` """ _nuke_delete_ui() # Delete any alrady existing UI if not DOCK_WITH_NUKE_UI: boil = Boilerplate(parent=_nuke_main_window()) boil.setWindowFlags(QtCore.Qt.Tool) boil.show() # Show the UI elif DOCK_WITH_NUKE_UI: prefix = '' basename = os.path.basename(__file__) module_name = basename[:basename.rfind('.')] if __name__ == module_name: prefix = module_name + '.' panel = nukescripts.panels.registerWidgetAsPanel( widget=prefix + 'Boilerplate', # module_name.Class_name name=WINDOW_TITLE, id='uk.co.thefoundry.' + WINDOW_TITLE, create=True) pane = nuke.getPaneFor('Properties.1') panel.addToPane(pane) boil = panel.customKnob.getObject().widget _nuke_set_zero_margins(boil)
def run_nuke(): """Run in Nuke Note: If you want the UI to always stay on top, replace: `boil.ui.setWindowFlags(QtCore.Qt.Tool)` with: `boil.ui.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)` If you want the UI to be modal: `boil.ui.setWindowModality(QtCore.Qt.WindowModal)` """ _nuke_delete_ui() # Delete any alrady existing UI if not DOCK_WITH_NUKE_UI: boil = Boilerplate(parent=_nuke_main_window()) boil.setWindowFlags(QtCore.Qt.Tool) boil.show() # Show the UI elif DOCK_WITH_NUKE_UI: prefix = '' basename = os.path.basename(__file__) module_name = basename[: basename.rfind('.')] if __name__ == module_name: prefix = module_name + '.' panel = nukescripts.panels.registerWidgetAsPanel( widget=prefix + 'Boilerplate', # module_name.Class_name name=WINDOW_TITLE, id='uk.co.thefoundry.' + WINDOW_TITLE, create=True) pane = nuke.getPaneFor('Properties.1') panel.addToPane(pane) boil = panel.customKnob.getObject().widget _nuke_set_zero_margins(boil)
def addSRPanel(): '''Run the panel script and add it as a tab into the pane it is called from''' global mySRPanel mySRPanel = SearchReplacePanel() mySRPanel.show() pane = nuke.getPaneFor('Properties.1') return mySRPanel.addToPane(pane)
def run_nuke(self, **kwargs): """Run in Nuke Note: If you want the UI to always stay on top, replace: `boil.ui.setWindowFlags(QtCore.Qt.Tool)` with: `boil.ui.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)` If you want the UI to be modal: `boil.ui.setWindowModality(QtCore.Qt.WindowModal)` """ _nuke_delete_ui(self.window_object) # Delete any alrady existing UI if "dockable" in kwargs and kwargs["dockable"]: widgetname = ("{}.{}").format( self.guiClass.__module__, self.guiClass.__name__ ) panel = nukescripts.panels.registerWidgetAsPanel( widget=widgetname, # module_name.Class_name name=self.window_title, id="uk.co.thefoundry." + self.window_title, create=True, ) pane = nuke.getPaneFor("Properties.1") panel.addToPane(pane) self.boil = panel.customKnob.getObject().widget _nuke_set_zero_margins(self.boil) else: self.boil = self.guiClass( _nuke_main_window(), self.window_title, self.window_object ) self.boil.setWindowFlags(QtCore.Qt.Tool) self.boil.show() # Show the UI
def addColorPalettePanel(): global colorPalettePanel try: colorPalettePanel = nukescripts.registerWidgetAsPanel('nuke.ColorPalettePane', 'Color Palette', 'ColorPalettePane') colorPalettePanel.addToPane(nuke.getPaneFor('Properties.1')) except: colorPalettePanel = nukescripts.registerWidgetAsPanel('nuke.ColorPalettePane', 'Color Palette', 'ColorPalettePane')
def show(self): """Show panel. """ pane = nuke.getPaneFor('Properties.1') if pane: self.addToPane(pane) else: self.is_dialog = True super(PythonPanel, self).show()
def node_collections(): nuke_main_window = _nuke_main_window() # widget = NodePanel() pane = nuke.getPaneFor('DAG.1') widget = NodePanel(parent=pane) # # widget = NodePanel(parent=nuke_main_window) widget.setParent(nuke_main_window) widget.show()
def addKnobScripterPanel(): global knobScripterPanel try: knobScripterPanel = panels.registerWidgetAsPanel(moduleName + 'KnobScripterPane', 'Knob Scripter', 'com.adrianpueyo.KnobScripterPane') knobScripterPanel.addToPane(nuke.getPaneFor('Properties.1')) except: knobScripterPanel = panels.registerWidgetAsPanel(moduleName + 'KnobScripterPane', 'Knob Scripter', 'com.adrianpueyo.KnobScripterPane')
def run(): ## make this work in a .py file and in 'copy and paste' into the script editor moduleName = __name__ if moduleName == '__main__': moduleName = '' else: moduleName = moduleName + '.' pane = nuke.getPaneFor('Properties.1') panels.registerWidgetAsPanel(moduleName + 'NukeConnectGui', 'Jeeves Connect', 'uk.co.thefoundry.NukeConnectGui', True).addToPane(pane)
def find(cls, windowID): """Find which pane the WindowID is docked to.""" current_pane = nuke.getPaneFor(windowID) if current_pane is None: return None for pane_func in cls.__PRIORITY: index = 1 while True: pane = pane_func.__get__(cls, None)(index) if pane is None: break if pane == current_pane: return pane_func.__get__(cls, None)(index, name=True) index += 1
def get_nuke_dock_widget(): from nukescripts import panels import nuke # delete existing dock for obj in QtWidgets.QApplication.allWidgets(): if obj.objectName() == "tapp.dock": obj.deleteLater() pane = nuke.getPaneFor("Properties.1") panel = panels.registerWidgetAsPanel("tapp.docked_widget.Dock", "Tapp", "tapp.dock", True).addToPane(pane) return panel.customKnob.getObject().widget
def runNuke(): moduleName = __name__ if moduleName == '__main__': moduleName = '' else: moduleName = moduleName + '.' dockedWindow = False # Edit this to change between docked window and free floating window (DOES NOT WORK PROPERLY AT THE MOMENT) if dockedWindow: pane = nuke.getPaneFor('Properties.1') panel = panels.registerWidgetAsPanel( moduleName + 'MediaViewer' , windowTitle, ('uk.co.thefoundry.'+windowObject+'Window'), True).addToPane(pane) # View pane and add it to panes menu global gui gui = panel.customKnob.getObject().widget else: global gui gui = MediaViewer() gui.show()
def runNuke(): moduleName = __name__ if moduleName == '__main__': moduleName = '' else: moduleName = moduleName + '.' global gui if launchAsPanel: pane = nuke.getPaneFor('Properties.1') panel = panels.registerWidgetAsPanel( moduleName + 'SearchReplace', windowTitle, ('uk.co.thefoundry.' + windowObject + 'Window'), True).addToPane(pane) # View pane and add it to panes menu gui = panel.customKnob.getObject().widget else: gui = SearchReplace() gui.show()
def dock(window): """ Expecting a window to parent into a Nuke panel, that is dockable. """ # Deleting existing dock # There is a bug where existing docks are kept in-memory when closed via UI if self._dock: print("Deleting existing dock...") parent = self._dock dialog = None stacked_widget = None main_windows = [] # Getting dock parents while parent: if isinstance(parent, QtWidgets.QDialog): dialog = parent if isinstance(parent, QtWidgets.QStackedWidget): stacked_widget = parent if isinstance(parent, QtWidgets.QMainWindow): main_windows.append(parent) parent = parent.parent() dialog.deleteLater() if len(main_windows) > 1: # Then it's a floating window if stacked_widget.count() == 1: # Then it's empty and we can close it, # as is native Nuke UI behaviour main_windows[0].deleteLater() # Creating new dock pane = nuke.getPaneFor("Properties.1") widget_path = "pyblish_nuke.lib.pyblish_nuke_dockwidget" panel = nukescripts.panels.registerWidgetAsPanel(widget_path, window.windowTitle(), "pyblish_nuke.dock", True).addToPane(pane) panel_widget = panel.customKnob.getObject().widget panel_widget.layout().addWidget(window) _nuke_set_zero_margins(panel_widget) self._dock = panel_widget return self._dock
def runNuke(): moduleName = __name__ if moduleName == '__main__': moduleName = '' else: moduleName = moduleName + '.' global gui if launchAsPanel: pane = nuke.getPaneFor('Properties.1') panel = panels.registerWidgetAsPanel( moduleName + 'Main' , windowTitle, ('uk.co.thefoundry.'+windowObject+'Window'), True).addToPane(pane) # View pane and add it to panes menu gui = panel.customKnob.getObject().widget else: if parentToNukeMainWindow: gui = Main( parent=QtGui.QApplication.activeWindow() ) else: gui = Main() #gui.setWindowModality(QtCore.Qt.WindowModal) # Set modality gui.show()
def runNuke(): moduleName = __name__ if moduleName == '__main__': moduleName = '' else: moduleName = moduleName + '.' dockedWindow = False # Edit this to change between docked window and free floating window (DOES NOT WORK PROPERLY AT THE MOMENT) if dockedWindow: pane = nuke.getPaneFor('Properties.1') panel = panels.registerWidgetAsPanel( moduleName + 'MediaViewer', windowTitle, ('uk.co.thefoundry.' + windowObject + 'Window'), True).addToPane(pane) # View pane and add it to panes menu global gui gui = panel.customKnob.getObject().widget else: global gui gui = MediaViewer() gui.show()
def main(): scriptsDir=os.path.dirname(__file__) parentScriptsDir=os.path.dirname(scriptsDir) cacheManagerDir=parentScriptsDir+'/mlCacheManager' #del sys.modules['shotManager'] sys.path.append(cacheManagerDir) from nukescripts import panels nuke.pluginAddPath(cacheManagerDir) import cacheManager reload(cacheManager) from cacheManager import NukeTestWindow win=panels.registerWidgetAsPanel('cacheManager.NukeTestWindow', 'cacheManager', 'farts', True) pane = nuke.getPaneFor('Properties.1') #pane = nuke.getPaneFor('DAG.1') #win.show() win.addToPane(pane)
def runNuke(): moduleName = __name__ if moduleName == '__main__': moduleName = '' else: moduleName = moduleName + '.' global gui if launchAsPanel: pane = nuke.getPaneFor('Properties.1') panel = panels.registerWidgetAsPanel( moduleName + 'HelloWorld', windowTitle, ('uk.co.thefoundry.' + windowObject + 'Window'), True).addToPane(pane) # View pane and add it to panes menu gui = panel.customKnob.getObject().widget else: if parentToNukeMainWindow: gui = HelloWorld(parent=QtGui.QApplication.activeWindow()) else: gui = HelloWorld() #gui.setWindowModality(QtCore.Qt.WindowModal) # Set modality gui.show()
def main(): shotManagerDir = os.path.dirname(mlTools.__file__).replace( "\\", "/") + '/mlShotManager' #del sys.modules['shotManager'] sys.path.append(shotManagerDir) from nukescripts import panels nuke.pluginAddPath(shotManagerDir) from mlTools.mlShotManager import shotManager reload(shotManager) from shotManager import shotManagerWindow win = panels.registerWidgetAsPanel( 'mlTools.mlShotManager.shotManager.shotManagerWindow', 'shotManager', 'farts', True) pane = nuke.getPaneFor('Viewer.1') #pane = nuke.getPaneFor('Properties.1') #pane = nuke.getPaneFor('DAG.1') #win.show() win.addToPane(pane)
def main(): scriptsDir = os.path.dirname(__file__) parentScriptsDir = os.path.dirname(scriptsDir) autoCompDir = parentScriptsDir + '/mlAutoComp' sys.path.append(autoCompDir) from nukescripts import panels nuke.pluginAddPath(autoCompDir) import autoComp reload(autoComp) from autoComp import nukeAutoCompWindow win = panels.registerWidgetAsPanel('autoComp.nukeAutoCompWindow', 'autoComp', 'farts', True) pane = nuke.getPaneFor('Viewer.1') #pane = nuke.getPaneFor('Properties.1') #pane = nuke.getPaneFor('DAG.1') #win.show() win.addToPane(pane)
def add_to_pane(): """ Locates a panel and adds it to one of the main dock windows in order of preference. BUG: This now seems to disagree greatly with the "Reload Package" feature, causing many segfault. """ ui_state = capture_ui_state() if focus_on_panel(ui_state): # the Python Editor tab exists, switch to it. (this should ideally be in focus_on_panel) for tabbar in QtWidgets.QApplication.instance().allWidgets(): if isinstance(tabbar, QtWidgets.QTabBar): for i in range(tabbar.count()): if tabbar.tabText(i) == 'Python Editor': if tabbar.currentIndex() != i: tabbar.setCurrentIndex(i) break return import nuke from nukescripts import panels found = False # is the active pane one of the ones we want to add Python Editor to? dock = nuke.thisPane() candidates = ['Properties.1', 'Viewer.1', 'DAG.1'] for tab_name in candidates: pane = nuke.getPaneFor(tab_name) if pane is not None: dock = pane # to set order of preference break # the current pane was a candidate. done! # this will create the PythonEditor panel and add it to the active pane nuke_panel = panels.__panels.get(PANEL_NAME).__call__(pane=dock)
def run_nuke(): module_name = __name__ if module_name == '__main__': module_name = '' else: module_name = module_name + '.' global gui if NUKE_LAUNCH_AS_PANEL: panel = nukescripts.panels.registerWidgetAsPanel( widget = module_name + '.' + WINDOW_TITLE, name = WINDOW_TITLE, id='uk.co.thefoundry.' + WINDOW_TITLE, create=True) pane = nuke.getPaneFor('Properties.1') panel.addToPane( pane ) gui = panel.customKnob.getObject().widget else: if NUKE_PARENT_TO_NUKE_MAIN_WINDOW: gui = HelloWorld( parent=QtGui.QApplication.activeWindow() ) else: gui = HelloWorld() #gui.setWindowModality(QtCore.Qt.WindowModal) # Set modality gui.show()
def createPanel(): pane = nuke.getPaneFor('com.sashaouellet.ingest') nukescripts.panels.registerWidgetAsPanel('IngestPanel', 'Ingest', 'com.sashaouellet.Ingest', True).addToPane(pane)
def show_panel(self, panel_id, title, bundle, widget_class, *args, **kwargs): """ Shows a panel in Nuke. If the panel already exists, the previous panel is swapped out and replaced with a new one. In this case, the contents of the panel (e.g. the toolkit app) is not destroyed but carried over to the new panel. If this is being called from a non-pane menu in Nuke, there isn't a well established logic for where the panel should be mounted. In this case, the code will look for suitable areas in the UI and try to panel it there, starting by looking for the property pane and trying to dock panels next to this. :param panel_id: Unique id to associate with the panel - normally this is a string obtained via the register_panel() call. :param title: The title of the window :param bundle: The app, engine or framework object that is associated with this window :param widget_class: The class of the UI to be constructed. This must derive from QWidget. Additional parameters specified will be passed through to the widget_class constructor. """ if self.hiero_enabled: self.logger.info( "Panels are not supported in Hiero. Launching as a dialog..." ) return self.show_dialog( title, bundle, widget_class, *args, **kwargs ) # Note! Not using the import_module call as this confuses nuke's callback system import tk_nuke_qt # Create the panel. panel_widget = tk_nuke_qt.NukePanelWidget( bundle, title, panel_id, widget_class, *args, **kwargs ) self.logger.debug("Showing pane %s - %s from %s", panel_id, title, bundle.name) if hasattr(tank, "_callback_from_non_pane_menu"): self.logger.debug("Looking for a pane.") # This global flag is set by the menu callback system # to indicate that the click comes from a non-pane context. # # In this case, we have to figure out where the pane should be shown. # Try to parent it next to the properties panel # if possible, because this is typically laid out like a classic # panel UI - narrow and tall. If not possible, then fall back on other # built-in objects and use these to find a location. # # Note: on Nuke versions prior to 9, a pane is required for the UI to appear. built_in_tabs = [ "Properties.1", # properties dialog - best choice to parent next to "DAG.1", # node graph, so usually wide not tall "DopeSheet.1", # dope sheet, usually wide, not tall "Viewer.1", # viewer "Toolbar.1", # nodes toolbar ] existing_pane = None for tab_name in built_in_tabs: self.logger.debug("Parenting panel - looking for %s tab...", tab_name) existing_pane = nuke.getPaneFor(tab_name) if existing_pane: break if existing_pane is None and nuke.env.get("NukeVersionMajor") < 9: # Couldn't find anything to parent next to! # Nuke 9 will automatically handle this situation # but older versions will not show the UI! # Tell the user that they need to have the property # pane present in the UI. nuke.message("Cannot find any of the standard Nuke UI panels to anchor against. " "Please add a Properties Bin to your Nuke UI layout and try again.") return self.logger.debug("Pane found: %s", existing_pane) # All good - we are running nuke 9 and/or # have existing panes to parent against. panel_widget.addToPane(existing_pane) else: self.logger.debug("Adding to established pane.") # We are either calling this from a pane restore # callback or from the pane menu in Nuke. In both # these cases, the current pane is already established # by the system, so just add our widget. # Add it to the current pane panel_widget.addToPane() return panel_widget
def load_nuke_test_window(): pane = nuke.getPaneFor('DAG.1') nuke_tw.addToPane(pane)
def show_panel(self, panel_id, title, bundle, widget_class, *args, **kwargs): """ Shows a panel in Nuke. If the panel already exists, the previous panel is swapped out and replaced with a new one. In this case, the contents of the panel (e.g. the toolkit app) is not destroyed but carried over to the new panel. If this is being called from a non-pane menu in Nuke, there isn't a well established logic for where the panel should be mounted. In this case, the code will look for suitable areas in the UI and try to panel it there, starting by looking for the property pane and trying to dock panels next to this. :param panel_id: Unique id to associate with the panel - normally this is a string obtained via the register_panel() call. :param title: The title of the window :param bundle: The app, engine or framework object that is associated with this window :param widget_class: The class of the UI to be constructed. This must derive from QWidget. Additional parameters specified will be passed through to the widget_class constructor. """ if self.hiero_enabled: self.log_info( "Panels are not supported in Hiero. Launching as a dialog..." ) return self.show_dialog( title, bundle, widget_class, *args, **kwargs ) # Note! Not using the import_module call as this confuses nuke's callback system import tk_nuke_qt # Create the panel. panel_widget = tk_nuke_qt.NukePanelWidget( bundle, title, panel_id, widget_class, *args, **kwargs ) if hasattr(tank, "_callback_from_non_pane_menu"): # This global flag is set by the menu callback system # to indicate that the click comes from a non-pane context. # # In this case, we have to figure out where the pane should be shown. # Try to parent it next to the properties panel # if possible, because this is typically laid out like a classic # panel UI - narrow and tall. If not possible, then fall back on other # built-in objects and use these to find a location. # # Note: on Nuke versions prior to 9, a pane is required for the UI to appear. built_in_tabs = [ "Properties.1", # properties dialog - best choice to parent next to "DAG.1", # node graph, so usually wide not tall "DopeSheet.1", # dope sheet, usually wide, not tall "Viewer.1", # viewer "Toolbar.1", # nodes toolbar ] existing_pane = None for tab_name in built_in_tabs: self.log_debug("Parenting panel - looking for %s tab..." % tab_name) existing_pane = nuke.getPaneFor(tab_name) if existing_pane: break if existing_pane is None and nuke.env.get("NukeVersionMajor") < 9: # Couldn't find anything to parent next to! # Nuke 9 will automatically handle this situation # but older versions will not show the UI! # Tell the user that they need to have the property # pane present in the UI. nuke.message("Cannot find any of the standard Nuke UI panels to anchor against. " "Please add a Properties Bin to your Nuke UI layout and try again.") return # All good - we are running nuke 9 and/or # have existing panes to parent against. panel_widget.addToPane(existing_pane) else: # We are either calling this from a pane restore # callback or from the pane menu in Nuke. In both # these cases, the current pane is already established # by the system, so just add our widget. # Add it to the current pane panel_widget.addToPane() return panel_widget
def showTools(): pane = nuke.getPaneFor('Properties.1') panels.registerWidgetAsPanel('WatermarkControlPanel', 'Watermark Tools', 'uk.co.thefoundry.WatermarkControlPanel', True).addToPane(pane)
def Properties(cls, index=1, name=False): panel_name = 'Properties.{}'.format(index) if name: return panel_name return nuke.getPaneFor(panel_name)
def get(cls, value=None): if value is not None: return nuke.getPaneFor(value) return cls.auto()