def dock(mainWindow): """ Show dockable window args mainWindow : QtGui.QMainWindow return None """ mainWindow.setObjectName('sampleWindowObject') DOCK_NAME = "dock_name" from pymel import all as pm if pm.dockControl(DOCK_NAME, q=True, ex=1): pm.deleteUI(DOCK_NAME) if pm.window('dummyWindow', q=True, ex=1): pm.deleteUI('dummyWindow') # Create dummy window object to keep the layout pm.window('dummyWindow') pm.columnLayout() floatingLayout = pm.paneLayout( configuration='single', w=300) pm.setParent('..') # Create new dock pm.dockControl( DOCK_NAME, aa=['right', 'left'], a='right', fl=False, con=floatingLayout, label="Sample Dock", w=300) # Parent QMainWindow object to the layout pm.control('sampleWindowObject', e=True, parent=floatingLayout)
def main(dock=False): """ main """ global checkerWin try: checkerWin.close() except: pass sel = cmds.ls(sl=True, long=True) if len(sel) == 0: sel = "" else: sel = sel[0] checkerWin = ModelChecker(sel) checkerWin.setObjectName("checker_mainWindow") if dock is True: from pymel import all as pm if pm.dockControl('model_checker_dock', q=True, ex=1): pm.deleteUI('model_checker_dock') floatingLayout = pm.paneLayout(configuration='single', w=700) pm.dockControl( 'model_checker_dock', aa=['right', 'left'], a='right', fl=False, con=floatingLayout, label="Model Checker", w=300) pm.control('checker_mainWindow', e=True, parent=floatingLayout) else: checkerWin.show() checkerWin.raise_()
def dock(mainWindow): """ Show dockable window args mainWindow : QtWidgets.QMainWindow return None """ mainWindow.setObjectName('sampleWindowObject') DOCK_NAME = "dock_name" from pymel import all as pm if pm.dockControl(DOCK_NAME, q=True, ex=1): pm.deleteUI(DOCK_NAME) if pm.window('dummyWindow', q=True, ex=1): pm.deleteUI('dummyWindow') # Create dummy window object to keep the layout pm.window('dummyWindow') pm.columnLayout() floatingLayout = pm.paneLayout(configuration='single', w=300) pm.setParent('..') # Create new dock pm.dockControl(DOCK_NAME, aa=['right', 'left'], a='right', fl=False, con=floatingLayout, label="Sample Dock", w=300) # Parent QMainWindow object to the layout pm.control('sampleWindowObject', e=True, parent=floatingLayout)
def main(dock=False): """ main """ global checkerWin try: checkerWin.close() except: pass sel = cmds.ls(sl=True, long=True) if len(sel) == 0: sel = "" else: sel = sel[0] checkerWin = ModelChecker(sel) checkerWin.setObjectName("checker_mainWindow") if dock is True: from pymel import all as pm if pm.dockControl('model_checker_dock', q=True, ex=1): pm.deleteUI('model_checker_dock') floatingLayout = pm.paneLayout(configuration='single', w=700) pm.dockControl('model_checker_dock', aa=['right', 'left'], a='right', fl=False, con=floatingLayout, label="Model Checker", w=300) pm.control('checker_mainWindow', e=True, parent=floatingLayout) else: checkerWin.show() checkerWin.raise_()
def createNew(self, floating=False): if self.mmmm == None: self.mmmm = MmmmToolsMod.Dynamic.GetInstance() mmmm = self.mmmm self.widgets = {} self.subs = {} ## Create Main Widgets win = self.widgets["win"] = pm.window() ## scroll = self.widgets["scroll"] = pm.scrollLayout(parent=win, horizontalScrollBarThickness=0) ## The dock must be created after the window's layout dock = self.widgets["dock"] = pm.dockControl( "MmmmTools Dock", floating=floating, area="left", content=win, allowedArea=["right", "left"] ) col = self.widgets["col"] = pm.columnLayout(parent=scroll) # self.mainFrame = MmmmMainDockableWindowSub( ) # self.mainFrame # self.mainFrame = # self.makeMainFrame( parentLayout=col ) modellerFrame = pm.frameLayout(label="Modeler", collapsable=True, parent=col, marginWidth=10) modellerCol = pm.columnLayout(parent=modellerFrame) f0 = pm.frameLayout(label="Modeler Actions", marginWidth=10, collapsable=True, parent=modellerCol) commander = self.mmmm.commander cmdEntries = commander.entries prefix = "Modeler/" for name, entry in cmdEntries.items(): if name.startswith(prefix): uiLabel = entry.get("uiLabel") if uiLabel == None: ## Trim modeler from name uiLabel = name[len(prefix) :] pm.button(label=uiLabel, parent=f0, command=commander.commandsMelNames[name]) f1 = pm.frameLayout(label="Grid Tools", marginWidth=10, collapsable=True, parent=modellerCol) mmmm.modeler.runGridTools(makeUi=True, parentWidget=f1) f2 = pm.frameLayout(label="Retopo Tools", marginWidth=10, collapsable=True, parent=modellerCol) mmmm.modeler.runRetoper(makeUi=True, parentWidget=f2) f3 = pm.frameLayout(label="Mirror Tools", marginWidth=10, collapsable=True, parent=modellerCol) mmmm.modeler.runMirrorer(makeUi=True, parentWidget=f3) pm.windowPref(win, width=500, height=500) win.setWidth(500) win.setHeight(800)
def createNew(self, floating=False): if self.mmmm == None: self.mmmm = MmmmToolsMod.Dynamic.GetInstance() mmmm = self.mmmm self.widgets = {} self.subs = {} ## Create Main Widgets win = self.widgets['win'] = pm.window() ## scroll = self.widgets['scroll'] = pm.scrollLayout( parent=win, horizontalScrollBarThickness=0) ## The dock must be created after the window's layout dock = self.widgets['dock'] = pm.dockControl( 'MmmmTools Dock', floating=floating, area='left', content=win, allowedArea=['right', 'left']) col = self.widgets['col'] = pm.columnLayout(parent=scroll) #self.mainFrame = MmmmMainDockableWindowSub( ) #self.mainFrame #self.mainFrame = #self.makeMainFrame( parentLayout=col ) modellerFrame = pm.frameLayout( label="Modeler", collapsable=True, parent=col, marginWidth=10, ) modellerCol = pm.columnLayout(parent=modellerFrame) f0 = pm.frameLayout(label="Modeler Actions", marginWidth=10, collapsable=True, parent=modellerCol) commander = self.mmmm.commander cmdEntries = commander.entries prefix = 'Modeler/' for name, entry in cmdEntries.items(): if name.startswith(prefix): uiLabel = entry.get('uiLabel') if uiLabel == None: ## Trim modeler from name uiLabel = name[len(prefix):] pm.button(label=uiLabel, parent=f0, command=commander.commandsMelNames[name]) f1 = pm.frameLayout(label="Grid Tools", marginWidth=10, collapsable=True, parent=modellerCol) mmmm.modeler.runGridTools(makeUi=True, parentWidget=f1) f2 = pm.frameLayout(label="Retopo Tools", marginWidth=10, collapsable=True, parent=modellerCol) mmmm.modeler.runRetoper(makeUi=True, parentWidget=f2) f3 = pm.frameLayout(label="Mirror Tools", marginWidth=10, collapsable=True, parent=modellerCol) mmmm.modeler.runMirrorer(makeUi=True, parentWidget=f3) pm.windowPref(win, width=500, height=500) win.setWidth(500) win.setHeight(800)
def create(): global TH_P_WIDGETS init() layerchannel.cleanup() if (pm.dockControl(TH_P_DOCK, exists=True)): pm.deleteUI(TH_P_DOCK) if (pm.window(TH_P_WIN, exists=True)): pm.deleteUI(TH_P_WIN) TH_P_WIDGETS['window'] = pm.window(TH_P_WIN) TH_P_WIDGETS['main'] = pm.paneLayout(configuration='vertical3', staticWidthPane=1) TH_P_WIDGETS['tabs'] = pm.tabLayout(p=TH_P_WIDGETS['main'], width=274, height=100) TH_P_WIDGETS['column1'] = pm.verticalLayout(p=TH_P_WIDGETS['main'], height=100) TH_P_WIDGETS['column2'] = pm.verticalLayout(p=TH_P_WIDGETS['main']) # tabs ########################################################################################## # shelves TH_P_WIDGETS['tab_shelves'] = pm.verticalLayout(p=TH_P_WIDGETS['tabs']) TH_P_WIDGETS['tabs'].setTabLabel((TH_P_WIDGETS['tab_shelves'], 'Shelves')) shelves.create(TH_P_WIDGETS['tab_shelves']) TH_P_WIDGETS['tab_shelves'].redistribute() # renaming TH_P_WIDGETS['tab_renaming'] = pm.verticalLayout(p=TH_P_WIDGETS['tabs']) renaming.create(TH_P_WIDGETS['tab_renaming']) TH_P_WIDGETS['tabs'].setTabLabel( (TH_P_WIDGETS['tab_renaming'], 'Renaming')) TH_P_WIDGETS['tab_renaming'].redistribute() # script editor TH_P_WIDGETS['tab_scripteditor'] = pm.verticalLayout( p=TH_P_WIDGETS['tabs']) TH_P_WIDGETS['tabs'].setTabLabel( (TH_P_WIDGETS['tab_scripteditor'], 'Script Editor')) scripteditor.create(TH_P_WIDGETS['tab_scripteditor']) TH_P_WIDGETS['tab_scripteditor'].redistribute() """ # column1 ########################################################################################## # layer editor / channel box TH_P_WIDGETS[ 'channellayer' ] = pm.verticalLayout( p=TH_P_WIDGETS[ 'column1' ] ) layerchannel.create( TH_P_WIDGETS[ 'channellayer' ] ) TH_P_WIDGETS[ 'channellayer' ].redistribute() # column2 ########################################################################################## # outliner TH_P_WIDGETS[ 'outliner' ] = pm.verticalLayout( p=TH_P_WIDGETS[ 'column2' ] ) outliner.create( TH_P_WIDGETS[ 'outliner' ] ) TH_P_WIDGETS[ 'outliner' ].redistribute() TH_P_WIDGETS[ 'tabs' ].setSelectTabIndex( 1 ) TH_P_WIDGETS[ 'column1' ].redistribute() TH_P_WIDGETS[ 'column2' ].redistribute() """ TH_P_WIDGETS['dock_panel'] = pm.dockControl(TH_P_DOCK, label='th_panel', area='right', allowedArea=['left', 'right'], sizeable=True, w=540, content=TH_P_WIDGETS['window'])
def create() : global TH_P_WIDGETS init() layerchannel.cleanup() if( pm.dockControl( TH_P_DOCK, exists=True ) ) : pm.deleteUI( TH_P_DOCK ) if( pm.window( TH_P_WIN, exists=True ) ) : pm.deleteUI( TH_P_WIN ) TH_P_WIDGETS[ 'window' ] = pm.window( TH_P_WIN ) TH_P_WIDGETS[ 'main' ] = pm.paneLayout( configuration='vertical3', staticWidthPane=1, paneSize=(3, 0, 100) ) TH_P_WIDGETS[ 'tabs' ] = pm.tabLayout( p=TH_P_WIDGETS[ 'main' ], width=274, height=100 ) TH_P_WIDGETS[ 'column1' ] = pm.verticalLayout( p=TH_P_WIDGETS[ 'main' ], width=100, height=100 ) TH_P_WIDGETS[ 'column2' ] = pm.verticalLayout( p=TH_P_WIDGETS[ 'main' ], width=10 ) # tabs ########################################################################################## # shelves TH_P_WIDGETS[ 'tab_shelves' ] = pm.verticalLayout( p=TH_P_WIDGETS['tabs'] ) TH_P_WIDGETS[ 'tabs' ].setTabLabel( ( TH_P_WIDGETS[ 'tab_shelves' ], 'Shelves' ) ) shelves.create( TH_P_WIDGETS[ 'tab_shelves' ] ) TH_P_WIDGETS[ 'tab_shelves' ].redistribute() # renaming TH_P_WIDGETS[ 'tab_renaming' ] = pm.verticalLayout( p=TH_P_WIDGETS['tabs'] ) renaming.create( TH_P_WIDGETS[ 'tab_renaming' ] ) TH_P_WIDGETS[ 'tabs' ].setTabLabel( ( TH_P_WIDGETS[ 'tab_renaming' ], 'Renaming' ) ) TH_P_WIDGETS[ 'tab_renaming' ].redistribute() # script editor TH_P_WIDGETS[ 'tab_scripteditor' ] = pm.verticalLayout( p=TH_P_WIDGETS['tabs'] ) TH_P_WIDGETS[ 'tabs' ].setTabLabel( ( TH_P_WIDGETS[ 'tab_scripteditor' ], 'Script Editor' ) ) scripteditor.create( TH_P_WIDGETS[ 'tab_scripteditor' ] ) TH_P_WIDGETS[ 'tab_scripteditor' ].redistribute() # column1 ########################################################################################## # layer editor / channel box TH_P_WIDGETS[ 'channellayer' ] = pm.verticalLayout( p=TH_P_WIDGETS[ 'column1' ] ) layerchannel.create( TH_P_WIDGETS[ 'channellayer' ] ) TH_P_WIDGETS[ 'channellayer' ].redistribute() # column2 ########################################################################################## # outliner TH_P_WIDGETS[ 'outliner' ] = pm.verticalLayout( p=TH_P_WIDGETS[ 'column2' ] ) outliner.create( TH_P_WIDGETS[ 'outliner' ] ) TH_P_WIDGETS[ 'outliner' ].redistribute() TH_P_WIDGETS[ 'tabs' ].setSelectTabIndex( 1 ) TH_P_WIDGETS[ 'column1' ].redistribute() TH_P_WIDGETS[ 'column2' ].redistribute() TH_P_WIDGETS[ 'dock_panel' ] = pm.dockControl( TH_P_DOCK, label='th_panel', area='right', allowedArea=[ 'left', 'right' ], sizeable=True, w=540, content=TH_P_WIDGETS[ 'window' ] )