def create(self, *args, **kwargs): ''' ''' if pm.control(self.windowName, exists=True): pm.deleteUI(self.windowName) if pm.control(self.dockName, exists=True): pm.deleteUI(self.dockName) if self.dockable: self.mainWindow = pm.window(self.windowName, t=self.windowName) else: self.mainWindow = pm.window(self.windowName, t=self.windowName, widthHeight=[self.width, self.height], rtf=self.rtf, mnb=self.mnb, mxb=self.mxb, s=self.sizeable, **self.kwargs) if self.menuBar: self.menuBarLayout = pm.menuBarLayout(self.prefix + '_menuBarLayout') #### Help menu pm.menu(self.prefix + '_help', l='Help', helpMenu=True) pm.menuItem(parent=self.prefix + '_help', l='Online Help', image='help.png', command=lambda *args: webbrowser.open('http://lct.leocov.com/help', new=2)) pm.menuItem(parent=self.prefix + '_help', l='Contact / Bug Report', image=os.path.join(self.srcPath, 'icons', 'lc_bug.png'), command=lambda *args: self.bug_report_window()) errorLogMenuItem = pm.menuItem(parent=self.prefix + '_help', l='Send Error Logs', checkBox=self.global_cfg.get('g_send_errors'), annotation="Automatically send error logs to the developer", command=lambda *args: self.global_cfg.set('g_send_errors', pm.menuItem(errorLogMenuItem, q=True, checkBox=True))) updateMenuItem = pm.menuItem(parent=self.prefix + '_help', l='Update', enable=False, image='', command=lambda *args: lcUpdate.Update.lct_auto_update(confirmDiag=True)) pm.menuItem(parent=self.prefix + '_help', l='About', image='channelBox.png', command=lambda *args: self.about()) #### Options menu pm.menu(self.prefix + '_options', l='Options') sceneSettingsMenuItem = pm.menuItem(parent=self.prefix + '_options', l="Use scene settings node", checkBox=self.global_cfg.get('g_scene_settings'), annotation="Store tool settings in a scene node. This applies to all scenes.", command=lambda *args: self.global_cfg.set('g_scene_settings', pm.menuItem( sceneSettingsMenuItem, q=True, checkBox=True))) pm.menuItem(parent=self.prefix + '_options', l='Reset {0}'.format(self.windowName), image='airField.svg', command=lambda *args: self.lct_cfg.reset_tool_config(self.windowName)) # pm.menuItem(parent = self.prefix+'_options', l='Make Shelf Icon', command=lambda *args: lcShelf.Shelf.makeShelfButton(self.windowName, self.shelfCommand, self.icon, self.annotation) ) # get the current toolset version and release codes release, version = lcUpdate.Update.update_get_current_version() if release: # check if there is a new version on the server and get it updatePath = lcUpdate.Update.update_get_new_version(version=version, release=release) if updatePath: pm.menuItem(updateMenuItem, edit=True, l='Update Available', enable=True, image='activeSelectedAnimLayer.png')
def uiWindow(self): # checking for duplicate windows windowID = 'PrismRigger' if pm.window(windowID, exists=True): pm.deleteUI(windowID) pm.windowPref(windowID, remove=True) # creating window pm.window(windowID, title=u'Prism リガー', widthHeight=(600, 800)) # menu bar menuBar = pm.menuBarLayout() helpMenu = pm.menu(label=u'Help') manualMenu = pm.menuItem(label=u'仕様書', parent=helpMenu, subMenu=True)#help
def displayOptions(self): #Help->About menu pm.menuBarLayout() pm.menu(label='Help') pm.menuItem(l="About") pm.separator(h=10) #pm.setParent(self) #select a folder self.mainRCL = pm.rowColumnLayout(adj=1) pm.frameLayout(l="Project", h=50, parent=self.mainRCL) #pm.rowColumnLayout(nr = 1) self.folder = pm.windows.folderButtonGrp(label="Select Folder", cl3=("center", "left", "left")) pm.setParent(self.mainRCL) #textures / references pm.frameLayout(l="Types", h=80, parent=self.mainRCL) pm.rowColumnLayout(adj=True) self.texYN = pm.checkBox(l="textures") self.refYN = pm.checkBox(l="references") pm.setParent(self.mainRCL)
def iscWindow(): if pm.window('iscWin', exists=True): pm.deleteUI('iscWin', window=True) shaderlist = { 'Blinn': 'isc.InstantBlinn(path)', 'Lambert': 'isc.InstantLambert(path)', 'Phong': 'isc.InstantPhong(path)', 'Arnold aiStandardSurface': 'isc.InstantaiStandardSurface(path)' } iscWin = pm.window('iscWin', title='Charles Kinters instant shader', rtf=True, h=256) menuBar = pm.menuBarLayout(w=100) contactMenu = pm.menu(label='Help') contactLink = pm.menuItem( label='Website: http://charles.kinters.net', command= 'pm.launch(web="http://charles.kinters.net/sample-page/contact-me/")') iscWinlayout = pm.rowColumnLayout('iscWinlayout') iscWintitle = pm.text( label='Please select the type of Instant Shader you wish to create.', align='left') iscMenu = pm.optionMenu('iscMenu', label='Shader Type?') skip = pm.menuItem(label='Please Select Shader') for option in shaderlist.keys(): pm.menuItem(label=option) iscPath = pm.folderButtonGrp(label='Path to texture folder:', cl3=('left', 'left', 'left')) btnLayout = pm.rowColumnLayout('butns', nc=2, p='iscWinlayout') SubmitButton = pm.button(label='Create', c=Callback(CreateShader, iscMenu, shaderlist, iscPath), p='butns') close = pm.button(label='Close', command=('pm.deleteUI(\"' + iscWin + '\", window=True)'), p='butns') pm.showWindow(iscWin)
def __init__(self, operation=0, setTargetFromSelection=True, menuBarVisible=True, space=om.MSpace.kObject, minDeltaLength=0.00001, templateDuplicate=True, visibleDuplicate=True): """ :param operation: (int) 0=Smooth delta, 1=Copy vertex, 2=Closest point, 3=Closest vertex, 4=Average vertex :param setTargetFromSelection: (bool) if there is no previous target stored (=first time running the UI in the maya instance) use the current selection :param space: (int) om.MSpace.k___ :param menuBarVisible: (bool) settings menuBar visibility :param minDeltaLength: (float) deltas shorter than this are ignored :param templateDuplicate: (bool) duplicate.template=___ :param visibleDuplicate: (bool) duplicate.visibility=___ """ initializeMaya() self.minDeltaLengthDefault = minDeltaLength with pm.verticalLayout() as mainLayout: with pm.menuBarLayout() as self.menuBar: self.space = pm.menu(label='Space', tearOff=True) pm.radioMenuItemCollection() self.spaces = [] for name, value in self.getSpaceStrings(space): self.spaces.append( pm.menuItem(label=name, radioButton=value, command=pm.Callback( self.syncMelVariablesWithUi))) pm.menu(label='Settings') self.templateDuplicate = pm.menuItem( label='template DUPLICATE', checkBox=templateDuplicate) self.visibleDuplicate = pm.menuItem(label='visible DUPLICATE', checkBox=visibleDuplicate) self.minDeltaLength = pm.menuItem( label='minDeltaLength: {}'.format(minDeltaLength), command=pm.Callback(self.setMinDeltaLengthDialog)) pm.menu(label='Help') # pm.menuItem(label='TODO: demo video (vimeo)') # pm.menuItem(label='TODO: latest installer (...)') pm.menuItem(label='latest version (github)', command=pm.Callback(self.getLatestVersion)) self.menuBar.setMenuBarVisible(menuBarVisible) with pm.horizontalLayout() as targetLayout: pm.button(l='Target:', c=pm.Callback(self.setTargetFromSelection)) self.target = pm.textField(en=False) variableTest = mm.eval('whatIs "$prDP_operation"') if variableTest != 'Unknown': self.target.setText(mm.eval('$tempMelVar=$prDP_driver')) targetLayout.redistribute(0, 1) pm.popupMenu(parent=targetLayout, button=3) pm.menuItem(label='intermediate of selection', c=pm.Callback(self.setTargetFromSelectionIntermediate)) pm.menuItem(label='DUPLICATE of selection', c=pm.Callback(self.setTargetFromDuplicateOfSelection)) with pm.verticalLayout() as operationLayout: self.operation1 = pm.radioButtonGrp( labelArray2=['Smooth delta', 'Copy vertex'], numberOfRadioButtons=2, columnWidth2=[110, 110], columnAlign2=['left', 'left'], changeCommand=pm.Callback(self.syncMelVariablesWithUi)) self.operation1.setSelect(operation + 1) self.operation2 = pm.radioButtonGrp( shareCollection=self.operation1, labelArray2=['Closest point', 'Closest vertex'], numberOfRadioButtons=2, columnWidth2=[110, 110], columnAlign2=['left', 'left'], changeCommand=pm.Callback(self.syncMelVariablesWithUi)) pm.separator() self.operation3 = pm.radioButtonGrp( shareCollection=self.operation1, label1='Average vertex', numberOfRadioButtons=1, columnWidth=[1, 110], columnAlign=[1, 'left'], changeCommand=pm.Callback(self.syncMelVariablesWithUi)) operationLayout.redistribute(5, 5, 1, 5) pm.popupMenu(parent=operationLayout, button=3) pm.menuItem(label='toggle menuBar', c=pm.Callback(self.toggleMenuBar)) with pm.horizontalLayout() as toolLayout: pm.button(label='Enter Tool', command=pm.Callback(self.enterTool)) pm.button(label='Close', command=pm.Callback(self.close)) toolLayout.redistribute() mainLayout.redistribute(0, 0, 0, 1) if setTargetFromSelection and not self.target.getText(): self.setTargetFromSelection() self.show() self.syncMelVariablesWithUi()
def build_menu_bar( self ): self.__menu_bar = pmc.menuBarLayout( ) # Build the individual menus self.build_layers_menu( ) self.build_options_menu( )
def toolsWindow(): with core.ui.singleWindow('Various Tools'): menuBarLayout() a = menu() alt.buildMenus(a)
def uiWindow(self): #checking for duplicate windows windowID = 'sceneBrowser' if pm.window(windowID, exists=True): pm.deleteUI(windowID) pm.windowPref('sceneBrowser', remove=True) #creating window pm.window(windowID, title=u'Prism シーン管理', widthHeight=(600, 800)) #menu bar menuBar = pm.menuBarLayout() motionMenu = pm.menu(label=u'モーション') for i in sorted(self.motionFolders): mainBody_arg = partial(self.mainBody, self.motionFolders[i]) item = pm.menuItem(label=i, command=mainBody_arg, parent=motionMenu) modelMenu = pm.menu(label=u'モデル') for i in sorted(self.modelFolders): mainBody_arg = partial(self.mainBody, self.modelFolders[i]) item = pm.menuItem(label=i, command=mainBody_arg, parent=modelMenu) #label self.masterCol = pm.columnLayout('master col', width=600) self.labelLayout = pm.frameLayout(label=u'Options', labelIndent=5, marginHeight=5, nch=5, width=550, parent=self.masterCol) #sceneName sceneNameLayout = pm.rowLayout(parent=self.masterCol, nc=10) pm.text(label=u'シーン名:', width=85, align='right') pm.text(label='', width=15, align='left', parent=sceneNameLayout, enable=False) #spacer self.sceneName = pm.textField(width=410) pm.button(label=u'開', command=self.folderOpen, width=25, parent=sceneNameLayout, height=20) #button yomikomiLayout = pm.rowLayout(parent=self.masterCol, nc=10) #pm.text(label = '', width = 25, align = 'left', parent = yomikomiLayout, enable = False) pm.text(label=u'読み込み:', width=85, height=20, align='right', parent=yomikomiLayout) pm.text(label='', width=15, align='left', parent=yomikomiLayout, enable=False) #spacer pm.button(label=u'開く', command=self.openFile, width=75, parent=yomikomiLayout, height=20) pm.button(label=u'レファレンス', command=self.referenceButton, width=75, parent=yomikomiLayout, height=20) pm.text(label='', width=5, align='left', parent=yomikomiLayout, enable=False) #spacer self.refNamespace = pm.textField(placeholderText=u'ネームスペース', width=100) exportLayout = pm.rowLayout(parent=self.masterCol, nc=10) pm.text(label=u'保存:', width=85, height=20, align='right', parent=exportLayout) pm.text(label='', width=15, align='left', parent=exportLayout, enable=False) #spacer pm.button(label=u'保存', command=self.saveFile, width=75, parent=exportLayout, height=20) pm.button(label=u'出力(仮)', command=lambda x: self.placeHolder(u'出力'), width=75, parent=exportLayout, height=20) spacerLayout = pm.rowLayout(parent=self.masterCol, nc=5) pm.text(label='', width=15, height=25, align='left', parent=spacerLayout, enable=False) #spacer pm.showWindow()
def show( self ): try: pm.deleteUI( self.__name__ ) except: pass self.win = pm.window( self.__name__ ) self.win.setTitle( self._title ) self.win.setWidthHeight( (150,300) ) pm.menuBarLayout() pm.menu( label='File' ) pm.menuItem( label='Import...', command=self._import ) pm.menuItem( label='Export Pose...', command=self._exportPose ) pm.menuItem( label='Export Group...', command=self._exportGroup ) pm.menu( label='Edit' ) pm.menuItem( label='New Pose', command=lambda *args: self._newPose() ) pm.menuItem( label='New Group', command=lambda *args: self._newGroup() ) pm.menuItem(divider=True) pm.menuItem( label='Rename Selected Pose', command=lambda *args: self._renamePose() ) pm.menuItem( label='Delete Selected Pose', command=lambda *args: self._deletePose() ) pm.menuItem(divider=True) pm.menuItem( label='Rename Current Group', command=lambda *args: self._renameGroup() ) pm.menuItem( label='Delete Current Group', command=lambda *args: self._deleteGroup() ) pm.menuItem( label='Clear Current Group', command=lambda *args: self._clearGroup() ) pm.menu( label='Help', helpMenu=True ) pm.menuItem( label='About...' ) self.mainForm = pm.formLayout( numberOfDivisions=100 ) self.namespaceCol = pm.rowColumnLayout( numberOfColumns=2, columnAttach=[(1,"both",0),(2,"both",0)], columnAlign=[(2,"right"),], columnWidth=[(1,30),(2,125)] ) self.namespacePM = pm.popupMenu( button=1, parent=self.namespaceCol, postMenuCommand=pm.Callback( self._updateNamespacePopupList ) ) pm.symbolButton( image='pickMenuIcon.xpm' ) self.namespaceTF = pm.textField( editable=False ) pm.setParent( self.mainForm ) self.optionMenuCol = pm.columnLayout( adjustableColumn=True, rowSpacing=0, columnAttach=( 'both', 0 ), columnAlign='right' ) pm.setParent( self.mainForm ) self.poseListTSL = pm.textScrollList( allowMultiSelection=False, doubleClickCommand=pm.Callback( self._applyPose ), selectCommand=pm.Callback( self._setGlobalPose ), deleteKeyCommand=pm.Callback( self._deletePose ) ) self.radMenu = pm.popupMenu( markingMenu=True ) pm.menuItem( label='New Pose...', radialPosition='N', command=lambda *args: self._newPose() ) pm.menuItem( label='Apply', radialPosition='W', command=lambda *args: self._applyPose() ) pm.menuItem( label='Rename Pose...', radialPosition='S', command=lambda *args: self._renamePose() ) pm.menuItem( label='Delete Pose', radialPosition='SE', command=lambda *args: self._deletePose() ) pm.menuItem( label='New Group', command=lambda *args: self._newGroup() ) pm.menuItem( divider=True ) pm.menuItem( label='Rename Current Group', command=lambda *args: self._renameGroup() ) pm.menuItem( label='Delete Current Group', command=lambda *args: self._deleteGroup() ) pm.menuItem( label='Clear Current Group', command=lambda *args: self._clearGroup() ) pm.menuItem( divider=True ) self._updateGroupList() self._updatePoseList() self._updateNamespaceList() self.mainForm.attachForm( self.optionMenuCol, 'top', 4 ) self.mainForm.attachForm( self.optionMenuCol, 'left', 2 ) self.mainForm.attachForm( self.optionMenuCol, 'right', 2 ) self.mainForm.attachNone( self.optionMenuCol, 'bottom' ) self.mainForm.attachControl( self.poseListTSL, 'top', 4, self.optionMenuCol) self.mainForm.attachForm( self.poseListTSL, 'left', 2 ) self.mainForm.attachForm( self.poseListTSL, 'right', 2 ) self.mainForm.attachControl( self.poseListTSL, 'bottom', 4, self.namespaceCol ) self.mainForm.attachNone( self.namespaceCol, 'top' ) self.mainForm.attachForm( self.namespaceCol, 'left', 2 ) self.mainForm.attachForm( self.namespaceCol, 'right', 2 ) self.mainForm.attachForm( self.namespaceCol, 'bottom', 4 ) self.win.show() pm.scriptJob( replacePrevious=1, parent=self.__name__, event=['SceneOpened', pm.Callback(self._updateNamespaceList) ] )