def createUISet(self): self._childLayout = pm.columnLayout( adj=True ) with self._childLayout: pm.text(l="Click cage mesh first, then shift+click target mesh, and click the menu item.") # cageDeformer specific deformers = pm.ls(type=deformerTypes[0]) for node in deformers: frameLayout = pm.frameLayout( label=node.name(), collapsable = True) with frameLayout: self.createCommonAttr(node) # cageDeformerARAP specific deformers = pm.ls(type=deformerTypes[1]) for node in deformers: frameLayout = pm.frameLayout( label=node.name(), collapsable = True) with frameLayout: self.createCommonAttr(node) with pm.rowLayout(numberOfColumns=3) : pm.attrControlGrp( label="constraint mode", attribute= node.ctm) pm.attrFieldSliderGrp( label="constraint weight", min=1e-10, max=1000, attribute=node.cw) pm.attrFieldSliderGrp(label="constraint radius", min=0.001, max=10.0, attribute=node.cr) with pm.rowLayout(numberOfColumns=3) : pm.attrFieldSliderGrp( label="iteration", min=1, max=20, attribute=node.it) pm.attrControlGrp( label="tet mode", attribute= node.tm) pm.attrFieldSliderGrp( label="translation weight", min=0.0, max=1.0, attribute=node.tw)
def library_button_load_pose(self, obj): infos = obj.get_info() #pm.textField(self.widgets['info_text'], e=True, clear=True) # INFO msg = '' for key in ['name', 'user', 'created']: msg = msg + "%s: %s\n" %(key.title(), infos[key]) pm.text(self.widgets['info_text'], e=True, label=msg) # THUMBNAIL pm.iconTextButton(self.widgets['thrumbnail_image'], e=True, image=obj.thumbnail_path) # SAVE BLEND POSE START self.save_blend_pose_start() # LOAD POSE namespace = self.get_active_namespace() obj.load_pose(namespace) # SAVE BLEND POSE END self.save_blend_pose_end() pm.floatSlider(self.widgets['weight_slider'], e=True, value=1)
def rig_makeJntChainDynUI(): '''Makes a UI for the dynamic joint chain functions Returns: None ''' win_bld = {'title':'makeJntChainDyn', 'widthHeight':[400,400], 'tabs_names':['main'], 'description':'This Tool is used for dynamic joint chains', 'fls':{1:['main']} } c = win.MayaUI(win_bld['title'], win_bld['widthHeight'], win_bld['tabs_names'], win_bld['fls'], collapseStyle=0, descr=win_bld['description']) pm.text(l='Module Name:', p=c.frameLayouts[0][0].columnLayout) mn_input = pm.textField(tx='default',p=c.frameLayouts[0][0].columnLayout) sj_input = c.frameLayouts[0][0].addInputBar('startJoint','input') ej_input = c.frameLayouts[0][0].addInputBar('endJoint','input') mp_input = c.frameLayouts[0][0].addInputBar('moduleParent','input') mm_input = c.frameLayouts[0][0].addInputBar('moduleMover','input') c.frameLayouts[0][0].addButton('Make Dynamic', 50, lambda x: rig_makeJntChainDyn(sj_input.getText(), ej_input.getText(), mn_input.getText(), mp_input.getText(), True, mm_input.getText()))
def createUISet(self): self._childLayout = pm.columnLayout( adj=True ) with self._childLayout: pm.text(l="Click cage mesh first, then shift+click target mesh, and click the menu item.") for type in deformerTypes: deformers = pm.ls(type=type) for node in deformers: frameLayout = pm.frameLayout( label=node.name(), collapsable = True) with frameLayout: with pm.rowLayout(numberOfColumns=2) : pm.button( l="Del", c=pm.Callback( self.deleteNode, node)) pm.attrFieldSliderGrp( label="iteration", min=1, max=100, attribute=node.it) with pm.rowLayout(numberOfColumns=2) : pm.attrControlGrp( label="rotation consistency", attribute= node.rc) pm.attrFieldSliderGrp( label="global rotation", min=-720, max=720, attribute=node.ir) with pm.rowLayout(numberOfColumns=3) : pm.attrControlGrp( label="blend mode", attribute= node.bm) pm.attrControlGrp( label="tet mode", attribute= node.tm) pm.attrControlGrp( label="area weight", attribute= node.aw) with pm.rowLayout(numberOfColumns=2) : pm.attrControlGrp( label="visualise energy", attribute= node.ve) pm.attrFieldSliderGrp( label="visualisation multiplier", min=0.001, max=1000, attribute=node.vmp) for j in range(node.blendMesh.numElements()): with pm.rowLayout(numberOfColumns=1) : pm.attrFieldSliderGrp(label=node.blendWeight[j].getAlias(), min=-1.0, max=2.0, attribute= node.blendWeight[j])
def __renameBySearchUI__(self): """create UI to rename by search and replace methode""" # check if we have an object to work with if self.objSwc != None: # get selected item boneName = self.boneUI['tslBoneR'].getSelectItem()[-1] # window creation windowName = 'SkinSaveLoadBoneSearch' title = 'Search and Replace Name' # creating the window if (pmc.window(windowName, exists = True)): pmc.deleteUI(windowName) self.boneSearchUI['window'] = pmc.window(windowName, title = title, width=self.boneSearchSize[0], height=self.boneSearchSize[1], resizeToFitChildren=False, sizeable=False, retain=True ) self.boneSearchUI['layMain'] = pmc.columnLayout( width=self.boneSearchSize[0], height=self.boneSearchSize[1] ) self.boneSearchUI['layChoice'] = pmc.rowLayout( numberOfColumns=4, columnWidth4=((self.boneSearchSize[0])/2-45, 10, (self.boneSearchSize[0])/2-45, 25), height=self.boneSearchSize[1] ) self.boneSearchUI['txtSearch'] = pmc.textField( text=boneName, editable=True, width=(self.boneSearchSize[0])/2-45 ) pmc.text( label=' > ', width=10 ) self.boneSearchUI['txtReplace']= pmc.textField( text='', editable=True, width=(self.boneSearchSize[0])/2-45 ) self.boneSearchUI['btnChoice'] = pmc.button( label='ok', annotation='Press it to rename the bones', width=25 ) # add command self.boneSearchUI['btnChoice'].setCommand(pmc.Callback( self.__renameBySearch__ )) # show window self.boneSearchUI['window'].show() # replace properly the window at the middle of the father window self.boneSearchUI['window'].setTopLeftCorner([self.boneUI['window'].getTopEdge()+self.boneUI['window'].getHeight()/2-self.boneSearchSize[1]/2, self.boneUI['window'].getLeftEdge()+self.boneUI['window'].getWidth()/2-self.boneSearchSize[0]/2])
def __init__(self): if pm.window('optionVarEditor', exists=True): pm.deleteUI('optionVarEditor') with pm.window(title='optionVarEditor', widthHeight=(502, 552), s=False) as window: with pm.columnLayout(): with pm.rowColumnLayout(nc=2, cw=[(1, 250), (2, 250)]): # List Column with pm.columnLayout(): self.search = pm.textField(width=248, cc=self.refresh, ec=self.refresh) self.scrollList = pm.textScrollList(height=500, width=250, selectCommand=self._select, ams=True) # Attr Column with pm.columnLayout(): pm.text(l='optionVar Name:') self.name = pm.textField(tx='Name', ed=False, width=248) pm.text(l='optionVar Value:') self.value = pm.textField(tx='value', width=248) # Buttons with pm.rowColumnLayout(nc=3, cw=[(1, 166), (2, 166), (3, 166)]): pm.button(label='Create', c=self._create) pm.button(label='Edit', c=self._edit) pm.button(label='Delete', c=self._delete) self.refresh() # Render Window window.show()
def uiContents(): with pm.frameLayout(l='Color', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.rowLayout(nc=2): pm.text(label='Set Override Color : ', align='right', w=130) with pm.rowColumnLayout( nc=10 ): wh=18 for i in range(0,32): rgb = (0,0,0) if i == 0: rgb = (0.5,0.5,0.5) anno = 'Reset' pm.symbolButton( i=iconPath+'ui_colorNone.png', annotation=anno, w=wh, h=wh, c=pm.Callback( setColor.setColor, color=i ) ) else: rgb = pm.colorIndex( i, q=True ) anno = '- index : %d\n- RGB : %03.3f %03.3f %03.3f\n- name : %s'%(i, rgb[0], rgb[1], rgb[2], setColor.color_intToStr(i) ) pm.canvas( rgbValue = rgb, annotation = anno, w=wh, h=wh, pressCommand = pm.Callback( setColor.setColor, color=i ) ) #partial( self.setColor, i, True , self._toShape)) #partial( self.setColor, i, False, False)) pm.separator(h=8,style='in') with pm.rowLayout( nc=10 ): pm.text(label='Set Wire Frame Color : ', align='right', w=130) pm.button(label='Object Color Palette', c=pm.Callback( pm.mel.objectColorPalette ), w=180 ) # ====================================== # Buttons # ======================================
def UI_controlModuleSelected(self, *args): moduleNameInfo = pm.textScrollList(self.UIElements["controlModule_textScrollList"], query = True, selectItem = True) if len(moduleNameInfo) == 0: pm.text(self.UIElements["nameText"], edit = True, label = 'No Animation Modules to Install') pm.scrollField(self.UIElements["descriptionScrollField"], edit = True, text = '') pm.button(self.UIElements["installButton"], edit = True, enable = False) return else: moduleName = moduleNameInfo[0] mod = None for controlModule in self.controlModuleCompatability: if controlModule[1] == moduleName: mod = controlModule[0] if mod != None: moduleTitle = mod.TITLE moduleDescription = mod.DESCRIPTION pm.text(self.UIElements["nameText"], edit = True, label = moduleTitle) pm.scrollField(self.UIElements["descriptionScrollField"], edit = True, text = moduleDescription) pm.button(self.UIElements["installButton"], edit = True, enable = True, command = partial(self.InstallModule, mod, moduleName))
def __init__(self): self.window = 'sdkflip' self.title = 'ec Set Driven Key Utility' self.width_height = (312, 289) if py.window(self.window, exists=True): py.deleteUI(self.window) py.window(self.window, title=self.title, wh=self.width_height, sizeable=False) py.scrollLayout(horizontalScrollBarThickness=16, verticalScrollBarThickness=16) py.rowLayout("objRow", numberOfColumns=4, columnAlign2=("left", "right"), p="sdkflip") py.columnLayout("objCol", p="objRow") self.source_field = py.textField("sourceText", tx="Source Driver", p="objCol") py.columnLayout("objbutCol", p="objRow") py.button(label="<<", width=30, height=20, p="objbutCol", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_gui_fun, "sourcetxt")) py.columnLayout("tarCol", p="objRow") self.target_field = py.textField("targetText", tx="Target Driver", p="tarCol") py.columnLayout("tarbutCol", p="objRow") py.button(label="<<", width=30, height=20, p="tarbutCol", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_gui_fun, "targettxt")) py.frameLayout("scrollFrame", label="Driver Attributes", cll=False, borderStyle="etchedIn", p="sdkflip") py.rowLayout("scrollRow", p="scrollFrame") self.scroll_list = py.textScrollList("attrList", w=300, h=200, numberOfRows=8, allowMultiSelection=True, p="scrollRow") py.rowLayout("comRow", numberOfColumns=4, p="sdkflip") py.text("preText", l="Target Prefix", p="comRow") self.prefix_field = py.textField("prefixText", tx="rt", w=70, p="comRow") py.button(label="Mirror", width=80, height=30, p="comRow", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_sdk_flip, True)) py.button(label="Copy", width=80, height=30, p="comRow", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_sdk_flip, False)) py.showWindow(self.window)
def show(self): self.window = pm.window(self.name, wh=(self.w, self.h), title=self.name) self.fl = pm.formLayout(nd=100) #create the main form layout of the window self.frame_layout = pm.frameLayout(bgc=(.3,.1,.25), li=self.w/4, la='center', fn='boldLabelFont', label='AW Binary Proxy Tools', borderStyle='in', mh=self.h/12,h=self.h-40) self.cl = pm.columnLayout(adj=True, cal='left', cat=['both',0], rs=5) pm.text(label='mip_renderProxy Creation', al='center') pm.button (label='Create Render Proxies', bgc=(.4,.5,.2), command= lambda *args: self._createRenderProxy( pm.ls(sl=True) )) pm.separator(st='doubleDash', h=25) pm.text(label='mip_renderProxy Assignment', al='center') self.fileInput = TextFieldBrowserInput( width=300, name='Proxy Input', option_name='Proxy Browse Type', options=['from file', 'from folder'], button_name='Browse', parent=self.cl ) pm.button (label='Assign Render Proxies', bgc=(.4,.5,.2), command= lambda *args: self._attachRenderProxy( pm.ls(sl=True) )) pm.button (label='DELETE ALL BINARY PROXIES', bgc=(.4, .2, .2), command=self._removeAllBipx) pm.setParent('..') pm.setParent('..') #add the close window button self.close_btn = pm.button (w=self.bw, label='Close', bgc = (.4, .2, .2), command=self.close_UI) #finalize form layout pm.formLayout(self.fl, edit=True, attachForm = [(self.frame_layout, 'top', 0), (self.frame_layout, 'left', 0), (self.frame_layout, 'right', 0), (self.close_btn, 'bottom', 10), (self.close_btn, 'right', 10)]) pm.showWindow(self.window)
def __init__(self, baseUi, parent): BaseUi.__init__(self, parent) self.uiparent = parent self.baseUi = baseUi self.tmpJnts = [] self.defaultAxis = 'y' #ui try: pm.deleteUI(self.rigCol) except: pass with pm.columnLayout(adj=True, rs=3, parent=self.uiparent) as self.rigCol: with pm.rowColumnLayout(nc=2, co=[(1, 'left', 155), (2, 'left', 5)]): pm.text(l='axis') with pm.optionMenu(w=60) as self.axisMenu: pm.menuItem(l='x') pm.menuItem(l='y') pm.menuItem(l='z') with pm.columnLayout(adj=True, rs=2, co=['left', 165]): self.ribbonChkBox = pm.checkBox(l='Ribbon Lo/Hi', v=False) with pm.rowColumnLayout(nc=3, co=[(1, 'left', 30), (2, 'left', 5), (3, 'left', 5)]): pm.text(l='tmpJnts') self.tmpJntsTxtFld = pm.textField(w=230, ed=False) self.loadTmpJntButt = pm.button(l='<<', c=pm.Callback(self.loadTmpJnts)) self.axisMenu.setValue(self.defaultAxis) self.baseUi.clearElemSideTxtFld()
def multi_polyQuad(): args,counter = pm.ls(sl=True),1 w=400 window = pm.window(w=w,h=40) pm.columnLayout() progressMessage=pm.text(l='Running through Objects...',w=w) argName=pm.text(l='',w=w) progressControl = pm.progressBar(isInterruptable=True, beginProgress=True, maxValue=len(args), width=w) window.show() for arg in args: if pm.progressBar(progressControl, query=True, isCancelled=True ) : break progressMessage.setLabel('Cleaning up then Quadding object '+str(counter)+'/'+str(len(args))+':') argName.setLabel(arg) pm.select(arg,r=True) #cleanup mesh mel.eval('polyCleanupArgList 3 { "0","1","0","0","0","0","0","0","0","1e-05","0","1e-05","0","1e-05","0","1","0" };') #quad all polies pm.polyQuad(arg, a=30, kgb=False, ktb=False,khe=False,ws=True,ch=False) #merge all verts pm.polyMergeVertex((arg+'.vtx[0:'+str(pm.polyEvaluate(arg,v=True))+']'), d=.001,am=True,ch=0) pm.polyNormalPerVertex(arg,ufn=True) pm.polySoftEdge(arg,angle=68, ch=0) pm.progressBar(progressControl, edit=True, step=1) counter+=1 pm.progressBar(progressControl, edit=True, endProgress=True) pm.select(args, r=True) pm.selectMode(o=True) window.delete()
def initialiseLayout(self): """ define the layout of the ui, also find every module under the TOOL_FOLDER, create a button for each module found""" logger.debug("Function Called ( %s )"%inspect.stack()[0][3]) # Define Layout self.widgets["topLevel_scroll"] = pm.scrollLayout(childResizable=True, width=self.windowWidth+25) # Add top banner to the toolbox pm.text("Animation GUI", align='center', font='boldLabelFont', height=20, bgc=[0,0,0]) #pm.text("", align='center', font='boldLabelFont', height=5, bgc=[0,0,0]) self.widgets['topLevel_tabLayout'] = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5) tab_folders = [dir for dir in os.listdir( self.top_folder_path ) if not dir.startswith("_") and dir.find('.') == -1] tab_folders = sort_with_index(tab_folders, self.top_folder_path) tab_index = 1 for tab_folder in tab_folders: pm.setParent(self.widgets["topLevel_tabLayout"]) #self.widgets['%s_frameLayout'%tab_folder] = pm.frameLayout ( label = tab_folder, collapsable = True, bgc = [0.15,0.15,0.15]) self.widgets['%s_columnLayout'%tab_folder] = pm.columnLayout(adj=True) tab_folder_path = os.path.join( self.top_folder_path, tab_folder) frame_folders = [dir for dir in os.listdir(tab_folder_path) if not dir.startswith("_") and dir.find('.')==-1] frame_folders = sort_with_index(frame_folders, tab_folder_path) logger.info ("%s|| TabLayout Created" %(tab_folder.ljust(40))) for frame_folder in frame_folders: pm.setParent(self.widgets['%s_columnLayout'%tab_folder]) self.widgets['%s_frameLayout'%frame_folder] = pm.frameLayout ( label = frame_folder, collapsable = True) self.widgets['%s_columnLayout'%frame_folder] = pm.columnLayout (adj=True) frame_folder_path = os.path.join(tab_folder_path, frame_folder) layout_folders = [dir for dir in os.listdir( frame_folder_path ) if not dir.startswith("_") and dir.find('.') == -1] layout_folders = sort_with_index(layout_folders, frame_folder_path) logger.info (" %s|| FrameLayout Created" %(frame_folder.ljust(35))) for module in layout_folders : #print "\tCreate layout for (%s.%s.%s)" %() pm.setParent(self.widgets['%s_columnLayout'%frame_folder]) try : mod = __import__ (".".join([self.top_folder, tab_folder, frame_folder, module, module]), (), (), [module]);reload(mod) mod.main() logger.info (" %s|| Layout Created" %(module.ljust(30))) except Exception, error: logger.error(' %s|| %s'%(module.ljust(30), str(error)), level='error') #print '\t\tERROR: ' + str(error) + ", skipping..." #pm.tabLayout( tabs, edit=True, tabLabel=((child1, 'One'), (child2, 'Two')) ) pm.tabLayout( self.widgets['topLevel_tabLayout'], e=True, tabLabelIndex=[tab_index, tab_folder]) tab_index += 1
def __init__(self, questions_file): self.file = open(questions_file, 'r') self.questions = self.file.readlines() self.file.close() self.main_layout = pm.columnLayout() self.name_field = pm.textFieldGrp(label= 'Quiz Name') self.layout = pm.rowColumnLayout(numberOfColumns= 2, columnWidth= ([1, 75], [2, 475])) pm.columnLayout() pm.text(label= 'Questions') self.question_scroll_list = pm.textScrollList(width= 60, height= 400, selectCommand= pm.Callback(self.read_questions), allowMultiSelection= True) pm.setParent(self.layout) pm.columnLayout() pm.text(label= 'Questions Info') self.question_scroll_field = pm.scrollField(wordWrap= True, height= 400, width= 475) pm.setParent(self.main_layout) pm.button(label= 'Create Quiz', command= pm.Callback(self.create_quiz), width= 550, height= 50) self.list_questions()
def ui_fixComponentShading(*args): ### UI setup global UI_name UI_name = [ 'chk_find', 'chk_fix', 'chk_layer', 'btn_run' ] if pm.window( 'fix_component_shading', exists=True ): pm.deleteUI( 'fix_component_shading', window=True ) ui_layout['window'] = pm.window( 'fix_component_shading', title='Fix Component Shading', sizeable=False, h=200, w=200 ) ui_layout['mainLayout'] = pm.columnLayout( columnAlign='left', columnAttach=['left', 0] ) pm.checkBox( UI_name[0], label=' Find Component Shading Object', value=1, w=200, p=ui_layout['mainLayout'] ) pm.checkBox( UI_name[1], label=' Fix Component Shading Object', w=200, p=ui_layout['mainLayout'] ) pm.checkBox( UI_name[2], label=' Fix Ecah Render Layer', w=200, p=ui_layout['mainLayout'] ) ui_layout['ui_sub1'] = pm.formLayout(p=ui_layout['mainLayout'] ) btn = pm.button( UI_name[3] ,label=' Execute !', command=pm.Callback( doExecution ), w=100, p=ui_layout['ui_sub1'] ) pm.formLayout( ui_layout['ui_sub1'], e=True, attachForm=[ (btn, 'left', 50 ) ] ) pm.separator( h=8, w=200, style='single', p=ui_layout['mainLayout'] ) ui_layout['ui_sub2'] = pm.columnLayout(p=ui_layout['mainLayout'] ) pm.text(label=' --- This script will keep the material \n in the CURRENT render layer, so \n it better to run it in MASTER layer! --- ', bgc=[0.05, 0.05, 0.05], align='left', p=ui_layout['ui_sub2'] ) pm.showWindow( ui_layout['window'] )
def _buildupWindow(self): if isinstance(self._window, _pmCore.uitypes.Window) and self._window.exists(self._window.name()): _pmCore.deleteUI(self._window, window=True) self._window = _pmCore.window(title=self._winTitle) _pmCore.columnLayout(adjustableColumn=True) _pmCore.scrollLayout(width=300, height=250, childResizable=True) _pmCore.gridLayout(numberOfColumns=2, cellHeight = self._iconSize, cellWidth=self._iconSize) for versionNum in _Database.getVersionList(self._fileID): versionInfo = _Database.getVersionInfo(self._fileID, versionNum) print versionInfo thumbnailPath = versionInfo[3] if not _os.path.exists(versionInfo[3]): thumbnailPath = "cube.png" button = _pmCore.iconTextButton(self._versionBtnName(versionNum), style='iconAndTextVertical', image1=thumbnailPath, label=self._versionBtnName(versionNum), command=_pmCore.Callback(self._versionSelected, versionNum)) self._uiWidget[self._versionBtnName(versionNum)] = button _pmCore.setParent('..') _pmCore.setParent('..') _pmCore.separator(style='none', height=10) _pmCore.text(label="Comments: ", align='left') self._uiWidget['commentLayout'] = _pmCore.scrollLayout(width=300, height=120, childResizable=True) _pmCore.setParent('..') _pmCore.separator(style='none', height=10) self._uiWidget['comment'] = _pmCore.scrollField(width=300, height=80) _pmCore.button(label='Add Comment', command=_pmCore.Callback(self._commentAdded))
def create(self): self.checkBox = pm.checkBox(label = 'Modify Weighting', onCommand = pm.Callback(self.editFields), offCommand = pm.Callback(self.editFields) ) self.antiField = pm.intFieldGrp( numberOfFields=2, label='Antialias/Noise Quality', extraLabel = 'Weight %' , value2 = 45 , enable1 = False , enable2 = False, changeCommand=pm.Callback(self.updateTotal)) self.compField = pm.intFieldGrp( numberOfFields=2, label='Composition/Focal Length', extraLabel = 'Weight %' , value2 = 45 , enable1 = False , enable2 = False ,changeCommand=pm.Callback(self.updateTotal)) self.proField = pm.intFieldGrp( numberOfFields=2, label='Professionalism', extraLabel = 'Weight %' ,value2 = 10 ,enable1 = False , enable2 = False, changeCommand=pm.Callback(self.updateTotal)) self.lateField = pm.intFieldGrp( numberOfFields=1, label='Late Deduction' , changeCommand=pm.Callback(self.updateTotal)) self.totalField = pm.intFieldGrp( numberOfFields=1, label='Total Grade',enable1 = False, changeCommand=pm.Callback(self.updateTotal)) # attaching the controls pm.formLayout( self.layout, edit=1, attachForm=[[self.checkBox, "left", 140], [self.checkBox, "top", 5]]) pm.formLayout( self.layout, edit=1, attachOppositeControl=[[self.antiField ,"top", 40, self.checkBox], [self.antiField, "right", 10, self.checkBox]]) pm.formLayout( self.layout, edit=1, attachOppositeControl=[[self.compField ,"top", 40, self.antiField], [self.compField, "right", 10, self.antiField]]) pm.formLayout( self.layout, edit=1, attachOppositeControl=[[self.proField ,"top", 40, self.compField], [self.proField, "right", 10, self.compField]]) pm.formLayout( self.layout, edit=1, attachOppositeControl=[[self.lateField ,"top", 40, self.proField], [self.lateField, "left", 0, self.proField]]) pm.formLayout( self.layout, edit=1, attachOppositeControl=[[self.totalField ,"top", 40, self.lateField], [self.totalField, "left", 0, self.lateField]]) pm.setParent(self.columnLayout) pm.text(label = '') self.warning = pm.text(label='') pm.text(label = '') #pm.button( label = 'Output Grade and Comment' , width = 480) return None
def __init__(self): if pm.window(win, q=True, exists=True ): pm.deleteUI(win) with pm.window(win, wh=[300,600], t=title): with pm.frameLayout( lv=False, cll=False, mw=1, mh=1): with pm.formLayout() as mainForm: # 상단 with pm.tabLayout(tv=False) as top: with pm.frameLayout(lv=False, cll=False, mw=2, mh=2, bv=False): with pm.rowLayout(nc=3, adj=2): pm.image( image = shelf_icon ) pm.text(l=' %s'%title, fn='boldLabelFont', align='left') pm.image( image = alfredIcon ) # # Contents start =========================================================== # 중단 with pm.tabLayout(tv=False, scr=True, childResizable=True) as self.mid: #with pm.columnLayout(adj=True): with pm.frameLayout( lv=False, cll=False, mw=3, mh=3, bv=False): uiContents() # # Contents end ============================================================= # # 하단 with pm.columnLayout(adj=True) as btm: pm.helpLine() # 팝업메뉴 # 왼쪽 마우스 클릭 pm.popupMenu(button=1, p=top) pm.menuItem(l='Add To Shelf', c=pm.Callback( self.addToShalf ) ) # 오른쪽 마우스 클릭 pm.popupMenu(button=3, p=top) pm.menuItem(l='Help', en=False ) # 폼조정 pm.formLayout( mainForm, e=True, attachForm=[ (top, 'top', 3), (top, 'left', 3), (top, 'right', 3), (self.mid, 'left', 3), (self.mid, 'right', 3), (btm, 'left', 3), (btm, 'right', 3), (btm, 'bottom', 3), ], attachControl=[ (self.mid, 'top', 3, top), (self.mid, 'bottom', 0, btm) ], )
def __init__(self): winName = 'SineRigWin333' if pm.window(winName, exists=1): pm.deleteUI(winName,window=1) win = pm.window(winName, t='SineRig') pm.columnLayout(adj=1) pm.text('X Axis should be joint chain aim axis.') # Control self.cnt_fld = pm.textFieldButtonGrp(l='Control',bl='Load') pm.textFieldButtonGrp( self.cnt_fld, e=1, bc=lambda: pm.textFieldButtonGrp(self.cnt_fld,e=1,text=pm.ls(sl=1)[0]) ) # Name self.name_fld = pm.textFieldGrp(l='Name') # Base jnt self.base_fld = pm.textFieldButtonGrp(l='Base Joint',bl='Load') pm.textFieldButtonGrp( self.base_fld, e=1, bc=lambda: pm.textFieldButtonGrp(self.base_fld,e=1,text=pm.ls(sl=1)[0]) ) # Tip jnt self.tip_fld = pm.textFieldButtonGrp(l='Tip Joint',bl='Load') pm.textFieldButtonGrp( self.tip_fld, e=1, bc=lambda: pm.textFieldButtonGrp(self.tip_fld,e=1,text=pm.ls(sl=1)[0]) ) # Create button pm.button(l="Create",c=self.createRig) ##### Development Aide pm.textFieldButtonGrp(self.cnt_fld,e=1,text='TopFin_Base_ctrlA') pm.textFieldGrp(self.name_fld,e=1,text='Fin') pm.textFieldButtonGrp(self.base_fld,e=1,text='TopFinA_jnt_1') pm.textFieldButtonGrp(self.tip_fld,e=1,text='TopFinA_jnt_12') pm.showWindow(win)
def __init__(self, opts): self.opts = opts with pm.frameLayout('Export Meshes (.FBX)', collapsable=True, cl=False, bs='out'): with pm.columnLayout(width=250): pm.text(l='Export List:') pm.separator(height=4) self.meshList = pm.textScrollList(height=250, width=250, ams=True, dkc=self._remove) with pm.rowColumnLayout(nc=3, cw=[(1, 82), (2, 82), (3, 82)]): pm.button(l='Add', c=self._add) pm.button(l='Remove', c=self._remove) pm.button(l='Clear', c=self._clear) with pm.rowColumnLayout(nc=2, cw=[(1, 124), (2,124)]): self.prefix = pm.checkBox(label='Prefix', value=self.opts['prefix'], cc=self.save) self.suffix = pm.checkBox(label='Suffix', value=self.opts['suffix'], cc=self.save) self.prefix_text = pm.textField(en=self.prefix.getValue(), text=self.opts['prefix_text'], cc=self.save) self.suffix_text = pm.textField(en=self.suffix.getValue(), text=self.opts['suffix_text'], cc=self.save) pm.text(l='Export Path:') with pm.rowColumnLayout(nc=2, cw=[(1, 215), (2, 32)]): self.fbxPath = pm.textField(text=self.opts['fbxPath'], cc=self._pathRefreash) pm.button(l='...', c=self._path) with pm.rowColumnLayout(nc=3): self.center = pm.checkBox(label='Move to Orgin', v=self.opts['center'], cc=self.save) self.child = pm.checkBox(label='Export Childern', v=self.opts['child'], cc=self.save) pm.button(l='FBXPreset', c=self._fbxPreset) with pm.rowColumnLayout(nc=2, cw=[(1, 124), (2, 124)]): pm.button(l='Selected', c=self._selected) pm.button(l='All', c=self._all) self._refresh()
def gui(): ''' creates the gui for the tool ''' win = 'uvtools' if(pm.window(win, ex = True)): pm.deleteUI(win) if(pm.windowPref(win, ex = True)): pm.windowPref(win, remove = True) global scroll_list, dyn_uis myWin = pm.window(win, title='Anim UV Tool' , sizeable = True, mnb = True, width = 500, height = 400, backgroundColor= [.68,.68,.68]) pm.scrollLayout(width= 500) pm.button(label= 'Creates Nodes', command= create_nodes, width= 500) row_layout = pm.rowColumnLayout(numberOfColumns= 3, columnWidth= [[1, 150], [2, 10], [3, 340]]) pm.columnLayout(adjustableColumn= False, width=150) scroll_list = pm.textScrollList(width= 150, height= 200, selectCommand= pm.Callback(create_ui)) pm.button(label= 'List Nodes', command= list_nodes, width= 148) pm.setParent(row_layout) pm.text(label= '') dyn_uis = pm.columnLayout(adjustableColumn= False, width= 340) # listing the nodes at start up list_nodes() myWin.show()
def createUISet(self): self._childLayout = pm.columnLayout( adj=True ) with self._childLayout: pm.text(l="Click cage mesh first, then shift+click target mesh, and click the menu item.") self.deformers = pm.ls(type="cage") for i in range(len(self.deformers)): frameLayout = pm.frameLayout( label=self.deformers[i].name(), collapsable = True) with frameLayout: with pm.rowLayout(numberOfColumns=3) : pm.button( l="Del", c=pm.Callback( self.deleteNode, self.deformers[i].name())) pm.attrControlGrp( label="cage mode", attribute= self.deformers[i].cgm) pm.attrControlGrp( label="blend mode", attribute= self.deformers[i].bm) with pm.rowLayout(numberOfColumns=3) : pm.attrControlGrp( label="rotation consistency", attribute= self.deformers[i].rc) pm.attrControlGrp( label="Frechet sum", attribute= self.deformers[i].fs) self.deformers = pm.ls(type="cageARAP") for i in range(len(self.deformers)): frameLayout = pm.frameLayout( label=self.deformers[i].name(), collapsable = True) with frameLayout: with pm.rowLayout(numberOfColumns=4) : pm.button( l="Del", c=pm.Callback( self.deleteNode, self.deformers[i].name())) pm.attrControlGrp( label="cage mode", attribute= self.deformers[i].cgm) pm.attrControlGrp( label="blend mode", attribute= self.deformers[i].bm) pm.attrControlGrp( label="constraint mode", attribute= self.deformers[i].constraintMode) with pm.rowLayout(numberOfColumns=3) : pm.attrControlGrp( label="rotation consistency", attribute= self.deformers[i].rc) pm.attrControlGrp( label="Frechet sum", attribute= self.deformers[i].fs) pm.attrControlGrp( label="constraint weight", attribute= self.deformers[i].constraintWeight)
def exportABCUI(*args): if pm.window('exportABC', q = 1, ex = 1): pm.deleteUI('exportABC') win = pm.window('exportABC', t= 'Export ANIMATION', rtf=True, w = 280 ) with win: mainLayout = pm.columnLayout() allLayout = pm.columnLayout(parent = mainLayout) # Export << ALL ANIMATION >> exportAll = pm.button(l = 'EXPORT ALL ANIMATION', w = 280, h= 50) exportAll.setCommand(pm.Callback (expAllABC, listChars,listCam,listAssets)) pm.separator(h = 15) # Export << CAMERA >> exportCam = pm.button(l = 'EXPORT CAMERA', w = 280, h= 25) exportCam.setCommand(pm.Callback (exportCamABC, listCam)) pm.separator(h = 10) # Export << CHARACTERS >> charLayout = pm.rowColumnLayout(nc=2, parent = mainLayout) if listChars: for char in listChars: exportChar = pm.button(l = char, w = 140, h= 25) exportChar.setCommand(pm.Callback (exportABC, char, 'CHR')) else: blank = pm.text(l = ' NO CHARACTERS IN SCENE' , h= 40) # Export << ALL CHARACTERS >> charLayoutAll = pm.columnLayout( parent = mainLayout) exportCharAll = pm.button(l = 'EXPORT ALL CHARACTERS', w = 280, h= 40) exportCharAll.setCommand(pm.Callback (expListABC, listChars, 'CHR')) # Export << ASSETS >> pm.separator(h = 10) assetLayout = pm.rowColumnLayout(nc= 2, parent = mainLayout) if listAssets: for asset in listAssets: exportAss = pm.button(l = asset, w = 140, h= 25) exportAss.setCommand(pm.Callback (exportABC, asset, 'AST')) else: a = pm.text(l = ' NO ASSETS IN SCENE', h= 20) assetAllLayout = pm.columnLayout(parent = mainLayout) # Export << ALL ASSETS >> exportAssAll = pm.button(l = 'EXPORT ALL ASSETS', w = 280, h= 40) exportAssAll.setCommand(pm.Callback (expListABC, listAssets, 'AST')) pm.separator(h = 10) # Export << EDA >> envLayout = pm.rowColumnLayout(nc = 2, parent = mainLayout) if listAssetsEnv: for assetEnv in listAssetsEnv: exportEnv = pm.button(l = assetEnv, w = 140, h= 25) exportEnv.setCommand(pm.Callback (exportABC, assetEnv, 'EDA')) else: blank = pm.text(l = ' NO ANIM in ENVIRONMENT' , h= 40) envLayoutAll = pm.columnLayout( parent = mainLayout) # Export ALL EDA exportEnvAll = pm.button(l = 'EXPORT ALL EDA', w = 280, h= 40) exportEnvAll.setCommand(pm.Callback (expListABC, listAssetsEnv, 'EDA' )) #pm.separator(h = 10) win.show()
def joint_gui(): invalid_joints = joint_rotation(pm.ls(type='joint')) pm.window() pm.columnLayout() pm.text(l='Invalid Rotations', w=150) for joint in invalid_joints: pm.button(l=joint, w=150, c=pm.Callback(select_obj, joint)) pm.showWindow()
def heading_area(): heading_layout = pm.rowColumnLayout(nc=3) image_btn = pm.iconTextButton(style='iconOnly', ann='www.hustonpetty3d.com', w=255, h=30, image1=get_icon_path('tool_brand_icon.png'), c=fun.partial(open_page, 'http://www.hustonpetty3d.com')) pm.text(l='', w=53) # GUI SPACER pm.button(l='How To Use?', c=fun.partial(open_page, 'https://youtu.be/v0lNec7dnTE'), w=80, h=1, bgc=primary_componentColor, ann='Go to "How To Use" video') # NOT CONNECTED pm.setParent(main_layout)
def populate_namespace_horizontal(self): pm.setParent(self.widgets["namespace_horizontal"]) pm.text(label='Namespace : ') self.widgets["nameSpace_textField"] = pm.textField() pm.button(label='Select', c=pm.Callback(self.load_selected_object)) self.widgets["namespace_horizontal"].redistribute()
def info_area(): global info_layout info_layout = pm.rowColumnLayout(nc=5) leftInfo_area() pm.text(l='') # GUI SPACER pm.separator(horizontal=False, h=50, w=13) pm.text(l='') # GUI SPACER rightInfo_area()
def __init__(self): self.main_layout = pm.columnLayout(adjustableColumn= True) self.layout01 = pm.rowColumnLayout(numberOfColumns= 3, columnWidth=([1, 150],[2, 150], [3, 250])) pm.columnLayout() pm.text(label= 'Shaders') self.shader_scroll_list01 = pm.textScrollList(width= 150, height= 200, selectCommand= pm.Callback(self.get_output_geo)) pm.button(label= 'Refresh', width= 150, command= pm.Callback(self.update_shaders_list)) pm.setParent(self.layout01) pm.columnLayout() pm.text(label= 'Shader Geo') self.shader_geo_scroll_list = pm.textScrollList(width= 150, height= 200, allowMultiSelection= True) #self.check_box = pm.checkBox(label= 'select node') pm.setParent(self.layout01) pm.columnLayout() pm.text(label= 'Scene Geo') self.scene_geo_scroll_list = pm.textScrollList(width= 250, height= 200, allowMultiSelection= True) pm.button(label= 'Refresh', width= 275, command= pm.Callback(self.update_scene_geo_list)) pm.setParent(self.main_layout) self.layout02 = pm.rowColumnLayout(numberOfColumns= 2, columnWidth=([1, 275],[2, 275])) pm.columnLayout(adjustableColumn= True) pm.text(label= 'Shaders') self.shader_scroll_list02 = pm.textScrollList(width= 275, height= 200) pm.button(label= 'Assign', width= 275, command= pm.Callback(self.assign_to_geometry)) pm.setParent(self.layout02) pm.columnLayout(adjustableColumn= True) pm.text(label= 'Create Shaders') self.option_menu = pm.optionMenu( label='Material Type', width= 200) pm.menuItem( label='mia_material_x') pm.menuItem( label='blinn') pm.menuItem( label='lambert') pm.menuItem( label='phong') pm.menuItem( label='rampShader') pm.menuItem( label='anisotropic') pm.menuItem( label='phongE') pm.menuItem( label='useBackground') self.text_field = pm.textFieldGrp(label= 'Name', columnWidth2= [100, 150]) pm.button(label= 'Create and Assign Shader', command= pm.Callback(self.create_and_assign_shader)) self.update_scene_geo_list() self.update_shaders_list()
def initialiseLayout(self): #======================================================================= # Define Top Level Layout #======================================================================= self.widgets['top_level_layout'] = pm.verticalLayout(w=self.windowWidth, h=self.windowHeight) #======================================================================= # OVERALL LAYOUT #======================================================================= h = pm.horizontalLayout(ratios=[1,3]) pm.setParent(h) v2 = pm.verticalLayout(ratios=[1, 20, 1, 10]) pm.setParent(v2) pm.text(label="Directory", bgc=[0.1,0.1,0.1]) pm.setParent(v2) self.widgets["directory_vertical"] = pm.verticalLayout(bgc=[0.2,0.2,0.2]) pm.popupMenu() pm.menuItem(label='Create New Directory', c=pm.Callback(self.create_new_directory_prompt)) pm.menuItem(label='Refresh', c=pm.Callback(self.populate_directory_layout)) self.populate_directory_layout() pm.setParent(v2) pm.text(label="Selection Set", bgc=[0.1,0.1,0.1]) pm.setParent(v2) self.widgets['selectionSet_vertical'] = pm.verticalLayout(bgc=[0.2,0.2,0.2]) pm.popupMenu() pm.menuItem(label='Create New Selection Set', c=pm.Callback(self.create_new_selection_prompt)) pm.menuItem(label='Refresh', c=pm.Callback(self.populate_selection_layout)) self.populate_selection_layout() pm.setParent(h) v = pm.verticalLayout(ratios=[1, 6, 10]) pm.setParent(v) self.widgets["namespace_horizontal"] = pm.horizontalLayout(ratios = [2,5,1], bgc=[0.3,0.3,0.4]) self.populate_namespace_horizontal() pm.setParent(v) self.widgets["detail_vertical"] = pm.verticalLayout(bgc=[0.2,0.2,0.3]) self.populate_detail_layout() pm.setParent(v) self.widgets["library_vertical"] = pm.verticalLayout(bgc=[0.3,0.2,0.2]) pm.popupMenu() pm.menuItem(label='Create New Pose', c=pm.Callback(self.create_new_pose_prompt)) pm.menuItem(label='Refresh', c=pm.Callback(self.populate_library_layout)) self.populate_library_layout() v.redistribute() v2.redistribute() h.redistribute() self.widgets['top_level_layout'].redistribute()
def importABCUI(*args): if pm.window('importABC', q = 1, ex = 1): pm.deleteUI('importABC') win = pm.window('importABC', t= 'Import ANIMATION', rtf=True, w = 280 ) with win: mainLayout = pm.columnLayout() # Import << ALL ANIMATION >> allLayout = pm.columnLayout(parent = mainLayout) importAll = pm.button(l = 'IMPORT ALL ANIMATION', w = 280, h= 50) importAll.setCommand(pm.Callback (impAllABC)) pm.separator(h = 15) # Import << CAMERA >> importCam = pm.button(l = 'IMPORT CAMERA', w = 280, h= 25) importCam.setCommand(pm.Callback (importCamABC)) pm.separator(h = 10) # Import << CHARACTERS >> charLayout = pm.rowColumnLayout(nc=2, parent = mainLayout) if listChars: for char in listChars: pathABC = buildPathABC(char, 'CHR_') importChar = pm.button(l = char, w = 140, h= 25) importChar.setCommand(pm.Callback (importABC, char, pathABC)) else: blank = pm.text(l = ' NO CHARACTERS IN SCENE' , h= 40) charLayoutAll = pm.columnLayout( parent = mainLayout) # Import << ALL CHARACTERS >> importCharAll = pm.button(l = 'IMPORT ALL CHARACTERS', w = 280, h= 40) importCharAll.setCommand(pm.Callback (importCharList, listChars)) pm.separator(h = 10) # Import << ASSETS >> assetLayout = pm.rowColumnLayout(nc = 2, parent = mainLayout) if listAssets: for asset in listAssets: pathABC = buildPathABC(asset, 'AST_') importAss = pm.button(l = asset, w = 140, h= 25) importAss.setCommand(pm.Callback (importABC, asset, pathABC)) else: pm.text(l = ' NO ASSETS IN SCENE' , h= 20) assetAllLayout = pm.columnLayout(parent = mainLayout) # import << ALL ASSET >> data importAssAll = pm.button(l = 'IMPORT ALL ASSETS', w = 280, h= 40) importAssAll.setCommand(pm.Callback (importAssetList, listAssets)) pm.separator(h = 10) # Import << EDA >> edaLayout = pm.rowColumnLayout(nc = 2, parent = mainLayout) if listAssetsEnv: for asset in listAssetsEnv: pathABC = buildPathABC(asset, 'EDA_') importAss = pm.button(l = asset, w = 140, h= 25) importAss.setCommand(pm.Callback (importABC, asset, pathABC)) else: pm.text(l = ' NO ASSETS IN SCENE' , h= 20) assetAllLayout = pm.columnLayout(parent = mainLayout) # import << ALL ASSET >> data importAssAll = pm.button(l = 'IMPORT ALL ASSETS', w = 280, h= 40) importAssAll.setCommand(pm.Callback (importAssetList, listAssets)) win.show()
def ui(self): template = pm.uiTemplate('ExampleTemplate', force=True) template.define(pm.button, width=200, height=25) template.define(pm.frameLayout, mh=2, borderVisible=False, labelVisible=False) if pm.window(self.name, q=1, ex=1): pm.deleteUI(self.name) with pm.window(self.name, t=self.title + " v." + str(self.version), s=True, tlb=True, mxb=False) as self.win: with template: with pm.frameLayout(mw=4): with pm.columnLayout(adj=True, rs=10): pm.text(label="MULTI ACTION TOOL", h=30) with pm.frameLayout(): with pm.columnLayout(adj=True): with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=2): pm.button(label="Load Driver", w=255, backgroundColor=(0.17, 0.17, 0.17), c=pm.Callback(self.getDriverList)) pm.button(label="Load Target", w=256, backgroundColor=(0.17, 0.17, 0.17), c=pm.Callback(self.getTargetList)) with pm.rowLayout(numberOfColumns=4): self.Drivers = pm.textScrollList( numberOfRows=8, allowMultiSelection=True, dcc=pm.Callback(self.DccD)) self.Targets = pm.textScrollList( numberOfRows=8, allowMultiSelection=True, dcc=pm.Callback(self.DccT)) with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=6): pm.button(label="Add", w=85, backgroundColor=(0.365, 0.365, 0.365), c=pm.Callback(self.AddDriver, )) pm.button(label="Replace ", w=80, backgroundColor=(0.365, 0.365, 0.365), c=pm.Callback(self.ReplaceDriver)) pm.button(label="Remove ", w=85, backgroundColor=(0.365, 0.365, 0.365), c=pm.Callback(self.RemoveDriver)) pm.button(label="Add", w=85, backgroundColor=(0.365, 0.365, 0.365), c=pm.Callback(self.AddTarget)) pm.button(label="Replace ", w=80, backgroundColor=(0.365, 0.365, 0.365), c=pm.Callback(self.ReplaceTarget)) pm.button(label="Remove ", w=85, backgroundColor=(0.365, 0.365, 0.365), c=pm.Callback(self.RemoveTarget)) with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=2): pm.button(label="Refresh", w=255, backgroundColor=(0.202, 0.202, 0.202), c=pm.Callback(self.RefreshDriver)) pm.button(label="Refresh ", w=256, backgroundColor=(0.202, 0.202, 0.202), c=pm.Callback(self.RefreshTarget)) with pm.frameLayout(): with pm.columnLayout(adj=True, rs=10): pm.separator() pm.text(label="QUICK CONNECTION", h=15) pm.separator() with pm.columnLayout(adj=True): with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=4): pm.button(label="Translate to Translate ", w=170, h=30, bgc=(0.602, 0.602, 0.602), c=pm.Callback(self.QuickConnT)) pm.button(label="Rotate to Rotate", w=170, h=30, bgc=(0.602, 0.602, 0.602), c=pm.Callback(self.QuickConnR)) pm.button(label="Scale to Scale", w=170, h=30, bgc=(0.602, 0.602, 0.602), c=pm.Callback(self.QuickConnS)) pm.separator(h=10, w=500) pm.text( label="MANUEL CONNECTION", h=25, ) pm.separator(h=10, w=500) with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=6): pm.separator(w=51, vis=False) pm.button(label="Add Outputs", w=190, backgroundColor=(0.202, 0.202, 0.202), c=pm.Callback(self.AddOutputs)) pm.separator(w=40, vis=False) pm.button(label="Add Inputs ", w=220, backgroundColor=(0.202, 0.202, 0.202), c=pm.Callback(self.AddInputs)) with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=5): pm.text(label=" Output ", align='left') self.Output1 = pm.textFieldGrp( w=190, pht="Type output", columnWidth1=189) pm.text(label=" Input ", align='left') self.Input1 = pm.textFieldGrp(w=220, pht="Type input", columnWidth1=219) with pm.columnLayout(adj=True, rs=10): with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=5): pm.text(label=" Output ", align='left') self.Output2 = pm.textFieldGrp( w=190, pht="Type output", columnWidth1=189) pm.text(label=" Input ", align='left') self.Input2 = pm.textFieldGrp(w=220, pht="Type input", columnWidth1=219) with pm.columnLayout(adj=True, rs=5): with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=5): pm.text(label=" Output ", align='left') self.Output3 = pm.textFieldGrp( w=190, pht="Type output", columnWidth1=189) pm.text(label=" Input ", align='left') self.Input3 = pm.textFieldGrp(w=220, pht="Type input", columnWidth1=219) pm.separator() with pm.frameLayout(): with pm.formLayout(): with pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5) as tabs: with pm.frameLayout() as child1: with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=2): pm.button(label="Connect One to Many ", w=256, h=30, bgc=(0.17, 0.17, 0.17), c=pm.Callback(self.ConAll)) pm.button(label="Connect Each Other", w=256, h=30, bgc=(0.17, 0.17, 0.17), c=pm.Callback( self.pairing_AttrConn)) with pm.frameLayout() as child2: with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=4): pm.button(label="Parent + Scale", w=340, h=30, bgc=(0.349, 0.478, 0.349), c=pm.Callback( self.ParentScaleCons)) pm.button(label="Parent Constraint", w=170, h=30, bgc=(0.17, 0.17, 0.17), c=pm.Callback( self.ParentCons)) with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=6): pm.button(label="Point Constraint ", w=170, h=30, bgc=(0.17, 0.17, 0.17), c=pm.Callback( self.PointCons)) pm.button(label="Scale Constraint ", w=170, h=30, bgc=(0.17, 0.17, 0.17), c=pm.Callback( self.ScaleCons)) pm.button(label="Orient Constraint ", w=170, h=30, bgc=(0.17, 0.17, 0.17), c=pm.Callback( self.OrientCons)) with pm.frameLayout() as child3: with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=6): pm.button(label="BlendShapes", w=170, h=30, bgc=(0.349, 0.478, 0.349), c=pm.Callback( self.BlendShape_connect)) pm.button(label="Parent", w=170, h=30, bgc=(0.349, 0.478, 0.349), c=pm.Callback( self.parent_2List)) pm.button(label="Match Transform", w=170, h=30, bgc=(0.349, 0.478, 0.349), c=pm.Callback( self.MatchTransformRT, True, True)) pm.popupMenu() pm.menuItem('Match Postion', c=pm.Callback( self.MatchTransformRT, False, True)) pm.menuItem('Match Rotation', c=pm.Callback( self.MatchTransformRT, True, False)) pm.tabLayout( tabs, edit=True, tabLabel=((child1, 'BY CONNECTIONS'), (child2, 'BY CONSTRAINTS'), (child3, 'OTHER OPTIONS'))) with pm.frameLayout(cll=True, bgc=(0.202, 0.202, 0.202), labelVisible=True, cl=True, label="Break Connection", cc=pm.Callback( self.winResize)) as self.BC_layout: with pm.frameLayout(): with pm.columnLayout(adj=True, rs=15): pm.text( label= 'Select the Driver from which you want to break connection', al='center') with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=6): pm.button(label="Add Connection", w=100, backgroundColor=(0.202, 0.202, 0.202), c=pm.Callback(self.AddOutputsBC)) self.BConn = pm.textFieldGrp(pht="Type output") pm.text(label=" ", align='left') pm.button(label="Break Connection", w=150, backgroundColor=(0.602, 0.602, 0.602), c=pm.Callback(self.BreakConnection))
def createMethodInstance(self, i): #setUITemplate('attributeEditorTemplate', pushTemplate=1) rowSpacing = [30, 20, 400] defs = [] #try: argUtil = factories.ApiArgUtil(self.apiClassName, self.apiMethodName, i) proto = argUtil.getPrototype(className=False, outputs=True, defaults=False) enable = argUtil.canBeWrapped() if argUtil.isDeprecated(): pm.text(l='DEPRECATED') # main info row row = pm.rowLayout('%s_rowMain%s' % (self.methodName, i), nc=3, cw3=rowSpacing, enable=enable) self.rows.append(row) pm.text(label='') if self.overloadPrecedenceColl is not None: # toggle for overloaded methods pm.radioButton(label='', collection=self.overloadPrecedenceColl, enable=enable, onCommand=pm.Callback( MethodRow.overloadPrecedenceCB, self, i)) pm.text( l='', #l=proto, annotation=self.methodInfoList[i]['doc'], enable=enable) pm.setParent('..') try: argList = factories.apiClassOverrides[ self.apiClassName]['methods'][self.apiMethodName][i]['args'] except (KeyError, IndexError): argList = self.methodInfoList[i]['args'] returnType = self.methodInfoList[i]['returnType'] types = self.methodInfoList[i]['types'] args = [] for arg, type, direction in argList: type = str(types[arg]) assert arg != 'return' self._makeArgRow(i, type, arg, direction, self.methodInfoList[i]['argInfo'][arg]['doc']) if returnType: self._makeArgRow(i, returnType, 'return', 'return', self.methodInfoList[i]['returnInfo']['doc']) pm.separator(w=800, h=14) return enable
def _build_fk_tab(parent_layout): # Create column Layout with embedded shelf layout in second tab fk_tab_layout = pm.columnLayout('fkTab', adjustableColumn=True) pm.separator(height=5, style='none') pm.gridLayout(numberOfColumns=3, numberOfRows=2, cellWidth=72, cellHeight=44) cmd_str = ('import pymel.core as pm; ' \ 'import mimic_utils; ' \ 'pm.setFocus("fkTab");') for i in range(6): axis = i + 1 sel_cmd_str = cmd_str + ' mimic_utils.select_fk_axis_handle({})' \ .format(axis) button_img = 'a{}FkIcon.png'.format(axis) button_ann = 'Selects Axis {} FK Controller'.format(axis) pm.symbolButton(image=button_img, command=sel_cmd_str, annotation=button_ann) pm.setParent('..') # UI spacing pm.separator(height=3, style='none') pm.separator(height=11, style='out') pm.rowLayout(numberOfColumns=7, adjustableColumn=7, columnAttach=(1, 'left', 3), columnWidth=[(1, 20), (2, 45), (3, 22), (4, 45), (5, 22), (6, 45)], height=20) pm.text(label='A1:') pm.textField("t_a1", font=FONT, rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 1), changeCommand=pm.Callback(mimic_utils.set_axis, 1)) pm.text(label=' A2:') pm.textField("t_a2", font=FONT, rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 2), changeCommand=pm.Callback(mimic_utils.set_axis, 2)) pm.text(label=' A3:') pm.textField("t_a3", font=FONT, rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 3), changeCommand=pm.Callback(mimic_utils.set_axis, 3)) # UI spacing pm.text(label='') pm.setParent('..') pm.separator(height=2, style='none') pm.rowLayout(numberOfColumns=7, adjustableColumn=7, columnAttach=(1, 'left', 3), columnWidth=[(1, 20), (2, 45), (3, 22), (4, 45), (5, 22), (6, 45)], height=20) pm.text(label='A4:') pm.textField("t_a4", font=FONT, rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 4), changeCommand=pm.Callback(mimic_utils.set_axis, 4)) pm.text(label=' A5:') pm.textField("t_a5", font=FONT, rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 5), changeCommand=pm.Callback(mimic_utils.set_axis, 5)) pm.text(label=' A6:') pm.textField("t_a6", font=FONT, rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 6), changeCommand=pm.Callback(mimic_utils.set_axis, 6)) # UI Spacing pm.text(label='') pm.setParent('..') pm.separator(height=7, style='none') # Get and set FK pose buttons pm.gridLayout(nc=2, cw=109, ch=25) pm.button(label="Get Pose", command=mimic_utils.get_fk_pose, annotation='Gets selected robot\'s current axis rotation ' \ 'values\nand prints them above') pm.button(label='Set Pose', command=mimic_utils.set_fk_pose, annotation='Sets selected robot\'s current axis rotation ' \ 'values\nto the input values above') pm.setParent('..') # Clear FK pose button pm.button(label='Clear', command=mimic_utils.clear_fk_pose_ui, annotation='Clears axis rotation input fields above') pm.separator(height=14, style='out') # Keyframe FK button pm.button(label="Set FK Keyframe", command=mimic_utils.key_fk, backgroundColor=[.7, .7, .7], annotation='Keyframes Robot\'s IK-FK hierarchy in FK mode:\n' \ 'target_CTRL:\n' \ ' ik = 0\n' \ ' visibility = 0\n' \ 'a*FK_CTRL:\n' \ ' rotateX, Y, or Z\n' \ 'FK_CTRLS\n' \ ' visibility = 1') pm.setParent(parent_layout) return fk_tab_layout
def rigUI(mayaFalse=False): windowID = 'weaponRig' # checking if window already exists if pm.window(windowID, exists=True): pm.deleteUI(windowID) pm.windowPref('weaponRig', remove=True) pm.window(windowID, title=u'SER 武器RIG') masterTab = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5) # rig switching rigSwitchcol = pm.columnLayout(u'武器切り替え', width=400, parent=masterTab) switchFrame = pm.frameLayout(label=u'片手武器', labelIndent=5, marginHeight=5, parent=rigSwitchcol, nch=5) switchRow = pm.rowLayout('switchRow', nc=5, width=600) pm.button('global', label=u'→ グローバル', width=112.5, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=switchRow, command=weaponGlobal_single) pm.button('righthand', label=u'→ 右手', width=112.5, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=switchRow, command=migi) pm.button('lefthand', label=u'→ 左手', width=112.5, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=switchRow, command=hidari) switchFrame2 = pm.frameLayout(label=u'二丁武器', labelIndent=5, marginHeight=5, parent=rigSwitchcol, nch=5) twosword_1 = pm.rowLayout('test', nc=5, width=600, parent=switchFrame2) pm.button('global', label=u'右 → グローバル', width=112.5, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=twosword_1, command=right_global) pm.button('right-right', label=u'右 → 右', width=112.5, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=twosword_1, command=right_right) pm.button('right-left', label=u'右 → 左', width=112.5, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=twosword_1, command=right_left) twosword_2 = pm.rowLayout('2hand_2', nc=5, width=600, parent=switchFrame2) pm.button('left-global', label=u'左 → グローバル', width=112.5, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=twosword_2, command=left_global) pm.button('left-left', label=u'左 → 右', width=112.5, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=twosword_2, command=left_right) pm.button('left-right', label=u'左 → 左', width=112.5, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=twosword_2, command=left_left) switchFrame3 = pm.frameLayout(label=u'両手武器', labelIndent=5, marginHeight=5, parent=rigSwitchcol, nch=5) twohand_3 = pm.rowLayout('switchRow2h_3', nc=5, width=600, parent=switchFrame3) pm.text(label=u'Aux ON/OFF', parent=twohand_3, width=100) twohand_3a = pm.rowLayout('switchRow2h_3a', nc=5, width=600, parent=switchFrame3) pm.text(label=u'', parent=twohand_3a, width=10) pm.text(label=u'Aux のキーはタイムラインに見えないので、気を付けてください。', parent=twohand_3a, width=500, align='left') twohand_4 = pm.rowLayout('switchRow2h_4', nc=5, width=600, parent=switchFrame3) pm.button('lhAuxOff', label=u'右手 → Aux Off', width=112.5, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=twohand_4, command=auxOffRight) pm.button('rhAuxOff', label=u'左手 → Aux Off', width=112.5, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=twohand_4, command=auxOffLeft) twohand_5 = pm.rowLayout('switchRow2h_5', nc=5, width=600, parent=switchFrame3) pm.button('lhAuxOn', label=u'右手 → Aux On', width=112.5, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=twohand_5, command=auxOnRight) pm.button('rhAuxOn', label=u'左手 → Aux On', width=112.5, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=twohand_5, command=auxOnLeft) # rig creating rigMakeCol = pm.columnLayout(u'リグ作り', width=400, parent=masterTab) oneHandFrame = pm.frameLayout(label=u'片手武器リグ作り', labelIndent=5, marginHeight=5, parent=rigMakeCol, nch=5) oneHandRow = pm.rowLayout('oneHandRow', nc=5, width=600, parent=oneHandFrame) # pm.button( 'locator', label = u'ロケーターを作る', width = 150, height = 20, backgroundColor = ( 0.6, 0.6, 0.6), parent = oneHandRow, command = locatorMake) pm.button('rig', label=u'リグを作る', width=150, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=oneHandRow, command=rigMake) twoSwordFrame = pm.frameLayout(label=u'二丁武器リグ作り', labelIndent=5, marginHeight=5, parent=rigMakeCol, nch=5) # twoSwordRow1 = pm.rowLayout( 'twoSwordRow1', nc = 5, width = 600, parent = twoSwordFrame) # pm.button( 'locatorR', label = u'右ロケーターを作る', width = 150, height = 20, backgroundColor = ( 0.6, 0.6, 0.6), parent = twoSwordRow1, command = locatorMake_R) # pm.button( 'locatorL', label = u'左ロケーターを作る', width = 150, height = 20, backgroundColor = ( 0.6, 0.6, 0.6), parent = twoSwordRow1, command = locatorMake_L) twoSwordRow2 = pm.rowLayout('twoSwordRow2', nc=5, width=600, parent=twoSwordFrame) pm.button('rigR', label=u'右リグを作る', width=150, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=twoSwordRow2, command=rigMake_R) pm.button('rigL', label=u'左リグを作る', width=150, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=twoSwordRow2, command=rigMake_L) twoHandFrame = pm.frameLayout(label=u'両手武器リグ作り', labelIndent=5, marginHeight=5, parent=rigMakeCol, nch=5) twoHandRow = pm.rowLayout('twoHandRow', nc=5, width=600, parent=twoHandFrame) #pm.button( 'twohandLocator', label = u'ロケーターを作る', width = 150, height = 20, backgroundColor = ( 0.6, 0.6, 0.6), parent = twoHandRow, command = locatorMake) pm.button('twoHandRig', label=u'リグを作る', width=150, height=20, backgroundColor=(0.6, 0.6, 0.6), parent=twoHandRow, command=rigMake_2hand) pm.showWindow() pm.window(windowID, edit=True, widthHeight=(500, 400))
def __init__(self): if window(self.name, ex=True): deleteUI(self.name) window(self.name) ass = formLayout() with tabLayout() as tab: tabLayout(tab, e=True, sc=lambda *args: setattr(self.settings, 'activeTab', tab.getSelectTabIndex())) with formLayout() as switcher: def setMode(modeName): self.settings.mode = modeName self.rangeInput = radioButtonGrp( nrb=4, la4=[m.title() for m in self.MODES], on1=Callback(setMode, self.MODES[0]), # noqa e128 on2=Callback(setMode, self.MODES[1]), on3=Callback(setMode, self.MODES[2]), on4=Callback(setMode, self.MODES[3]), ) self.rangeInput.setSelect( self.MODES.index(self.settings.mode) + 1) with scrollLayout() as utilities: with columnLayout(adj=True): # Fk / Ik Switching with frameLayout(l='Ik/Fk Switching', cll=True) as ikFkFrame: self.settings.frameLayoutSetup( ikFkFrame, 'ikfkCollapsed') with rowColumnLayout(nc=3, cw=[(1, 200), (2, 50), (3, 50)]): for card in fossil.find.blueprintCards(): for side in ['Center', 'Left', 'Right']: try: ik = card.getSide(side).ik fk = card.getSide(side).fk if ik and fk: text(l=ik.shortName()) button(l='Ik', c=Callback( self.doIkFkSwitch, fk, True)) button(l='Fk', c=Callback( self.doIkFkSwitch, ik, False)) except Exception: print(traceback.format_exc()) # Space Switching with frameLayout(l='Space Switching', cll=True) as spaceFrame: self.settings.frameLayoutSetup( spaceFrame, 'spaceCollapsed') with columnLayout() as self.main: with rowColumnLayout(nc=2): button(l='Switch', c=Callback(self.switch)) text(l='Control') self.targets = textScrollList(h=200) scriptJob(e=('SelectionChanged', Callback(self.update)), p=self.main) text(l='') self.presetFileChooser = optionMenu( l='Presets', cc=Callback(self.loadSpace)) self.presetFiles = [] for folder in spacePresets.SpacePresets.presetLocations: folder = os.path.expandvars(folder) if not os.path.exists(folder): continue for f in os.listdir(folder): if f.lower().endswith('.json'): cmds.menuItem(l=f[:-5]) self.presetFiles.append(folder + '/' + f) self.spacePresetList = textScrollList(h=100) button(l='Apply', c=Callback(self.applySpacePreset)) self.update() """ # Main zeroing with frameLayout(l='Zero Main Controller', cll=True) as zeroFrame: self.settings.frameLayoutSetup(zeroFrame, 'zeroMainCollapsed') with rowColumnLayout(nc=3): with gridLayout(nrc=(2, 3)): toggles = [] for attr in [t + a for t in 'tr' for a in 'xyz']: toggles.append( checkBox(l=attr) ) self.settings.checkBoxSetup(toggles[-1], attr + '0') def setVal(val): for check in toggles: check.setValue(val) for attr in [t + a for t in 'tr' for a in 'xyz']: self.settings[attr + '0'] = val with columnLayout(adj=True): button(l='All', c=Callback(setVal, True)) button(l='Clear', c=Callback(setVal, False)) with columnLayout(adj=True): button(l='Apply', c=Callback(self.zeroMain)) """ formLayout( switcher, e=True, af=[ # noqa e128 (self.rangeInput, 'left', 0), (self.rangeInput, 'top', 0), (self.rangeInput, 'right', 0), (utilities, 'left', 0), (utilities, 'bottom', 0), (utilities, 'right', 0), ], ac=(utilities, 'top', 0, self.rangeInput), ) with formLayout() as spaceTab: self.spacePresetsGui, self.qtui = spacePresets.SpacePresets.asMelGui( ) formLayout(spaceTab, e=True, af=[ (self.spacePresetsGui, 'top', 0), (self.spacePresetsGui, 'bottom', 0), (self.spacePresetsGui, 'right', 0), (self.spacePresetsGui, 'left', 0), ]) #button(save, e=True, c=Callback(space.save)) #button(load, e=True, c=Callback(space.load)) tabLayout(tab, e=True, tl=[(switcher, 'Switching'), (spaceTab, 'Spaces')]) #tabLayout(tab, e=True, tl=[(switcher, 'Switching')] ) tabLayout(tab, e=True, sti=self.settings.activeTab) formLayout( ass, e=True, af=[ # noqa e128 (tab, 'top', 0), (tab, 'left', 0), (tab, 'right', 0), (tab, 'bottom', 0), ]) showWindow()
def OpenMayaCommonGlobalsCreateTab(self): log.debug("OpenMayaCommonGlobalsCreateTab()") scLo = "scrollLayout" parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) if self.rendererTabUiDict.has_key('common'): self.rendererTabUiDict.pop('common') uiDict = {} self.rendererTabUiDict['common'] = uiDict clo = "clo" with pm.frameLayout(clo, labelVisible=False, collapsable=False, mw=8, mh=5, borderVisible=False): with pm.columnLayout(adj=True): uiDict['imgpath'] = pm.text(label="Path:", align="left", font="smallBoldLabelFont") uiDict['imgname'] = pm.text(label="File Name:", align="left", font="smallBoldLabelFont") uiDict['imgsize'] = pm.text(label="Image Size:", align="left", font="smallBoldLabelFont") with pm.scrollLayout(scLo, horizontalScrollBarThickness=0) as sl: print "Scroll layout", sl with pm.columnLayout("commonTabColumn", adjustableColumn=True, width=400) as ctc: print "common", ctc with pm.frameLayout(label="File Output", collapsable=True, collapse=False): with pm.columnLayout(adjustableColumn=True, width=400): pm.textFieldGrp(label="File Name Prefix:") pm.attrEnumOptionMenuGrp( "imageMenuMayaSW", label="Image Format:", attribute=self.renderNode.imageFormat) uiDict['imageNumbering'] = pm.optionMenuGrp( label="Frame/Animation ext:", changeCommand=self.setFrameNumbering) for value in ["name.ext", "name.#.ext"]: pm.menuItem(value) if self.defaultGlobals.animation.get(): uiDict['imageNumbering'].setSelect(2) self.addRenderDefaultGlobalsUIElement( attName='extensionPadding', uiType='int', displayName='Frame Padding:', uiDict=uiDict) with pm.frameLayout(label="Frame Range", collapsable=True, collapse=False) as frameRangeLayout: uiDict['frameRangeLayout'] = frameRangeLayout with pm.columnLayout(adjustableColumn=True, width=400): self.addRenderDefaultGlobalsUIElement( attName='startFrame', uiType='float', displayName='Start Frame:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='endFrame', uiType='float', displayName='End Frame:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='byFrame', uiType='float', displayName='By Frame:', uiDict=uiDict) with pm.frameLayout(label="Renderable Cameras", collapsable=True, collapse=False): with pm.columnLayout(adjustableColumn=True, width=400): for cam in pm.ls(type="camera"): pm.checkBoxGrp(label=cam.name(), value1=cam.renderable.get(), cc=pm.Callback( self.switchCamRenderable, cam)) with pm.frameLayout(label="Image Size", collapsable=True, collapse=False): with pm.columnLayout(adjustableColumn=True, width=400): uiDict['imageSizePresets'] = pm.optionMenuGrp( label="Presets:", changeCommand=self.setImageSize) for imgFormat in self.imageFormatData: pm.menuItem(imgFormat[0]) uiDict['imageSizePresets'].setSelect(12) self.addRenderDefaultResGlobalsUIElement( attName='aspectLock', uiType='bool', displayName='Maintain aspect ratio', uiDict=uiDict) self.addRenderDefaultResGlobalsUIElement( attName='width', uiType='int', displayName='Width:', uiDict=uiDict, callback=pm.Callback(self.updateImageSize, "width")) self.addRenderDefaultResGlobalsUIElement( attName='height', uiType='int', displayName='Height:', uiDict=uiDict, callback=pm.Callback(self.updateImageSize, "height")) self.addRenderDefaultResGlobalsUIElement( attName='deviceAspectRatio', uiType='float', displayName='Device Aspect:', uiDict=uiDict, callback=pm.Callback(self.updateImageSize, "devAsp")) #self.addRenderDefaultResGlobalsUIElement(attName='pixelAspect', uiType='float', displayName='Pixel Aspect:', uiDict=uiDict, callback=self.updateImageSize) with pm.frameLayout(label="Render Scripts", collapsable=True, collapse=False): with pm.columnLayout(adjustableColumn=True, width=400): self.addRenderDefaultGlobalsUIElement( attName='preMel', uiType='string', displayName='Pre Render Mel:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='postMel', uiType='string', displayName='Post Render Mel:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='preRenderLayerMel', uiType='string', displayName='Pre Layer Mel:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='postRenderLayerMel', uiType='string', displayName='Post Layer Mel:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='preRenderMel', uiType='string', displayName='Pre Frame Mel:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='postRenderMel', uiType='string', displayName='Post Frame Mel:', uiDict=uiDict) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[(clo, "right", 0), (clo, "left", 0), (clo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0)], attachControl=[(scLo, "top", 0, clo)]) self.setImageSize("HD_540") # set default self.OpenMayaCommonGlobalsUpdateTab()
def create(self): # Create default render globals node if needed. createGlobalNodes() parentForm = pm.setParent(query=True) pm.setUITemplate("renderGlobalsTemplate", pushTemplate=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) columnWidth = 400 with pm.scrollLayout("appleseedScrollLayout", horizontalScrollBarThickness=0): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): with pm.frameLayout(label="Sampling", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self.__addControl(ui=pm.intFieldGrp( label="Pixel Samples", numberOfFields=1), attrName="samples") self.__addControl(ui=pm.intFieldGrp( label="Render Passes", numberOfFields=1), attrName="passes") self.__addControl(ui=pm.intFieldGrp(label="Tile Size", numberOfFields=1), attrName="tileSize") with pm.frameLayout(label="Shading", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): attr = pm.Attribute( "appleseedRenderGlobals.diagnostics") menuItems = [ (i, v) for i, v in enumerate(attr.getEnums().keys()) ] self.__addControl(ui=pm.attrEnumOptionMenuGrp( label="Override Shaders", enumeratedItem=menuItems), attrName="diagnostics") with pm.frameLayout(label="Lighting", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): attr = pm.Attribute( "appleseedRenderGlobals.lightingEngine") menuItems = [ (i, v) for i, v in enumerate(attr.getEnums().keys()) ] self.__addControl(ui=pm.attrEnumOptionMenuGrp( label="Lighting Engine", enumeratedItem=menuItems), attrName="lightingEngine") with pm.frameLayout(label="Path Tracing", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self.__addControl(ui=pm.checkBoxGrp( label="Limit Bounces", changeCommand=self.__limitBouncesChanged), attrName="limitBounces") limitBounces = mc.getAttr( "appleseedRenderGlobals.limitBounces") self.__addControl(ui=pm.intFieldGrp( label="Global Bounces", numberOfFields=1, enable=limitBounces), attrName="bounces") self.__addControl(ui=pm.intFieldGrp( label="Diffuse Bounces", numberOfFields=1, enable=limitBounces), attrName="diffuseBounces") self.__addControl(ui=pm.intFieldGrp( label="Glossy Bounces", numberOfFields=1, enable=limitBounces), attrName="glossyBounces") self.__addControl(ui=pm.intFieldGrp( label="Specular Bounces", numberOfFields=1, enable=limitBounces), attrName="specularBounces") self.__addControl(ui=pm.floatFieldGrp( label="Light Samples", numberOfFields=1), attrName="lightSamples") self.__addControl(ui=pm.floatFieldGrp( label="Environment Samples", numberOfFields=1), attrName="envSamples") self.__addControl( ui=pm.checkBoxGrp(label="Caustics"), attrName="caustics") self.__addControl(ui=pm.floatFieldGrp( label="Max Ray Intensity", numberOfFields=1), attrName="maxRayIntensity") with pm.frameLayout(label="Scene", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self.__addControl(ui=pm.floatFieldGrp( label="Scene Scale", numberOfFields=1), attrName="sceneScale") with pm.rowLayout("appleseedRowLayout", nc=3): pm.text("Environment Light") ui = pm.optionMenu( changeCommand=self.__environmentLightSelected) pm.menuItem(label="<none>") for envLight in g_environmentLightsList: pm.menuItem(parent=ui, label=envLight) # Set the currently selected environment light in # the menu. connections = mc.listConnections( "appleseedRenderGlobals.envLight") if connections: node = connections[0] if mc.nodeType(node) == "transform": shapes = mc.listRelatives(node, shapes=True) assert shapes node = shapes[0] pm.optionMenu(ui, edit=True, value=node) else: pm.optionMenu(ui, edit=True, value="<none>") self.__uis["envLight"] = ui logger.debug( "Created globals env light menu, name = %s" % ui) self.__addControl( ui=pm.checkBoxGrp(label="Background Emits Light"), attrName="bgLight") with pm.frameLayout(label="Motion Blur", collapsable=True, collapse=True): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self.__addControl(ui=pm.checkBoxGrp( label="Motion Blur", changeCommand=self.__motionBlurChanged), attrName="motionBlur") enableMotionBlur = mc.getAttr( "appleseedRenderGlobals.motionBlur") self.__addControl(ui=pm.intFieldGrp( label="Camera Samples", numberOfFields=1, enable=enableMotionBlur), attrName="mbCameraSamples") self.__addControl(ui=pm.intFieldGrp( label="Transformation Samples", numberOfFields=1, enable=enableMotionBlur), attrName="mbTransformSamples") self.__addControl(ui=pm.intFieldGrp( label="Deformation Samples", numberOfFields=1, enable=enableMotionBlur), attrName="mbDeformSamples") self.__addControl(ui=pm.floatFieldGrp( label="Shutter Open", numberOfFields=1, enable=enableMotionBlur), attrName="shutterOpen") self.__addControl(ui=pm.floatFieldGrp( label="Shutter Close", numberOfFields=1, enable=enableMotionBlur), attrName="shutterClose") with pm.frameLayout(label="System", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self.__addControl(ui=pm.intFieldGrp(label="Threads", numberOfFields=1), attrName="threads") self.__addControl(ui=pm.intFieldGrp( label="Texture Cache Size (MB)", numberOfFields=1), attrName="maxTexCacheSize") pm.setUITemplate("renderGlobalsTemplate", popTemplate=True) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[("appleseedScrollLayout", "top", 0), ("appleseedScrollLayout", "bottom", 0), ("appleseedScrollLayout", "left", 0), ("appleseedScrollLayout", "right", 0)]) logger.debug("Created appleseed render global main tab") # Update the newly created tab. self.update()
def initializeAnimTab(self, tabHeight, tabWidth): columnWidth = 120 moduleSpecific_scrollHeight = 120 scrollHeight = tabHeight - moduleSpecific_scrollHeight - 20 #1. Anim Editing self.UIElements["animColumn"] = pm.columnLayout(adj=True, rs=3) pm.rowColumnLayout("selsetAddRow", numberOfColumns=3, ro=[(1, "both", 2), (2, "both", 2), (3, "both", 2)], columnAttach=[(1, "both", 3), (2, "both", 3), (3, "both", 3)], columnWidth=[(1, columnWidth), (2, columnWidth), (3, columnWidth)]) pm.textField("setName", parent="selsetAddRow") pop = pm.popupMenu(parent='setName') #pm.optionMenu(label='Colors', changeCommand=lambda a: self.updateTextfield('setName', 'test')) pm.button(label="add", parent="selsetAddRow", command=lambda a: self.addSelectionSetWin()) pm.button(label="remove", parent="selsetAddRow", command=lambda a: self.removeSelectionSetWin()) pm.setParent(self.UIElements["animColumn"]) pm.separator() pm.text('selectionSets') pm.rowLayout("selsetSelRow", numberOfColumns=2, columnWidth2=[300, 100], columnAlign=[(1, 'right'), (2, 'left')]) pm.textScrollList("selSetList", parent="selsetSelRow", width=300, height=100, allowMultiSelection=False, selectCommand=lambda: self.selectSelectionSetWin()) pm.columnLayout("selsetModColumn", parent="selsetSelRow") pm.button(label="load", parent="selsetModColumn", height=22, width=50, command=lambda a: self.loadSelectionSetWin()) pm.button(label="delete", parent="selsetModColumn", height=22, width=50, command=lambda a: self.deleteSelectionSetWin()) pm.setParent(self.UIElements["animColumn"]) self.UIElements["1"] = pm.rowColumnLayout(numberOfColumns=3, ro=[(1, "both", 2), (2, "both", 2), (3, "both", 2)], columnAttach=[(1, "both", 3), (2, "both", 3), (3, "both", 3) ], columnWidth=[ (1, columnWidth), (2, columnWidth), (3, columnWidth) ]) pm.button(label="randomizer", command=lambda a: randomizerUI.randomizer_start()) pm.button(label="set Timesldr Keyrng", command=lambda a: mo_animUtils.setTimesliderToKeyrange()) pm.button(label="keyEmpty", command=lambda a: mo_animUtils.keyEmpty()) #2. Rigg Editing pm.setParent(self.UIElements["animColumn"]) pm.separator() self.UIElements["2"] = pm.rowColumnLayout(numberOfColumns=3, ro=[(1, "both", 2), (2, "both", 2), (3, "both", 2)], columnAttach=[(1, "both", 3), (2, "both", 3), (3, "both", 3) ], columnWidth=[ (1, columnWidth), (2, columnWidth), (3, columnWidth) ]) pm.button(label="copyKey", command=lambda a: pm.copyKey()) pm.button(label="pasteKey", command=lambda a: pm.pasteKey()) pm.button(label="cutKey", command=lambda a: pm.cutKey()) pm.button(label="copyKeys", command=lambda a: mo_animUtils.copyKeys()) pm.button(label="infinity", command=lambda a: mo_animUtils.infinity()) pm.button(label="Save Pose Shelf", command=lambda a: mo_storePoseToShelf.storePoseToShelf()) pm.button(label="del Constraints", command=lambda a: mo_riggUtils.deleteChildrenConstraints()) pm.button(label="keyFlash", command=lambda a: mo_animUtils.keyFlash()) pm.button(label="keyFastinSlowout", command=lambda a: mo_animUtils.keyFastinSlowout()) pm.text(label="") pm.setParent(self.UIElements["animColumn"]) pm.separator() self.UIElements["3"] = pm.rowColumnLayout(numberOfColumns=3, ro=[(1, "both", 2), (2, "both", 2), (3, "both", 2)], columnAttach=[(1, "both", 3), (2, "both", 3), (3, "both", 3) ], columnWidth=[ (1, columnWidth), (2, columnWidth), (3, columnWidth) ]) #3. Ctrl Editing pm.button(label="straightMotion", command=lambda a: straightMotion.straightMotion()) pm.button(label="placeHolderLoc", command=lambda a: libUtil.createPlaceHolder(cnx=0)) pm.button(label="IkFk Snap UI", command=lambda a: self.mog_ikFkSwitchWin()) pm.button(label="findIntersectingUI", command=lambda a: findIntersectingWin()) pm.setParent(self.UIElements["animColumn"]) return self.UIElements["animColumn"]
def initializeDisplayTab(self, tabHeight, tabWidth): columnWidth = 120 moduleSpecific_scrollHeight = 120 scrollHeight = tabHeight - moduleSpecific_scrollHeight - 20 #1. Anim Editing self.UIElements["displayColumn"] = pm.columnLayout(adj=True, rs=3) self.UIElements["d1"] = pm.rowColumnLayout(numberOfColumns=3, ro=[(1, "both", 2), (2, "both", 2), (3, "both", 2)], columnAttach=[ (1, "both", 3), (2, "both", 3), (3, "both", 3) ], columnWidth=[ (1, columnWidth), (2, columnWidth), (3, columnWidth) ]) pm.button(label="Layout Outliner", command=lambda a: mo_displayUtil.layoutCleanOutliner( name='cleanPersp/Outliner')) pm.button(label="Layout Anim", command=lambda a: mo_displayUtil.layoutCleanAnim( name='cleanOutliner/Persp/Graph')) pm.button(label="Layout Script", command=lambda a: mo_displayUtil.layoutCleanScripting( name='cleanOutliner/Persp/ScriptEditor')) pm.button(label="Viz Curves", command=lambda a: mo_displayUtil.toggleCurvesVisibility()) pm.button(label="Viz Geo", command=lambda a: mo_displayUtil.toggleGeometryVisibility()) pm.button(label="Viz Flat", command=lambda a: mo_displayUtil.toggleFlatShaded()) #2. Selection pm.setParent(self.UIElements["displayColumn"]) pm.separator() self.UIElements["d2"] = pm.rowColumnLayout(numberOfColumns=3, ro=[(1, "both", 2), (2, "both", 2), (3, "both", 2)], columnAttach=[ (1, "both", 3), (2, "both", 3), (3, "both", 3) ], columnWidth=[ (1, columnWidth), (2, columnWidth), (3, columnWidth) ]) pm.button(label="selectHrchy All", command=lambda a: mo_displayUtil.selectHierarchy()) pm.button(label="selectHrchy Ctl", command=lambda a: mo_displayUtil.selectHierarchy()) pm.button(label="selectHrchy Jnt", command=lambda a: mo_displayUtil.selectHierarchy()) # pm.button(label="getDisplayLayer", command=lambda a:mo_displayUtil.getDisplayLayer()) # pm.button(label="deleteRefEdits", command=lambda a:mo_displayUtil.deleteRefEdits()) # pm.button(label="deleteRefEdits", command=lambda a: mo_displayUtil.deleteRefEdits()) pm.button(label="disconnectShaders", command=lambda a: mo_displayUtil.disconnectShaders()) pm.button(label="viewportSnapshot", command=lambda a: mo_displayUtil.viewportSnapshot()) pm.button(label="removeNameSpace", command=lambda a: mo_stringUtils.removeNameSpace()) #3. Ctrl Editing pm.button(label="list_duplicates", command=lambda a: mo_stringUtils.list_duplicates()) pm.button(label="renameDuplicates", command=lambda a: mo_stringUtils.renameDuplicates()) pm.button(label="ipm", command=lambda a: mo_imageplaneManager.ImagePlaneMngWindow. showUI()) pm.button( label="lightRigg", command=lambda a: mo_lightRigg.createLightRigg(size=10, lightsTop=3, keyTop=[1], fillTop=[2, 3], lightsBottom=4)) pm.text(label="") pm.text(label="") pm.setParent(self.UIElements["displayColumn"]) pm.separator() self.UIElements["d3"] = pm.rowColumnLayout(numberOfColumns=3, ro=[(1, "both", 2), (2, "both", 2), (3, "both", 2)], columnAttach=[ (1, "both", 3), (2, "both", 3), (3, "both", 3) ], columnWidth=[ (1, columnWidth), (2, columnWidth), (3, columnWidth) ]) pm.button(label="ass Poly", command=lambda a: mo_displayUtil.changeASSmode( obj_list=pm.selected(), mode=2)) pm.button(label="ass BB", command=lambda a: mo_displayUtil.changeASSmode( obj_list=pm.selected(), mode=0)) pm.button(label="all BB", command=lambda a: mo_displayUtil.changeASSmode( obj_list="all", mode=0)) pm.setParent(self.UIElements["displayColumn"]) return self.UIElements["displayColumn"]
def initializeRiggTab(self, tabHeight, tabWidth): columnWidth = 100 moduleSpecific_scrollHeight = 120 scrollHeight = tabHeight - moduleSpecific_scrollHeight - 20 #1. Get Info self.UIElements["mainColumn"] = pm.columnLayout("mainColumn") pm.rowColumnLayout("snapRowColumn", numberOfColumns=3, ro=[(1, "both", 2), (2, "both", 2), (3, "both", 2)], columnAttach=[(1, "both", 3), (2, "both", 3), (3, "both", 3)], columnWidth=[(1, columnWidth), (2, columnWidth), (3, columnWidth)]) pm.button( label="snapT", parent="snapRowColumn", bgc=(0.209, 0.209, 0.209), command=lambda a: mo_riggUtils.snap(pm.selected()[0], pm.selected()[-1], 'point')) pm.button( label="snapR", parent="snapRowColumn", bgc=(0.209, 0.209, 0.209), command=lambda a: mo_riggUtils.snap(pm.selected()[0], pm.selected()[-1], 'orient')) pm.button(label="snap", parent="snapRowColumn", bgc=(0.209, 0.209, 0.209), command=lambda a: mo_riggUtils.snap(pm.selected()[0], pm.selected()[-1])) pm.setParent(self.UIElements["mainColumn"]) pm.separator() self.UIElements["3"] = pm.rowColumnLayout(numberOfColumns=3, ro=[(1, "both", 2), (2, "both", 2), (3, "both", 2)], columnAttach=[(1, "both", 3), (2, "both", 3), (3, "both", 3) ], columnWidth=[ (1, columnWidth), (2, columnWidth), (3, columnWidth) ]) pm.button(label="hammerSkin", command=lambda a: pm.mel.eval('weightHammerVerts;')) pm.button(label="copySkin", command=lambda a: pm.mel.eval('artAttrSkinWeightCopy;')) pm.button(label="pasteSkin", command=lambda a: pm.mel.eval('artAttrSkinWeightPaste;')) pm.button(label="getSkinInfluenceJoints", command=lambda a: mo_riggUtils.getSkinInfluenceJoints()) pm.button(label="getJointChain", command=lambda a: mo_riggUtils.getJointChain()) pm.button(label="delChildConst", command=lambda a: libUtil.deleteChildrenConstraints()) pm.text(label="") #2. Rigg Editing pm.setParent(self.UIElements["mainColumn"]) pm.separator() self.UIElements["4"] = pm.rowColumnLayout(numberOfColumns=3, ro=[(1, "both", 2), (2, "both", 2), (3, "both", 2)], columnAttach=[(1, "both", 3), (2, "both", 3), (3, "both", 3) ], columnWidth=[ (1, columnWidth), (2, columnWidth), (3, columnWidth) ]) pm.button(label="transferSkin", command=lambda a: libUtil.TransferSkinWeightsPolyToPoly( pm.selected()[0], pm.selected()[0:])) pm.button(label="alignJ", command=lambda a: mo_riggUtils.alignJ()) pm.button(label="vecViz", command=lambda a: mo_riggUtils.vecVizObjects(pm.selected())) pm.button(label="createIKSpline", command=lambda a: mo_riggUtils.createIKSpline()) pm.button( label="createJointsAtPos", command=lambda a: mo_riggUtils.createJointsAtPos(pm.selected())) pm.button(label="splitJnt", command=lambda a: splitJointUI.splitSelJointUI()) pm.setParent(self.UIElements["mainColumn"]) pm.separator() self.UIElements["5"] = pm.rowColumnLayout(numberOfColumns=3, ro=[(1, "both", 2), (2, "both", 2), (3, "both", 2)], columnAttach=[(1, "both", 3), (2, "both", 3), (3, "both", 3) ], columnWidth=[ (1, columnWidth), (2, columnWidth), (3, columnWidth) ]) #3. Ctrl Editing pm.optionMenu("option_ctrlShape", width=columnWidth * 0.3) pm.menuItem(label='cube') pm.menuItem(label='circle') pm.menuItem(label='locator') self.swatchbtn = pm.button(w=32, h=32, l="", bgc=(1.0, 1.0, 0.0), c=self.set_color) #print('bg color is %s'%self.swatchbtn.getBackgroundColor()) pm.button(label="createCtrl", bgc=(0.439, 0.615, 0.184), command=lambda a: self.createCtrlWin(hi=0)) pm.button(label="addGibmal", command=lambda a: mo_riggUtils.addGimbal(pm.selected())) pm.button(label="addGibmal", command=lambda a: mo_riggUtils.addGimbal(pm.selected())) pm.button(label="createCtrlHi", bgc=(0.439, 0.615, 0.184), command=lambda a: self.createCtrlWin(hi=1, constrain=False)) #3. Ctrl Editing pm.optionMenu("option_scaleAxis", width=columnWidth * 0.3) pm.menuItem(label='XYZ') pm.menuItem(label='X') pm.menuItem(label='Y') pm.menuItem(label='Z') pm.menuItem(label='XY') pm.menuItem(label='XZ') pm.menuItem(label='YZ') pm.button( label="Scale +", command=lambda a: mo_riggUtils.scaleShape( 1.25, axis=pm.optionMenu("option_scaleAxis", q=1, value=1))) pm.button( label="Scale -", command=lambda a: mo_riggUtils.scaleShape( 0.75, axis=pm.optionMenu("option_scaleAxis", q=1, value=1))) #3. Ctrl Editing pm.optionMenu("option_rotateAxis", width=columnWidth * 0.3) pm.menuItem(label='X') pm.menuItem(label='Y') pm.menuItem(label='Z') pm.button( label="Rotate 90", command=lambda a: mo_riggUtils.rotateShape( 90, axis=pm.optionMenu("option_rotateAxis", q=1, value=1))) pm.button(label="Rotate 90") pm.button(label="connect", bgc=(0.439, 0.615, 0.184), command=lambda a: self.connectCtrlWin()) pm.button(label="disconnect", bgc=(0.901, 0.411, 0.298), command=lambda a: self.disconnectCtrlWin()) pm.button(label="grpZERO", command=lambda a: self.grpCtrlsWin()) pm.setParent(self.UIElements["mainColumn"]) return self.UIElements["mainColumn"]
def buildUI(self): self.win = pm.window(title='Pymel Control Panel') self.win.show() with pm.paneLayout(configuration='vertical3', paneSize=([1, 20, 100], [3, 20, 100])) as self.pane: # Lef Column: Api Classes self.classScrollList = pm.textScrollList('apiClassList') # Center Column: Api Methods # Would LIKE to do it like this, but there is currently a bug with # objectType UI, such that even if # layout('window4|paneLayout5', q=1, exists=1) == True # when you run: # objectTypeUI('window4|paneLayout5') # you will get an error: # RuntimeError: objectTypeUI: Object 'window4|paneLayout5' not found. # with formLayout() as apiForm: # #with scrollLayout() as scroll: # with tabLayout('apiMethodCol') as self.apiMethodCol: # pass # status = helpLine(h=60) # So, instead, we do it old-school... apiForm = pm.formLayout() self.apiMethodCol = pm.tabLayout('apiMethodCol') pm.setParent(apiForm) status = pm.cmds.helpLine(h=60) pm.setParent(self.pane) apiForm.attachForm(self.apiMethodCol, 'top', 5) apiForm.attachForm(self.apiMethodCol, 'left', 5) apiForm.attachForm(self.apiMethodCol, 'right', 5) apiForm.attachControl(self.apiMethodCol, 'bottom', 5, status) apiForm.attachPosition(status, 'bottom', 5, 20) apiForm.attachForm(status, 'bottom', 5) apiForm.attachForm(status, 'left', 5) apiForm.attachForm(status, 'right', 5) # Right Column: Mel Methods melForm = pm.formLayout() label1 = pm.text(label='Unassigned Mel Methods') self.unassignedMelMethodLister = pm.textScrollList() label2 = pm.text(label='Assigned Mel Methods') self.assignedMelMethodLister = pm.textScrollList() label3 = pm.text(label='Disabled Mel Methods') self.disabledMelMethodLister = pm.textScrollList() pm.setParent(self.pane) melForm.attachForm(label1, 'top', 5) melForm.attachForm(label1, 'left', 5) melForm.attachForm(label1, 'right', 5) melForm.attachControl(self.unassignedMelMethodLister, 'top', 0, label1) melForm.attachForm(self.unassignedMelMethodLister, 'left', 5) melForm.attachForm(self.unassignedMelMethodLister, 'right', 5) melForm.attachPosition(self.unassignedMelMethodLister, 'bottom', 5, 33) melForm.attachControl(label2, 'top', 5, self.unassignedMelMethodLister) melForm.attachForm(label2, 'left', 5) melForm.attachForm(label2, 'right', 5) melForm.attachControl(self.assignedMelMethodLister, 'top', 0, label2) melForm.attachForm(self.assignedMelMethodLister, 'left', 5) melForm.attachForm(self.assignedMelMethodLister, 'right', 5) melForm.attachPosition(self.assignedMelMethodLister, 'bottom', 5, 66) melForm.attachControl(label3, 'top', 5, self.assignedMelMethodLister) melForm.attachForm(label3, 'left', 5) melForm.attachForm(label3, 'right', 5) melForm.attachControl(self.disabledMelMethodLister, 'top', 0, label3) melForm.attachForm(self.disabledMelMethodLister, 'left', 5) melForm.attachForm(self.disabledMelMethodLister, 'right', 5) melForm.attachForm(self.disabledMelMethodLister, 'bottom', 5) pm.setParent('..') pm.popupMenu(parent=self.unassignedMelMethodLister, button=3) pm.menuItem(l='disable', c=pm.Callback(PymelControlPanel.disableMelMethod, self, self.unassignedMelMethodLister)) pm.popupMenu(parent=self.assignedMelMethodLister, button=3) pm.menuItem(l='disable', c=pm.Callback(PymelControlPanel.disableMelMethod, self, self.assignedMelMethodLister)) pm.popupMenu(parent=self.disabledMelMethodLister, button=3) pm.menuItem(l='enable', c=pm.Callback(PymelControlPanel.enableMelMethod)) self.classScrollList.extend(self.classList) self.classScrollList.selectCommand( lambda: self.apiClassList_selectCB()) pm.scriptJob(uiDeleted=[str(self.win), cacheResults]) self.win.show()
def show(self): # some default values section_label_height = 30 labels_width = 140 if pm.window(self.windows_name, exists=True): pm.deleteUI(self.windows_name) self.window = pm.window(self.windows_name, t='Afanasy Job Submission') with pm.columnLayout(adj=True): pm.text(l='<h1><b>Job Parameters<b><h1>', h=section_label_height) with pm.rowLayout(nc=4, adj=2, cl4=['right', 'left', 'center', 'center'], cw4=(labels_width, 40, 15, 15)): pm.text(l='<div align="right"><b>Start Frame</b></div>') start_time_int_field = pm.intField( 'cgru_afanasy__start_frame', v=pm.optionVar.get('cgru_afanasy__start_frame_ov', 1)) pm.button(l='<', ann='Use minimum animation range', c=functools.partial( self.set_field_value, start_time_int_field, functools.partial(pm.playbackOptions, q=True, min=True))) pm.button(l='<<', ann='Use minimum playback range', c=functools.partial( self.set_field_value, start_time_int_field, functools.partial(pm.playbackOptions, q=True, ast=True))) with pm.rowLayout(nc=4, adj=2, cw4=(labels_width, 40, 15, 15)): pm.text(l='<b>End Frame</b>') end_time_int_field = pm.intField( 'cgru_afanasy__end_frame', v=pm.optionVar.get('cgru_afanasy__end_frame_ov', 1)) pm.button(l='<', ann='Use maximum animation range', c=functools.partial( self.set_field_value, end_time_int_field, functools.partial(pm.playbackOptions, q=True, max=True))) pm.button(l='<<', ann='Use maximum playback range', c=functools.partial( self.set_field_value, end_time_int_field, functools.partial(pm.playbackOptions, q=True, aet=True))) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='<b>Frame Per Task</b>') pm.intField('cgru_afanasy__frames_per_task', v=pm.optionVar.get( 'cgru_afanasy__frames_per_task_ov', 1)) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='<b>By Frame</b>') pm.intField('cgru_afanasy__by_frame', v=pm.optionVar.get('cgru_afanasy__by_frame_ov', 1)) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='<b>Global Depend Mask</b>') pm.textField('cgru_afanasy__depend_mask_global', text=pm.optionVar.get( 'cgru_afanasy__depend_mask_global_ov', '')) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='<b>Host Mask</b>') pm.textField('cgru_afanasy__hosts_mask', text=pm.optionVar.get( 'cgru_afanasy__hosts_mask_ov', '')) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='<b>Host Exclude</b>') pm.textField('cgru_afanasy__hosts_exclude', text=pm.optionVar.get( 'cgru_afanasy__hosts_exclude_ov', '')) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='<b>Life Time (hours)</b>') pm.intField('cgru_afanasy__life_time', v=pm.optionVar.get('cgru_afanasy__life_time_ov', 240)) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='<b>Annotation</b>') pm.textField('cgru_afanasy__annotation', text=pm.optionVar.get( 'cgru_afanasy__annotation_ov', '')) pm.separator() pm.text(l='<h1><b>Block Parameters<b><h1>', h=section_label_height) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='<b>Errors Avoid Host</b>') pm.intField('cgru_afanasy__errors_avoid_host', v=pm.optionVar.get( 'cgru_afanasy__errors_avoid_host_ov', 3), min=0, max=127) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='<b>Errors Retries</b>') pm.intField('cgru_afanasy__errors_retries', v=pm.optionVar.get( 'cgru_afanasy__errors_retries_ov', 3), min=0, max=127) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='<b>Errors Task Same Host</b>') pm.intField('cgru_afanasy__errors_task_same_host', v=pm.optionVar.get( 'cgru_afanasy__errors_task_same_host_ov', 3), min=0, max=127) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='<b>Errors Forgive Time</b>', ann='in seconds') pm.intField('cgru_afanasy__errors_forgive_time', ann='in seconds', v=pm.optionVar.get( 'cgru_afanasy__errors_errors_forgive_time_ov', 18000), min=0) pm.separator() pm.text(l='<h1><b>Submission Details<b><h1>', h=section_label_height) with pm.rowLayout(nc=2, adj=2, cl2=('right', 'left'), cw2=(labels_width, 50)): pm.text(l='<b>Start Paused</b>', al='right') pm.checkBox('cgru_afanasy__paused', l='', v=pm.optionVar.get('cgru_afanasy__paused_ov', 0)) pm.radioButtonGrp( 'cgru_afanasy__separate_layers', numberOfRadioButtons=3, label='<b>Submit Render Layers<br>as Separate:</b>', labelArray3=['None', 'Block', 'Job'], # adj=1, cw4=[labels_width, 50, 50, 50], sl=pm.optionVar.get('cgru_afanasy__separate_layers_ov', 2)) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): ann = """This is a weird hack! When used in conjunction with the <b>Skip Existence Frames<b> parameter of the maya render settings and the Frames Per Task parameters is equal or greater than the number of frames in the animation range, it allows the Maya scene to be loaded only once per farm machine. But then to be able to use all farmers there should be at least the same amount of Jobs that there are farm machines. So with this parameter it is possible to submit the same job multiple times.. But it is a bad hack. This system will be updated in Afanasy.""" pm.text(l='<b>Submit Multiple Times</b>', ann=ann) pm.intField('cgru_afanasy__submit_multiple_times', ann=ann, v=pm.optionVar.get( 'cgru_afanasy__submit_multiple_times_ov', 1)) with pm.rowLayout(nc=2, adj=2, cl2=('right', 'left'), cw2=(labels_width, 40)): pm.text(l='<b>Generate Previews</b>', al='right') pm.checkBox('cgru_afanasy__generate_previews', l='', v=pm.optionVar.get( 'cgru_afanasy__generate_previews_ov', 1)) with pm.rowLayout(nc=2, adj=2, cl2=('right', 'left'), cw2=(labels_width, 40)): pm.text(l='<b>Close After</b>', al='right') pm.checkBox('cgru_afanasy__close', l='', v=1) pm.button(l='SUBMIT', c=self.launch) pm.showWindow(self.window)
def _build_hotkeys_frame(parent_layout): hotkeys_frame = pm.frameLayout(label="Hotkeys", collapsable=True) hotkeys_column = pm.columnLayout(adj=True, columnAttach=('both', 5)) pm.separator(height=5, style='none') # Toggle IK/FK mode Hotkey toggle_mode_cmd_name = 'mimic_toggleIkFkMode' toggle_mode_annotation_str = 'Toggles Mimic Robot plugin IK/FK mode' toggle_mode_command_str = 'import mimic_utils; ' \ 'mimic_utils.toggle_ik_fk_ui()' pm.rowLayout(numberOfColumns=4, adjustableColumn=2, columnAttach=(1, 'left', 0), columnWidth=[(1, 72), (3, 45), (4, 50)], height=20) # Find hotkey assignment, if one exists, to populate the ui toggle_mode_hotkey_name = toggle_mode_cmd_name + 'Hotkey' toggle_mode_key = mimic_utils.find_hotkey(toggle_mode_hotkey_name) if not toggle_mode_key: toggle_mode_key = ' key' pm.text(label='Toggle IK/FK:') pm.textField("t_toggleIkFk", font=FONT, placeholderText=toggle_mode_key) pm.button(label='Create', width=45, height=20, command=pm.Callback(mimic_utils.assign_hotkey, toggle_mode_cmd_name, toggle_mode_annotation_str, toggle_mode_command_str)) pm.button(label='Remove', width=50, height=20, command=pm.Callback(mimic_utils.remove_hotkey, toggle_mode_cmd_name)) pm.setParent('..') pm.separator(height=3, style='none') # Keyframe IK/FK Hotkey key_ik_fk_cmd_name = 'mimic_keyIkFk' key_ik_fk_annotation_str = 'Keys Mimic robot IK/FK attributes' key_ik_fk_command_str = 'import mimic_utils; ' \ 'mimic_utils.key_ik_fk()' pm.rowLayout(numberOfColumns=4, adjustableColumn=2, columnAttach=(1, 'left', 0), columnWidth=[(1, 72), (3, 45), (4, 50)], height=20) # Find hotkey assignment, if one exists, to populate the ui key_IkFk_hotkey_name = key_ik_fk_cmd_name + 'Hotkey' key_IkFk_key = mimic_utils.find_hotkey(key_IkFk_hotkey_name) if not key_IkFk_key: key_IkFk_key = ' key' pm.text(label='Key IK/FK:') pm.textField("t_keyIkFk", font=FONT, placeholderText=key_IkFk_key) pm.button(label='Create', width=45, height=20, command=pm.Callback(mimic_utils.assign_hotkey, key_ik_fk_cmd_name, key_ik_fk_annotation_str, key_ik_fk_command_str)) pm.button(label='Remove', width=50, height=20, command=pm.Callback(mimic_utils.remove_hotkey, key_ik_fk_cmd_name)) pm.setParent(hotkeys_column) pm.separator(height=8, style='none') pm.setParent(parent_layout)
def update_channel_stats(self, param_name): pm.text("OpenVDBChannelStats", edit=True, label=pm.getAttr(param_name))
def create_channel_stats(self, param_name): pm.text("OpenVDBChannelStats", label=pm.getAttr(param_name), align="left")
def randomizer_createUserInterface(): """-------------------------------------------------------------------------- Create User Interface Procedure --------------------------------------------------------------------------""" pm.window('randomizer_window', s=0, rtf=0, t="randomizer", wh=(300, 700)) # Create UI elements pm.columnLayout('mainColumnLayout', h=900, w=248, columnAlign="center", adjustableColumn=1) pm.separator('selectedTransformObjectsSeparator', h=10, w=240, st="none") pm.text('selectedTransformObjectsText', fn="boldLabelFont", h=24, l="selected transform Objects", w=240, al="center") pm.textScrollList('selectedTransformObjectsTextScrollList', h=80, w=240) pm.button('loadObjectsButton', h=28, c=lambda *args: randomizer_loadSelection(0), l="load transform Objects", w=240) pm.separator('selectedMaterialsSeparator', h=10, w=240, st="none") pm.text('selectedMaterialsText', fn="boldLabelFont", h=24, l="selected Materials", w=240, al="center") pm.textScrollList('selectedMaterialsTextScrollList', h=80, w=240) pm.button('loadMaterialsButton', h=28, c=lambda *args: randomizer_loadSelection(1), l="load Materials", w=240) pm.separator('transformAttributesSeparator', h=10, w=240, st="none") pm.text('randomizeAttributesText', fn="boldLabelFont", h=24, l="randomize Attributes", w=240, al="center") pm.checkBoxGrp('randomizeAttributesCheckBoxGrp', h=24, l4="Material", l2="Rotate", l3="Scale", w=240, l1="Translate", ncb=4, cw=[(1, 67), (2, 57), (3, 50), (4, 57)]) pm.separator('translateAttributesSeparator', h=10, w=240, st="none") pm.text('translateText', fn="boldLabelFont", h=24, l="Translate", w=240, al="center") pm.floatFieldGrp('minMaxXtranslateFloatFieldGrp', pre=3, el="max X", bgc=(0.25, 0, 0), h=24, l="min X", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.floatFieldGrp('minMaxYtranslateFloatFieldGrp', pre=3, el="max Y", bgc=(0, 0.25, 0), h=24, l="min Y", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.floatFieldGrp('minMaxZtranslateFloatFieldGrp', pre=3, el="max Z", bgc=(0, 0, 0.25), h=24, l="min Z", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.separator('rotateAttributesSeparator', h=10, w=240, st="none") pm.text('rotateText', fn="boldLabelFont", h=24, l="Rotate", w=240, al="center") pm.floatFieldGrp('minMaxXrotateFloatFieldGrp', pre=3, el="max X", bgc=(0.25, 0, 0), h=24, l="min X", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.floatFieldGrp('minMaxYrotateFloatFieldGrp', pre=3, el="max Y", bgc=(0, 0.25, 0), h=24, l="min Y", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.floatFieldGrp('minMaxZrotateFloatFieldGrp', pre=3, el="max Z", bgc=(0, 0, 0.25), h=24, l="min Z", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.separator('scaleAttributesSeparator', h=10, w=240, st="none") pm.text('scaleText', fn="boldLabelFont", h=24, l="Scale", w=240, al="center") pm.floatFieldGrp('minMaxXscaleFloatFieldGrp', pre=3, el="max X", bgc=(0.25, 0, 0), h=24, l="min X", nf=2, v1=1, v2=1, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.floatFieldGrp('minMaxYscaleFloatFieldGrp', pre=3, el="max Y", bgc=(0, 0.25, 0), h=24, l="min Y", nf=2, v1=1, v2=1, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.floatFieldGrp('minMaxZscaleFloatFieldGrp', pre=3, el="max Z", bgc=(0, 0, 0.25), h=24, l="min Z", nf=2, v1=1, v2=1, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.separator('randomizeSelectionSeparator', h=10, w=240, st="none") pm.button('randomizeAbsoluteButton', h=28, c=lambda *args: randomizer_randomizeSelection(), l="randomize Abolute", w=240) pm.button('randomizeRelativeButton', h=28, c=lambda *args: randomizer_randomizeSelection(relative=True), l="randomize Relative", w=240) pm.separator('timeAttributesSeparator', h=10, w=240, st="none") pm.text('timeText', fn="boldLabelFont", h=24, l="Time", w=240, al="center") pm.intFieldGrp('minMaxTimeIntFieldGrp', el="max", bgc=(0, 0, 0), h=24, l="min", nf=2, v1=-1, v2=1, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.button('setUniformKeyframe', h=28, c=lambda *args: rand_Keyframe(objects=None, attribute="all", axis=["X", "Y", "Z"], uniform=True, min=-10, max=10, step=1), l="Set Keyframes uniform", w=240) pm.button('setRandomKeyframe', h=28, c=lambda *args: rand_Keyframe(objects=None, attribute="all", axis=["X", "Y", "Z"], uniform=False, min=-10, max=10, step=1), l="Set Keyframes random", w=240) pm.separator('undoSeparator', h=10, w=240, st="none") pm.button('undoButton', h=28, c=lambda *args: pm.undo(), l="undo", w=240) pm.iconTextButton('staschiIconTextButton', h=28, c=lambda *args: randomizer_loadHelpWebsite(), l="www.staschi.com", w=240, st="textOnly") pm.setParent('..') pm.setParent('..') # Display UI pm.showWindow('randomizer_window')
def PrismTools_UI(): #PrismTools UI dimension winWidth = 250 winHeight = 500 # checking for duplicate windows windowID = 'PrismTools' if pm.window(windowID, exists=True): pm.deleteUI(windowID) # re-adjusting UI if UI is not correct try: if pm.windowPref(windowID, q=True, height=True) != winHeight or pm.windowPref( windowID, q=True, width=True) != winWidth: pm.windowPref(windowID, remove=True) except: pass # creating window pm.window(windowID, title=u'Prism Tools | Ver 2018 / 06 / 06', widthHeight=(winWidth, winHeight)) col = pm.columnLayout('MainColumn', width=400) # buttons for 2nd row AdvSke = pm.frameLayout(label=u'Advanced Skeleton', labelIndent=5, width=450, marginHeight=5, parent=col) ASRow = pm.rowLayout('row2', nc=5, width=450, parent=AdvSke) pm.text(label='', width=5, parent=ASRow) AS_button = partial(mel.eval, 'AdvancedSkeleton5') pm.iconTextButton( style='iconAndTextVertical', image1= r'\\p.sv\Tool\Advanced_Skeleton\AdvancedSkeleton5Files\icons\AS5.png', label='Adv Skeleton', parent=ASRow, command=AS_button, width=75) picker_button = partial( mel.eval, 'source "//p.sv/Tool/Advanced_Skeleton/AdvancedSkeleton5Files/Selector/biped.mel"' ) pm.iconTextButton( style='iconAndTextVertical', image1= r'\\p.sv\Tool\Advanced_Skeleton\AdvancedSkeleton5Files\icons\asBiped.png', label='Picker', parent=ASRow, command=picker_button, width=50) face_button = partial( mel.eval, 'source "//p.sv/Tool/Advanced_Skeleton/AdvancedSkeleton5Files/Selector/face.mel"' ) pm.iconTextButton( style='iconAndTextVertical', image1= r'\\p.sv\Tool\Advanced_Skeleton\AdvancedSkeleton5Files\icons\asFace.png', label='Picker', parent=ASRow, command=face_button, width=50) pm.button('Prism Exporter', label=u'出力', width=50, height=50, backgroundColor=(0.6, 0.6, 0.6), parent=ASRow, command=Prism_AdvSkeExporter.ExporterWindow().UI_exporter) ''' animFrame = pm.frameLayout(label=u'モーションツールス', labelIndent=5, width=450, marginHeight=5, parent=col) pm.rowLayout('row3', nc=5, width=450) pm.button('SER whipmake', label=u'SER 鞭リグ作る', width=150, height=20, backgroundColor=(0.6, 0.6, 0.6), parent='row3', command='whip = SERTools_001.whipMake_001.whipMake()') pm.button('SER fingerMirror_r', label=u'SER 指 右→左', width=75, height=20, backgroundColor=(0.6, 0.6, 0.6), parent='row3', command=FingerCopyPasta.rightFingerToLeft) pm.button('SER fingerMirror_l', label=u'SER 指 左→右', width=75, height=20, backgroundColor=(0.6, 0.6, 0.6), parent='row3', command=FingerCopyPasta.leftFingerToRight) pm.button('SER selectAll', label=u'SER select all', width=150, height=20, backgroundColor=(0.6, 0.6, 0.6), parent='row3', command="import pymel.core as pm\npm.select('Character1_Ctrl_HeadEffector', 'Character1_Ctrl_RightShoulderEffector', 'Character1_Ctrl_LeftShoulderEffector', 'Character1_Ctrl_RightElbowEffector', 'Character1_Ctrl_LeftElbowEffector', 'Character1_Ctrl_RightKneeEffector', 'Character1_Ctrl_LeftKneeEffector', 'Character1_Ctrl_RightHipEffector', 'Character1_Ctrl_LeftHipEffector', 'Character1_Ctrl_ChestOriginEffector', 'Character1_Ctrl_ChestEndEffector', 'Character1_Ctrl_HipsEffector', 'Character1_Ctrl_Spine2', 'Character1_Ctrl_Spine1', 'Character1_Ctrl_Spine', 'Character1_Ctrl_RightUpLeg', 'Character1_Ctrl_RightLeg', 'Character1_Ctrl_LeftUpLeg', 'Character1_Ctrl_LeftLeg', 'Character1_Ctrl_RightShoulder', 'Character1_Ctrl_LeftShoulder', 'Character1_Ctrl_RightArm', 'Character1_Ctrl_RightForeArm', 'Character1_Ctrl_LeftArm', 'Character1_Ctrl_LeftForeArm', 'Character1_Ctrl_Neck', 'Character1_Ctrl_RightHandPinkyEffector', 'Character1_Ctrl_RightHandRingEffector', 'Character1_Ctrl_RightHandMiddleEffector', 'Character1_Ctrl_RightHandIndexEffector', 'Character1_Ctrl_RightHandThumbEffector', 'Character1_Ctrl_RightWristEffector', 'Character1_Ctrl_RightHandPinky3', 'Character1_Ctrl_RightHandPinky2', 'Character1_Ctrl_RightHandPinky1', 'Character1_Ctrl_RightHandRing3', 'Character1_Ctrl_RightHandRing2', 'Character1_Ctrl_RightHandRing1', 'Character1_Ctrl_RightHandMiddle3', 'Character1_Ctrl_RightHandMiddle2', 'Character1_Ctrl_RightHandMiddle1', 'Character1_Ctrl_RightHandIndex3', 'Character1_Ctrl_RightHandIndex2', 'Character1_Ctrl_RightHandIndex1', 'Character1_Ctrl_RightHandThumb3', 'Character1_Ctrl_RightHandThumb2', 'Character1_Ctrl_RightHandThumb1', 'Character1_Ctrl_RightHand', 'Character1_Ctrl_LeftHandPinkyEffector', 'Character1_Ctrl_LeftHandRingEffector', 'Character1_Ctrl_LeftHandMiddleEffector', 'Character1_Ctrl_LeftHandIndexEffector', 'Character1_Ctrl_LeftHandThumbEffector', 'Character1_Ctrl_LeftWristEffector', 'Character1_Ctrl_LeftHandPinky3', 'Character1_Ctrl_LeftHandPinky2', 'Character1_Ctrl_LeftHandPinky1', 'Character1_Ctrl_LeftHandRing3', 'Character1_Ctrl_LeftHandRing2', 'Character1_Ctrl_LeftHandRing1', 'Character1_Ctrl_LeftHandMiddle3', 'Character1_Ctrl_LeftHandMiddle2', 'Character1_Ctrl_LeftHandMiddle1', 'Character1_Ctrl_LeftHandIndex3', 'Character1_Ctrl_LeftHandIndex2', 'Character1_Ctrl_LeftHandIndex1', 'Character1_Ctrl_LeftHandThumb3', 'Character1_Ctrl_LeftHandThumb2', 'Character1_Ctrl_LeftHandThumb1', 'Character1_Ctrl_LeftHand', 'Character1_Ctrl_RightFootIndexEffector', 'Character1_Ctrl_RightAnkleEffector', 'Character1_Ctrl_RightFootIndex1', 'Character1_Ctrl_RightFoot', 'Character1_Ctrl_LeftFootIndexEffector', 'Character1_Ctrl_LeftAnkleEffector', 'Character1_Ctrl_LeftFootIndex1', 'Character1_Ctrl_LeftFoot')\npm.select('Helper_Weapon1', 'x', 'y', 'z', add = True)") pm.rowLayout('row4', nc=5, width=450, parent=animFrame) pm.button('SER WeaponRig', label=u'SER 武器リグ', width=150, height=20, backgroundColor=(0.6, 0.6, 0.6), parent='row4', command=Weapon_Rig.rigUI) ''' pm.showWindow()
def __init__(self, baseFilePath, placerMapping, indMapping, meshNames): ''' create UI and init vars ''' self.imageRefPath = baseFilePath self.placerMapping = placerMapping self.indMapping = indMapping self.mesh = meshNames['face'] self.lf_eye = meshNames['leftEye'] self.rt_eye = meshNames['rightEye'] self.locTweakWidgets = {} self.placementGrp = None with pm.menu(l='Options') as menuOptions: pm.menuItem(l='Refresh') pm.menuItem(l='Reset') with pm.menu(l='Help') as menuHelp: pm.menuItem(l='Documentation') pm.menuItem(l='About') with pm.tabLayout() as mainTab: with pm.columnLayout(adj=True) as geoSelectionLayout: pass with pm.columnLayout(adj=True) as jntPlacementLayout: with pm.verticalLayout(ratios=(1, 10, 1), spacing=10) as jntPlacementVertLayout: #self.chk_symmetry = pm.checkBox(l='Symmetry', v=True) with pm.horizontalLayout() as startPlacementLayout: self.btn_startJntPlacement = pm.button( l='Start Joint Placement', c=pm.Callback(self.startJointPlacement), w=180) self.img_jntReference = pm.image(image=self.imageRefPath + 'default.jpg') with pm.rowLayout(numberOfColumns=3, adj=2) as jntRowLayout: self.btn_jntScrollLt = pm.button(l='<<', w=40, en=False) self.txt_jntCurrent = pm.text( label= 'Click "Start Joint Placement" above to begin.', align='center') self.btn_jntScrollRt = pm.button( l='>>', w=40, c=pm.Callback(self.selectNextItem), en=False) pm.separator(style='in') with pm.horizontalLayout(ratios=(1, 5), spacing=5): with pm.verticalLayout(): # left labels self.locTweakWidgets['txt_position'] = pm.text( label='Position', align='right', en=False) self.locTweakWidgets['txt_orient'] = pm.text( label='Orient', align='right', en=False) self.locTweakWidgets['txt_scale'] = pm.text( label='Scale', align='right', en=False) self.locTweakWidgets['txt_mirror'] = pm.text( label='Mirror', align='right', en=False) with pm.verticalLayout(): # right buttons with pm.horizontalLayout(): self.locTweakWidgets['btn_prevCV'] = pm.button( l='Prev CV', en=False, c=pm.Callback(self.stepCV, -1)) self.locTweakWidgets['btn_nextCV'] = pm.button( l='Next CV', en=False, c=pm.Callback(self.stepCV, 1)) self.locTweakWidgets['btn_snapToVtx'] = pm.button( l='Snap to Vtx', en=False) self.locTweakWidgets['btn_user'] = pm.button( l='User', en=False) with pm.horizontalLayout(): self.locTweakWidgets['btn_normal'] = pm.button( l='Normal', en=False) self.locTweakWidgets['btn_normal_yup'] = pm.button( l='Normal + Y-up', en=False) self.locTweakWidgets['btn_world'] = pm.button( l='World', en=False) self.locTweakWidgets[ 'btn_orient_user'] = pm.button(l='User', en=False) with pm.horizontalLayout(): self.locTweakWidgets[ 'float_scale'] = pm.floatSliderGrp( f=True, min=0.01, max=1.0, v=0.5, pre=2, fmx=10.0, en=False, dc=pm.Callback(self.editLocScale)) with pm.horizontalLayout(): self.locTweakWidgets['btn_mirLtToRt'] = pm.button( l='Left to Right', en=False, c=pm.Callback(self.mirrorLocs)) self.locTweakWidgets['btn_mirRtToLt'] = pm.button( l='Right to Left', en=False) pm.separator(style='in') with pm.verticalLayout(spacing=5) as buildRigVertLayout: self.btn_updateLocs = pm.button(l='Update All Locators', en=False) self.btn_buildRig = pm.button(l='Build Rig', c=pm.Callback(self.buildRig), en=False) with pm.columnLayout(adj=True) as deformationLayout: pass with pm.columnLayout(adj=True) as motionLayout: pass with pm.columnLayout(adj=True) as actionsLayout: pass mainTab.setTabLabel((geoSelectionLayout, 'Geometry')) mainTab.setTabLabel((jntPlacementLayout, 'Joints')) mainTab.setTabLabel((deformationLayout, 'Deformation')) mainTab.setTabLabel((motionLayout, 'Motion')) mainTab.setTabLabel((actionsLayout, 'Action Units')) mainTab.setSelectTab(jntPlacementLayout) self.show()
def create(self): # Create default render globals node if needed. createGlobalNodes() parentForm = pm.setParent(query=True) pm.setUITemplate("renderGlobalsTemplate", pushTemplate=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) columnWidth = 400 with pm.scrollLayout("appleseedScrollLayout", horizontalScrollBarThickness=0): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): with pm.frameLayout(label="Sampling", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self.__addControl(ui=pm.intFieldGrp( label="Pixel Samples", numberOfFields=1), attrName="samples") self.__addControl(ui=pm.intFieldGrp( label="Render Passes", numberOfFields=1), attrName="passes") self.__addControl(ui=pm.intFieldGrp(label="Tile Size", numberOfFields=1), attrName="tileSize") with pm.frameLayout(label="Shading", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): attr = pm.Attribute( "appleseedRenderGlobals.diagnostics") menuItems = [ (i, v) for i, v in enumerate(attr.getEnums().keys()) ] self.__addControl(ui=pm.attrEnumOptionMenuGrp( label="Override Shaders", enumeratedItem=menuItems), attrName="diagnostics") with pm.frameLayout(label="Lighting", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self.__addControl( ui=pm.checkBoxGrp(label="Global Illumination"), attrName="gi") self.__addControl(ui=pm.checkBoxGrp(label="Caustics"), attrName="caustics") self.__addControl(ui=pm.intFieldGrp(label="GI Bounces", numberOfFields=1), attrName="bounces") self.__addControl(ui=pm.floatFieldGrp( label="Max Ray Intensity", numberOfFields=1), attrName="maxRayIntensity") self.__addControl(ui=pm.floatFieldGrp( label="Light Samples", numberOfFields=1), attrName="lightSamples") self.__addControl(ui=pm.floatFieldGrp( label="Environment Samples", numberOfFields=1), attrName="envSamples") with pm.frameLayout(label="Environment", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): with pm.rowLayout("appleseedRowLayout", nc=3): pm.text("Environment Light") ui = pm.optionMenu( changeCommand=self.__environmentLightSelected) pm.menuItem(label="<none>") for envLight in g_environmentLightsList: pm.menuItem(label=envLight) self.__uis["envLight"] = ui logger.debug( "Created globals env light menu, name = %s" % ui) self.__addControl( ui=pm.checkBoxGrp(label="Background Emits Light"), attrName="bgLight") with pm.frameLayout(label="System", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self.__addControl(ui=pm.intFieldGrp(label="Threads", numberOfFields=1), attrName="threads") pm.setUITemplate("renderGlobalsTemplate", popTemplate=True) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[("appleseedScrollLayout", "top", 0), ("appleseedScrollLayout", "bottom", 0), ("appleseedScrollLayout", "left", 0), ("appleseedScrollLayout", "right", 0)]) logger.debug("Created appleseed render global main tab") # Update the newly created tab. self.update()
def display(cls): """ creates and displays a window """ # window UI window_name = cls.WINDOW_NAME title = "Images Importer" if pm.window(window_name, ex=True): pm.deleteUI(window_name) pm.windowPref(window_name, remove=1) main_window = pm.window(window_name, t=title, iconName='icon_Name', wh=(280, 190), s=1, tb=1) form = pm.formLayout(numberOfDivisions=100) sep0 = pm.separator(style="in", h=3) rows = pm.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 110), (2, 130)]) pm.text(label='Image Card Prefix: ', al="right") cls.img_pref_input = pm.textField(tx="img_") pm.setParent('..') sep1 = pm.separator(style="in", h=3) cls.cb_alpha = pm.checkBox(l="Alpah Channel", al="center") cls.cb_scale = pm.checkBox( l="Scale Ratio", al="center", changeCommand= "from image_card_importer.image_card_importer_tool import window_ui\n" "window_ui.cb_scale_toggled()") cls.size_mult_input = pm.textField(tx="2", enable=0) cls.cb_seq = pm.checkBox(l="Image Sequence", al="center") sep2 = pm.separator(style="in", h=3) btn_notes_txt = pm.text( label='Please select image files to import as cards', al="center", font="obliqueLabelFont") btn_import = pm.button(l="Import Images", al="center", h=30, w=150) btn_import.setCommand( "from image_card_importer.image_card_importer_tool import window_ui\nwindow_ui.import_button()" ) pm.formLayout(form, edit=True, attachForm=[ (sep0, 'left', 5), (sep0, 'right', 5), (sep0, 'top', 0), (rows, 'left', 10), (rows, 'right', 10), (cls.cb_alpha, 'left', 20), (btn_notes_txt, 'left', 40), (cls.cb_scale, 'left', 20), (sep1, 'left', 5), (sep1, 'right', 5), (sep2, 'left', 5), (sep2, 'right', 5), (btn_import, 'left', 65), ], attachControl=[ (rows, 'top', 10, sep0), (cls.cb_alpha, 'top', 10, sep1), (cls.cb_seq, 'top', 10, sep1), (cls.cb_seq, 'left', 12, cls.cb_alpha), (cls.cb_scale, 'top', 10, cls.cb_seq), (cls.size_mult_input, 'top', 10, cls.cb_seq), (cls.size_mult_input, 'left', 30, cls.cb_scale), (sep1, 'top', 10, rows), (sep2, 'top', 10, cls.cb_scale), (btn_notes_txt, 'top', 10, sep2), (btn_import, 'top', 10, btn_notes_txt), ]) pm.showWindow(main_window) pm.columnLayout()
def perform_p4_command(*args): print args command = pm.textField('Command', query=True, text=True) fstat = FStat() message = fstat.perform_perforce_command(command) pm.text("Command", edit=True, label=message)
def create(self): # Create default render globals node if needed. createGlobalNodes() parentForm = pm.setParent(query=True) pm.setUITemplate("renderGlobalsTemplate", pushTemplate=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) columnWidth = 400 with pm.scrollLayout("appleseedScrollLayout", horizontalScrollBarThickness=0): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): with pm.frameLayout(label="Sampling", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self.__addControl(ui=pm.intFieldGrp( label="Pixel Samples", numberOfFields=1), attrName="samples") self.__addControl(ui=pm.intFieldGrp( label="Render Passes", numberOfFields=1), attrName="passes") self.__addControl(ui=pm.intFieldGrp(label="Tile Size", numberOfFields=1), attrName="tileSize") with pm.frameLayout(label="Lighting", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self.__addControl( ui=pm.checkBoxGrp(label="Global Illumination"), attrName="gi", changeCallback=self.__updateGIControls) self.__addControl(ui=pm.checkBoxGrp(label="Caustics"), attrName="caustics") self.__addControl(ui=pm.intFieldGrp(label="GI Bounces", numberOfFields=1), attrName="bounces") with pm.frameLayout(label="Environment", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): with pm.rowLayout("appleseedRowLayout", nc=3): pm.text("Environment Light") ui = pm.optionMenu() pm.menuItem(label='<none>') self.__uis["envLight"] = ui # todo: add change callback here... #self.__scriptJobs["envLight"] = mc.scriptJob( # attributeChange=["appleseedRenderGlobals.envLight", changeCallback]) self.__addControl( ui=pm.checkBoxGrp(label="Background Emits Light"), attrName="bgLight") with pm.frameLayout(label="System", collapsable=True, collapse=False): with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth): self.__addControl(ui=pm.intFieldGrp(label="Threads", numberOfFields=1), attrName="threads") pm.setUITemplate("renderGlobalsTemplate", popTemplate=True) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[("appleseedScrollLayout", "top", 0), ("appleseedScrollLayout", "bottom", 0), ("appleseedScrollLayout", "left", 0), ("appleseedScrollLayout", "right", 0)]) logger.debug("Created appleseed render global main tab") # Update the newly created tab. self.update()
def create_layout(self): u"""标签栏之AR控制栏 :return: layout """ layout = pm.formLayout("ARFormTab") self.work_mode_control = pm.radioButtonGrp( label=u"AR模式:", numberOfRadioButtons=2, labelArray2=['Face Unity', 'AR kit'], cw3=[60, 80, 80], sl=2) self.json_location_widget = pm.textFieldButtonGrp( "ARFileLocationField", label=u"存放路径:", bl=u"指定路径", adj=2, cw3=[60, 100, 60], text=self.ar_file_location, bc=lambda *args: self.set_json_location()) self.ar_channel_options = pm.optionMenuGrp( label=u"识别通道:", cw2=[60, 100], adj=2, cc=lambda *args: self.selected_ar_channel()) detail_frame = pm.frameLayout(label=u"通道属性", bgs=True, mw=10, mh=10) detail_form = pm.formLayout() ar_id_slider = pm.floatSliderGrp("arIDControlSlider", enable=False, label=u"滑竿控制", field=True, minValue=0, maxValue=1.0, fieldMinValue=0, fieldMaxValue=1.0, pre=3, adj=3, value=0, cw3=[120, 60, 100]) self.ar_item_scroll = pm.textScrollList( w=200, ams=True, sc=lambda *args: self.selected_ar_item_in_scroll()) pm.popupMenu() pm.menuItem(label=u"添加映射", c=lambda *args: self.new_mapping()) pm.menuItem(divider=True) pm.menuItem( label=u"添加影响骨骼", c=lambda *args: self.new_joint_to_ar_channel(auto_sdk=False)) pm.menuItem( label=u"添加骨骼和SDK", c=lambda *args: self.new_joint_to_ar_channel(auto_sdk=True)) pm.menuItem(divider=True) pm.menuItem(label=u"移除选择骨骼", c=lambda *args: self.remove_select_joint_in_scroll()) pm.menuItem(divider=True) pm.menuItem(label=u"选择所有骨骼", c=lambda *args: self.select_all_joint_in_scroll()) ar_item_data_layout = pm.columnLayout(adj=1, rs=2) self.ar_item_joint_name = pm.text(label=u"Joint name", al="left", fn="boldLabelFont") self.ar_item_attr_tx = pm.floatFieldGrp(adj=1, cw2=[80, 80], label="translateX", pre=3) self.ar_item_attr_ty = pm.floatFieldGrp(adj=1, cw2=[80, 80], label="translateY", pre=3) self.ar_item_attr_tz = pm.floatFieldGrp(adj=1, cw2=[80, 80], label="translateZ", pre=3) self.ar_item_attr_rx = pm.floatFieldGrp(adj=1, cw2=[80, 80], label="rotateX", pre=3) self.ar_item_attr_ry = pm.floatFieldGrp(adj=1, cw2=[80, 80], label="rotateY", pre=3) self.ar_item_attr_rz = pm.floatFieldGrp(adj=1, cw2=[80, 80], label="rotateZ", pre=3) self.ar_item_attr_sx = pm.floatFieldGrp(adj=1, cw2=[80, 80], label="scaleX", pre=3) self.ar_item_attr_sy = pm.floatFieldGrp(adj=1, cw2=[80, 80], label="scaleY", pre=3) self.ar_item_attr_sz = pm.floatFieldGrp(adj=1, cw2=[80, 80], label="scaleZ", pre=3) pm.button(label="Update Selected", c=lambda *args: self.update_sdk_json(type="select")) pm.button(label="Update All", c=lambda *args: self.update_sdk_json(type="all")) pm.setParent("..") # end of ar_item_data_layout pm.formLayout(detail_form, edit=True, attachForm=[ (ar_id_slider, 'left', 0), (ar_id_slider, 'right', 0), (self.ar_item_scroll, 'left', 0), (self.ar_item_scroll, 'bottom', 0), (ar_item_data_layout, 'right', 0), (ar_item_data_layout, 'bottom', 0), ], attachControl=[ (self.ar_item_scroll, 'top', 7, ar_id_slider), (ar_item_data_layout, 'top', 7, ar_id_slider), (ar_item_data_layout, 'left', 5, self.ar_item_scroll), ]) pm.setParent("..") # end of detail_form pm.setParent("..") # end of detail_frame pm.formLayout(layout, edit=True, attachForm=[ (self.work_mode_control, 'top', 5), (self.work_mode_control, 'left', 5), (self.json_location_widget, 'left', 10), (self.json_location_widget, 'right', 10), (self.ar_channel_options, 'left', 10), (detail_frame, 'left', 10), (detail_frame, 'right', 10), (detail_frame, 'bottom', 10), ], attachControl=[ (self.json_location_widget, 'top', 5, self.work_mode_control), (self.ar_channel_options, 'top', 7, self.json_location_widget), (detail_frame, 'top', 10, self.ar_channel_options), ]) pm.setParent("..") return layout
def ui_createUI(self): if pm.window(WIN_NAME, exists=True): pm.deleteUI(WIN_NAME, window=True) # TODO: need a window close event for saving prefs on [X] button click. pm.scriptJob(uiDeleted=(WIN_NAME, self.ui_saveSettings)) doesnt work cause ui elements already deleted. May be PythonAPI callbacks (Astus as an example) # TODO: looks like prefs are saved only on Close button click. Look to other PyMel UI Scripts with pm.window(WIN_NAME, title=WIN_TITLE, maximizeButton=False, menuBar=True, menuBarVisible=True) as self.window: pm.setUITemplate('DefaultTemplate', pushTemplate=True) pm.menu(label='Edit', tearOff=False) pm.menuItem(label='Reset Settings', command=self.ui_resetSettings) pm.menu(label='Help', tearOff=False) pm.menuItem(label='Help on ' + WIN_TITLE, command=self.ui_showHelp) with pm.formLayout() as self.ui_LAY_mainForm: with pm.tabLayout(tabsVisible=False) as self.ui_TAB_top: pm.tabLayout(self.ui_TAB_top, e=True, height=1) with pm.formLayout() as self.ui_LAY_attachForm: with pm.tabLayout( tabsVisible=False, scrollable=True, innerMarginWidth=4) as self.ui_TAB_inner: with pm.columnLayout( adjustableColumn=True, rowSpacing=4) as self.ui_LAY_mainColumn: # -------------------- with self.ui_createFrame( 'ui_LAY_frameOptions', 'Options') as self.ui_LAY_frameOptions: with pm.columnLayout( adjustableColumn=True ): # columnOffset=('both', 2)): self.ui_RADBTNGRP_shapeProcessing = pm.radioButtonGrp( 'ui_RADBTNGRP_shapeProcessing', label='Shape Processing:', labelArray3=[ "Rename shapes according to it's transforms\n(even if it's not selected)", "Don't rename shapes", 'Treat shapes as ordinary nodes' ], numberOfRadioButtons=3, columnWidth=[1, UI_LABEL_WIDTH], columnAttach=[1, 'right', 5], vertical=True, select= SHAPE_PROCESSING_ACCORDING_TO_TRANSFORM ) # pm.separator(style='none', height=2) # -------------------- with self.ui_createFrame( 'ui_LAY_frameSimpleRename', 'Rename' ) as self.ui_LAY_frameSimpleRename: with pm.columnLayout(adjustableColumn=True, columnOffset=('both', 2)): self.ui_TXTFLDGRP_simpleRename = pm.textFieldGrp( 'ui_TXTFLDGRP_simpleRename', label='New Name', columnWidth=[1, UI_LABEL_WIDTH], columnAttach=[1, 'right', 5], adjustableColumn=2) pm.separator(style='none', height=2) self.ui_BTN_simpleRename = pm.button( label='Rename', command=pm.Callback( self.ui_onRenameClick, RENAME_ACTION_SIMPLE_RENAME)) pm.separator(style='none', height=2) # -------------------- with self.ui_createFrame( 'ui_LAY_frameFindReplace', 'Find and Replace' ) as self.ui_LAY_frameFindReplace: with pm.columnLayout(adjustableColumn=True, columnOffset=('both', 2)): self.ui_TXTFLDGRP_find = pm.textFieldGrp( 'ui_TXTFLDGRP_find', label='Find', columnWidth=[1, UI_LABEL_WIDTH], columnAttach=[1, 'right', 5], adjustableColumn=2) self.ui_TXTFLDGRP_replace = pm.textFieldGrp( 'ui_TXTFLDGRP_replace', label='Replace With', columnWidth=[1, UI_LABEL_WIDTH], columnAttach=[1, 'right', 5], adjustableColumn=2) pm.separator(style='none', height=2) self.ui_BTN_findReplace = pm.button( label='Find and Replace', command=pm.Callback( self.ui_onRenameClick, RENAME_ACTION_FIND_REPLACE)) pm.setParent(self.ui_LAY_mainColumn) # -------------------- with self.ui_createFrame( 'ui_LAY_framePrefix', 'Add Prefix' ) as self.ui_LAY_framePrefix: with pm.columnLayout(adjustableColumn=True, columnOffset=('both', 2)): self.ui_TXTFLDGRP_prefix = pm.textFieldGrp( 'ui_TXTFLDGRP_prefix', label='Prefix', columnWidth=[1, UI_LABEL_WIDTH], columnAttach=[1, 'right', 5], adjustableColumn=2) pm.separator(style='none', height=2) self.ui_BTN_prefix = pm.button( label='Add Prefix', command=pm.Callback( self.ui_onRenameClick, RENAME_ACTION_PREFIX)) pm.setParent(self.ui_LAY_mainColumn) # -------------------- with self.ui_createFrame( 'ui_LAY_frameSuffix', 'Add Suffix' ) as self.ui_LAY_frameSuffix: with pm.columnLayout(adjustableColumn=True, columnOffset=('both', 2)): self.ui_TXTFLDGRP_suffix = pm.textFieldGrp( 'ui_TXTFLDGRP_suffix', label='Suffix', columnWidth=[1, UI_LABEL_WIDTH], columnAttach=[1, 'right', 5], adjustableColumn=2) pm.separator(style='none', height=2) self.ui_BTN_prefix = pm.button( label='Add Suffix', command=pm.Callback( self.ui_onRenameClick, RENAME_ACTION_SUFFIX)) # -------------------- with self.ui_createFrame( 'ui_LAY_frameRenameNumber', 'Rename and Number' ) as self.ui_LAY_frameRenameNumber: with pm.columnLayout(adjustableColumn=True, columnOffset=('both', 2)): with pm.frameLayout( labelVisible=False, collapsable=False, marginHeight=3, # borderStyle='in', # borderVisible=True, enable=False): with pm.columnLayout( adjustableColumn=True, columnOffset=('both', 3)): helpText = '' helpText += 'Type "#" symbol(s) in New Name where you want to place numbering.\n' helpText += 'For example:\n' helpText += ' pCube# -> pCube1, pCube2, ..., pCube15, ...\n' helpText += ' pCube#### -> pCube0001, pCube0002, ..., pCube0015, ...\n' helpText += ' obj_##_a -> obj_01_a, obj_02_a, ..., obj_15_a, ...\n' helpText += 'Omitting "#" will result in pattern:\n' helpText += ' pCube -> pCube1, pCube2, ..., pCube15, ...' self.ui_TXT_help = pm.text( helpText, align='left') pm.separator(style='none', height=2) self.ui_TXTFLDGRP_renameNumber = pm.textFieldGrp( 'ui_TXTFLDGRP_renameNumber', label='New Name', columnWidth=[1, UI_LABEL_WIDTH], columnAttach=[1, 'right', 5], adjustableColumn=2) self.ui_INTFLDGRP_startIndex = pm.intFieldGrp( 'ui_INTFLDGRP_startIndex', label='Start Index', columnWidth2=[UI_LABEL_WIDTH, 60], columnAttach=[1, 'right', 5]) pm.separator(style='none', height=2) self.ui_BTN_prefix = pm.button( label='Rename and Number', command=pm.Callback( self.ui_onRenameClick, RENAME_ACTION_NUMBER)) self.ui_BTN_close = pm.button(label='Close', height=30, command=self.ui_close) pm.setUITemplate('DefaultTemplate', popTemplate=True) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'top', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'left', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'right', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'bottom', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'top', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'left', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'right', 0) self.ui_LAY_mainForm.attachControl(self.ui_TAB_top, 'bottom', 5, self.ui_BTN_close) self.ui_LAY_mainForm.attachNone(self.ui_BTN_close, 'top') self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'left', 5) self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'bottom', 5) self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'right', 5) self.window.show() pm.refresh()
def _build_add_external_axis_frame(parent_layout): pm.frameLayout('add_external_axis_frame', label="Add External Axis", collapsable=True) add_external_axis_col = pm.columnLayout(adj=True, columnAttach=('both', 5)) pm.separator(height=5, style='none') pm.rowLayout(numberOfColumns=2, adjustableColumn=2, columnAlign=[(1, 'left'), (2, 'left')], columnAttach=[(1, 'both', -1), (2, 'both', 0), (3, 'both', 0)]) pm.text(label='Axis Name: ') pm.textField('t_externalAxisDescriptionText', placeholderText='axisName', font=FONT) pm.setParent('..') pm.separator(height=3, style='none') def __set_limit_display_units(*args): if 'translate' in args[0]: pm.textField('t_externalAxisLimitMin', edit=True, placeholderText='mm') pm.textField('t_externalAxisLimitMax', edit=True, placeholderText='mm') pm.textField('t_externalAxisVelocityLimit', edit=True, placeholderText='m/s') else: pm.textField('t_externalAxisLimitMin', edit=True, placeholderText='deg') pm.textField('t_externalAxisLimitMax', edit=True, placeholderText='deg') pm.textField('t_externalAxisVelocityLimit', edit=True, placeholderText='deg/s') pm.optionMenu('axisNumberMenu', label='Axis Number:', height=18) axis_number_list = [i + 1 for i in range(6)] for axis_number in axis_number_list: pm.menuItem(label=axis_number) pm.separator(height=3, style='none') pm.optionMenu('drivingAttributeMenu', label='Driving Attribute:', height=18, changeCommand=__set_limit_display_units) driving_attributes = [ 'translateX', 'translateY', 'translateZ', 'rotateX', 'rotateY', 'rotateZ' ] for attr in driving_attributes: pm.menuItem(label=attr) pm.separator(height=3, style='none') pm.rowLayout(numberOfColumns=3, adjustableColumn=3, columnAttach=(1, 'left', -1), columnWidth=[(1, 80), (2, 65), (3, 65)], height=20) pm.text(label='Position Limits:') pm.textField('t_externalAxisLimitMin', placeholderText='mm') pm.textField('t_externalAxisLimitMax', placeholderText='mm') pm.setParent('..') pm.rowLayout(numberOfColumns=2, adjustableColumn=2, columnAttach=(1, 'left', -1), columnWidth=[(1, 80)], height=20) pm.text(label='Velocity Limit:') pm.textField('t_externalAxisVelocityLimit', placeholderText='m/s') pm.setParent('..') pm.rowLayout(numberOfColumns=1) pm.checkBox('cb_attachRobotToController', label="Attach robot to controller", value=0) pm.setParent('..') pm.rowLayout(numberOfColumns=1) pm.checkBox('cb_ignoreExternalAxis', label="Ignore in prostprocessor", value=0) pm.setParent('..') pm.separator(height=4, style='none') pm.setParent(add_external_axis_col) pm.button('b_add_Axis', label='Add Axis', height=25, backgroundColor=[.361, .361, .361], command=mimic_external_axes.add_external_axis) pm.separator(height=5, style='none') pm.setParent(parent_layout)
def makePanel(cls, switch): """ @switch: True -> export False -> import """ global col_ope1 global col_ope2 global pal_opMenu global ani_textFd global brn_opMenu global sht_opMenu col_ope1 = cls.uiName + 'col_ope1' col_ope2 = cls.uiName + 'col_ope2' pal_opMenu = cls.uiName + 'pal_opMenu' ani_textFd = cls.uiName + 'ani_textFd' brn_opMenu = cls.uiName + 'brn_opMenu' sht_opMenu = cls.uiName + 'sht_opMenu' if pm.columnLayout(col_ope1, q=1, ex=1): pm.deleteUI(col_ope1) if pm.columnLayout(col_ope2, q=1, ex=1): pm.deleteUI(col_ope2) pm.columnLayout(col_ope1, p=cls.col_oper) # ********************************************* # ROW ONE - chd num 2 row1 = pm.rowLayout(nc=2) if row1: # CHD 0 pm.columnLayout(cal='left') pm.text(l=' + Collection', h=20) pal_opMenu = pm.optionMenu(w=140) if switch: for pal in pm.ls(type='xgmPalette'): pm.menuItem(pal.name(), p=pal_opMenu) else: if cls.linked: palList = os.listdir(cls.vsRepo) for pal in palList: if os.path.isdir(os.path.join(cls.vsRepo, pal)): pm.menuItem(pal, p=pal_opMenu) pm.setParent('..') # CHD 1 pm.columnLayout(cal='left') if switch: pm.text(l=' + ANIM Branch', h=20) ani_textFd = pm.textField(text='', w=100, en=False) else: pm.text(l=' + ANIM Branch', h=20) brn_opMenu = pm.optionMenu(w=100) pm.setParent('..') pm.setParent('..') pm.setParent('..') pm.columnLayout(col_ope2, p=cls.col_oper) # ********************************************* # ROW TWO A - chd num 1 shotRow = pm.rowLayout(nc=1, vis=switch) if shotRow: # CHD 0 pm.columnLayout(cal='left') pm.text(l=' * Shot Name', h=20) txt_shot = pm.textField(w=140, en=False) pm.setParent('..') pm.setParent('..') # ********************************************* # ROW TWO B - chd num 1 animRow = pm.rowLayout(nc=1, vis=not switch) if animRow: # CHD 0 pm.columnLayout(cal='left') pm.text(l=' = Shot List', h=20) sht_opMenu = pm.optionMenu(w=140) pm.setParent('..') pm.setParent('..') pm.setParent('..') # FUNCTION SET def animBranchList(*args): """doc""" if brn_opMenu.getItemListLong(): brn_opMenu.clear() if cls.linked and os.listdir( cls.vsRepo) and pal_opMenu.getItemListLong(): palPath = os.path.join(cls.vsRepo, pal_opMenu.getValue()) prefix = cls.dirAnim verList = [] if os.path.exists(palPath): #verList = [d[len(prefix):-2] for d in os.listdir(palPath) if d.startswith(prefix)] verList = [ d[len(prefix):] for d in os.listdir(palPath) if d.startswith(prefix) ] verList = list(set(verList)) for ver in verList: pm.menuItem(ver, p=brn_opMenu) def animBranchName(*args): """doc""" if pal_opMenu.getItemListLong(): palName = str(pal_opMenu.getValue()) branchName = cls.getAnimBranch(palName)[len(cls.dirAnim):] pm.textField(ani_textFd, e=1, text=branchName) else: pm.textField(ani_textFd, e=1, text='') def getShotName(*args): """doc""" if pal_opMenu.getItemListLong(): palName = str(pal_opMenu.getValue()) shotName = cls.getAnimShotName(palName) pm.textField(txt_shot, e=1, text=shotName) else: pm.textField(txt_shot, e=1, text='') def shotNameList(*args): """doc""" if sht_opMenu.getItemListLong(): sht_opMenu.clear() if cls.linked and os.listdir( cls.vsRepo) and brn_opMenu.getItemListLong(): palName = str(pal_opMenu.getValue()) version = cls.dirAnim + str(brn_opMenu.getValue()) shotDir = cls.paletteDeltaDir(palName, version, '') if os.path.exists(shotDir): shotList = os.listdir(shotDir) if shotList: for shot in shotList: pm.menuItem(shot, p=sht_opMenu) def snapshot_show(index, *args): """doc""" imgPath = cls.snapNull if cls.linked and os.listdir( cls.vsRepo) and pal_opMenu.getItemListLong(): palName = pal_opMenu.getValue() version = '' shotName = '' if pm.optionMenu(brn_opMenu, q=1, ill=1): version = cls.dirAnim + pm.optionMenu(brn_opMenu, q=1, v=1) if pm.optionMenu(sht_opMenu, q=1, ill=1): shotName = sht_opMenu.getValue() if palName and version and shotName: imgPath = cls.snapshotImgPath(palName, version, str(index + 1), shotName) imgPath = imgPath if os.path.isfile(imgPath) else cls.snapNull pm.image(cls.img_snap, e=1, i=imgPath) pm.button(cls.snapBtnn + str(index + 1), e=1, bgc=cls.snapShow) for i in range(5): if not i == index: pm.button(cls.snapBtnn + str(i + 1), e=1, bgc=cls.snapRest) def process(mqsb, *args): """doc""" if mqsb.isChecked(): # export if not pal_opMenu.getNumberOfItems(): pm.warning( '[XGen Hub] : There are no collections in current scene.') return None palName = str(pal_opMenu.getValue()) cls.exportVRaySceneFile(palName) else: # import if not pal_opMenu.getNumberOfItems(): pm.warning('[XGen Hub] : There are no collections in repo.') return None if not brn_opMenu.getNumberOfItems(): pm.warning( '[XGen Hub] : This collection has no animBranch in repo yet.' ) return None if not sht_opMenu.getNumberOfItems(): pm.warning( '[XGen Hub] : This collection has no exported shot in repo yet.' ) return None # simple check if geo selected geoSelected = False if pm.ls(sl=1): for dag in pm.ls(sl=1): if dag.type() == 'transform': for shp in dag.getShapes(): if shp.type() == 'mesh': geoSelected = True break if geoSelected: break if not geoSelected: pm.warning('[XGen Hub] : Please select a geometry.') return None palName = str(pal_opMenu.getValue()) version = cls.dirAnim + str(brn_opMenu.getValue()) shotName = str(sht_opMenu.getValue()) cls.importAnimResult(palName, version, shotName) # MODIFY if switch: for i in range(5): pm.button(cls.snapBtnn + str(i + 1), e=1, en=1, c=partial(cls.snapshot_take, i), bgc=cls.snapRest) def animBranchAndShotName(*args): """doc""" animBranchName() getShotName() pm.optionMenu(pal_opMenu, e=1, cc=animBranchAndShotName) #load animBranchAndShotName() else: for i in range(5): pm.button(cls.snapBtnn + str(i + 1), e=1, c=partial(snapshot_show, i)) def animBranchAndShotListAndSnapshot(*args): """doc""" animBranchList() shotNameList() snapshot_show(0) pm.optionMenu(pal_opMenu, e=1, cc=animBranchAndShotListAndSnapshot) def shotListAndSnapshot(*args): """doc""" shotNameList() snapshot_show(0) pm.optionMenu(brn_opMenu, e=1, cc=shotListAndSnapshot) pm.optionMenu(sht_opMenu, e=1, cc=partial(snapshot_show, 0)) # load animBranchAndShotListAndSnapshot() cls.proc_btn.setCommand(partial(process, cls.qsb_mode))
def _build_general_settings_tab(parent_layout): # Create column Layout for General settings general_settings_tab_layout = pm.columnLayout('generalSettings', adj=True, width=100) pm.separator(height=3, style='none') pm.rowLayout(numberOfColumns=3, columnWidth3=(55, 250, 30), adjustableColumn=2, columnAlign=[(1, 'left'), (2, 'left')], columnAttach=[(1, 'both', -1), (2, 'both', 0), (3, 'both', 0)]) pm.text(label="Directory:") pm.textField('t_programDirectoryText', text='', ed=False, font=FONT) pm.symbolButton('b_directoryImage', image="setDirectory_icon.png", width=32, height=20, command=mimic_utils.set_program_dir) pm.setParent('..') pm.rowLayout(numberOfColumns=2, adjustableColumn=2, columnAttach=(1, 'left', -1), columnWidth=[(1, 90), (2, 100)], height=20) pm.text(label='Output name:') pm.textField('t_outputFileName', text=postproc_config.DEFAULT_OUTPUT_NAME, font=FONT) pm.setParent('..') pm.rowLayout(numberOfColumns=2, adjustableColumn=2, columnAttach=(1, 'left', -1), columnWidth=[(1, 90), (2, 100)], height=20) pm.text(label='Template name:') pm.textField('t_templateFileName', text=postproc_config.DEFAULT_TEMPLATE_NAME, font=FONT) pm.setParent('..') # Sample rate radio buttons pm.separator(height=3, style='none') selected_units = postproc_config.DEFAULT_SAMPLE_RATE_UNITS selected_value = postproc_config.DEFAULT_SAMPLE_RATE_VALUE radio_indent = 3 pm.radioCollection('sample_rate_radio_collection') pm.rowLayout(numberOfColumns=3, adjustableColumn=3, columnAttach=(1, 'left', radio_indent), columnWidth=[(1, 90), (2, 45)], height=20) pm.radioButton('rb_timeInterval', label='Sample rate:', select=True) pm.textField('t_timeBetweenSamples', text=selected_value, font=FONT) pm.radioButtonGrp( 'time_unit_radio_group', labelArray2=['s', 'f'], annotation='Sample rate units: seconds or frames', numberOfRadioButtons=2, columnWidth2=[32, 30], select=1 if selected_units == 'seconds' else 2) # 1-based integer pm.setParent('..') pm.rowLayout(numberOfColumns=1, adjustableColumn=1, columnAttach=(1, 'left', radio_indent), height=20) pm.radioButton('rb_keyframesOnly', label='Sample keyframes only', enable=True) pm.setParent('..') pm.rowLayout(numberOfColumns=3, adjustableColumn=3, columnAttach=(1, 'left', -1), columnWidth=[(1, 132), (2, 40), (3, 30)], height=20) pm.text(label='Animation frame range:') pm.intField("i_programStartFrame", value=pm.playbackOptions(animationStartTime=True, query=True), minValue=-10, maxValue=100000, step=1) pm.intField("i_programEndFrame", value=pm.playbackOptions(animationEndTime=True, query=True), minValue=-10, maxValue=100000, step=1) pm.setParent('..') pm.separator(height=5, style='none') # Post processor option menu list pm.optionMenu('postProcessorList', label='Processor:', height=18, changeCommand=postproc_options.overwrite_options) # Get supported post-processors and fill option menu list supported_post_processors = postproc_setup.get_processor_names() for post in supported_post_processors: pm.menuItem(label=post) pm.separator(height=3, style='none') pm.setParent(parent_layout) return general_settings_tab_layout
def makeHairUI(): shapeType = ['circle', 'triangle', 'square'] axisType = ['x', 'y', 'z'] mirrorType = ['world', 'local'] if pm.window('MakeHairUI', ex=True): pm.deleteUI('MakeHairUI', window=True) pm.windowPref('MakeHairUI', remove=True) pm.window('MakeHairUI', t="MakeHairUI") pm.frameLayout(label="Create Hair Parameters") pm.columnLayout(adjustableColumn=1) pm.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 90), (2, 100)]) pm.text(label="Name: ", align='right') hairNameUI = pm.textField(text="HairMesh#") pm.text(label="Material: ", align='right') matNameUI = pm.textField(text="SY_mtl_hairSG") pm.text(label="CreaseSet: ", align='right') hsSetNameUI = pm.textField(text="hairCrease") #pm.text(label="PointCreaseSet: ",align='right') #hpSetNameUI=pm.textField(text="hairPointCrease") pm.text(label="Length Divs: ", align='right') LDivsValUI = pm.intField(value=7, min=4) pm.text(label="Width Divs: ", align='right') WDivsValUI = pm.intField(value=4, min=4) pm.text(label="Segments: ", align='right') segmentValUI = pm.intField(value=4, min=2) pm.text(label="Width: ", align='right') segmentWidthUI = pm.floatField(value=1, min=0.01) pm.text(label="Delete Curves: ", align='right') DelCurveUI = pm.checkBox(label=" ", value=False) pm.text(label="Reverse: ", align='right') RevCurveUI = pm.checkBox(label=" ", value=False) pm.text(label="Control Type: ", align='right') cShapeOpUI = pm.optionMenu() for st in shapeType: pm.menuItem(label=st) pm.text(label="Mirror Type: ", align='right') mirrorOpUI = pm.optionMenu() for mt in mirrorType: pm.menuItem(label=mt) pm.text(label="Mirror Axis: ", align='right') axisOpUI = pm.optionMenu() for ax in axisType: pm.menuItem(label=ax) colorUI = pm.colorSliderGrp(label='', rgb=(0, 0, 1), co3=(0, 0, 0), cw3=(30, 60, 60), cl3=('left', 'center', 'right')) pm.button(label="Set", c=lambda *arg: setColor(colorUI.getRgbValue())) pm.button(label="SelectCtr", c=lambda *arg: selHair()) pm.popupMenu() pm.menuItem(label='Set pivot to root', c=lambda *arg: selHair(setPivot=True)) pm.menuItem(label='Set pivot to tip', c=lambda *arg: selHair(pivot=-1, setPivot=True)) pm.menuItem(label='Show all controls', c=lambda *arg: ToggleHairCtrlVis(state='show')) pm.menuItem(label='Hide all controls', c=lambda *arg: ToggleHairCtrlVis(state='hide')) pm.button(label="Create", c=lambda *arg: makeHairMesh(name=hairNameUI.getText(), mat=matNameUI.getText(), cSet=hsSetNameUI.getText(), reverse=RevCurveUI.getValue(), lengthDivs=LDivsValUI.getValue(), widthDivs=WDivsValUI.getValue(), Segments=segmentValUI.getValue(), width=segmentWidthUI.getValue(), curveDel=DelCurveUI.getValue(), cShape=cShapeOpUI.getValue())) pm.popupMenu() pm.menuItem( label='Rebuild', c=lambda *arg: selHair( rebuild=[True, LDivsValUI.getValue(), WDivsValUI.getValue()])) pm.menuItem( label='Rebuild also controls', c=lambda *arg: selHair( rebuild=[True, LDivsValUI.getValue(), WDivsValUI.getValue()], cShape=(True, cShapeOpUI.getValue(), segmentWidthUI.getValue()))) pm.button(label="Duplicate", c=lambda *arg: dupHairMesh()) pm.popupMenu() pm.menuItem(label='Mirror', c=lambda *arg: dupHairMesh(mirror=True, axis=axisOpUI.getValue(), space=mirrorOpUI.getValue())) pm.button(label="RemoveHair", c=lambda *arg: delHair()) pm.popupMenu() pm.menuItem(label='RemoveControl', c=lambda *arg: delHair(keepHair=True)) pm.menuItem(label='RemoveAllControl', c=lambda *arg: cleanHairMesh()) pm.setParent('..') pm.showWindow()
pm.confirmDialog(title='Confirm', message='Failed!', button=['555'], defaultButton='Yes') def OnOpen(): singleFilter = "All Files (*.*)" file_path = str( cmds.fileDialog2(dialogStyle=2, fileMode=1, okCaption='select')[0]) preview_path.setFileName(file_path) pm.window('Submit Asset') pm.columnLayout(columnAttach=('both', 5), rowSpacing=2, columnWidth=350) pm.text(' ') pm.rowLayout(numberOfColumns=2, columnWidth2=(220, 25), adjustableColumn=2, columnAlign=(1, 'left')) asset_name_field = pm.uitypes.TextFieldButtonGrp() asset_name_field.setFileName(OnGetAssetGroup('')) get_asset_group = pm.uitypes.Button() get_asset_group.setLabel('<') get_asset_group.setCommand(OnGetAssetGroup) pm.setParent('..') clean_btn = pm.uitypes.Button() clean_btn.setLabel('Clean Up') clean_btn.setCommand(OnCleanUp) pm.text(' ') op = pm.uitypes.OptionMenu()
def buildUI(self, filter=None): if filter: match = False for i, info in enumerate(self.methodInfoList): argUtil = factories.ApiArgUtil(self.apiClassName, self.apiMethodName, i) if filter.intersection(argUtil.getInputTypes() + argUtil.getOutputTypes()): match = True break if match == False: return False self.layout = { 'columnAlign': [1, 'right'], 'columnAttach': [1, 'right', 8] } #print className, self.methodName, melMethods isOverloaded = len(self.methodInfoList) > 1 self.frame = pm.frameLayout(w=FRAME_WIDTH, labelVisible=False, collapsable=False) logger.debug("building row for %s - %s" % (self.methodName, self.frame)) col = pm.columnLayout() enabledArray = [] self.rows = [] self.overloadPrecedenceColl = None self.enabledChBx = pm.checkBox(label=self.methodName, changeCommand=pm.CallbackWithArgs( MethodRow.enableCB, self)) if isOverloaded: self.overloadPrecedenceColl = pm.radioCollection() for i in range(len(self.methodInfoList)): self.createMethodInstance(i) else: #row = rowLayout( self.methodName + '_rowMain', nc=2, cw2=[200, 400] ) #self.enabledChBx = checkBox(label=self.methodName, changeCommand=CallbackWithArgs( MethodRow.enableCB, self ) ) #text(label='') self.createMethodInstance(0) #setParent('..') pm.setParent(col) pm.separator(w=800, h=6) #self.row = rowLayout( self.methodName + '_rowSettings', nc=4, cw4=[200, 160, 180, 160] ) #self.rows.append(row) self.row = pm.rowLayout(self.methodName + '_rowSettings', nc=2, cw2=[200, 220], **self.layout) self.rows.append(self.row) # create ui elements pm.text(label='Mel Equivalent') self.melNameTextField = pm.textField(w=170, editable=False) self.melNameOptMenu = pm.popupMenu(parent=self.melNameTextField, button=1, postMenuCommand=pm.Callback( MethodRow.populateMelNameMenu, self)) pm.setParent('..') self.row2 = pm.rowLayout(self.methodName + '_rowSettings2', nc=3, cw3=[200, 180, 240], **self.layout) self.rows.append(self.row2) pm.text(label='Use Name') self.nameMode = pm.radioButtonGrp(label='', nrb=3, cw4=[1, 50, 50, 50], labelArray3=['api', 'mel', 'other']) self.altNameText = pm.textField(w=170, enable=False) self.altNameText.changeCommand( pm.CallbackWithArgs(MethodRow.alternateNameCB, self)) self.nameMode.onCommand(pm.Callback(MethodRow.nameTypeCB, self)) isEnabled = self.data.get('enabled', True) # UI SETUP melName = self.data.get('melName', '') try: #self.melNameOptMenu.setValue( melName ) self.melNameTextField.setText(melName) if melName != '': self.parent.parent.assignMelMethod(melName) except RuntimeError: # it is possible for a method name to be listed here that was set from a different view, # where this class was a super class and more mel commands were available. expand the option list, # and make this frame read-only pm.menuItem(label=melName, parent=self.melNameOptMenu) self.melNameOptMenu.setValue(melName) logger.debug("making %s frame read-only" % self.methodName) self.frame.setEnable(False) self.enabledChBx.setValue(isEnabled) self.row.setEnable(isEnabled) self.row2.setEnable(isEnabled) name = self.data['useName'] if name == 'API': self.nameMode.setSelect(1) self.altNameText.setEnable(False) elif name == 'MEL': self.nameMode.setSelect(2) self.altNameText.setEnable(False) else: self.nameMode.setSelect(3) self.altNameText.setText(name) self.altNameText.setEnable(True) if self.overloadPrecedenceColl: items = self.overloadPrecedenceColl.getCollectionItemArray() try: val = self.data['overloadIndex'] if val is None: logger.info("no wrappable options for method %s" % self.methodName) self.frame.setEnable(False) else: self.overloadPrecedenceColl.setSelect(items[val]) except: pass # # ensure we don't use a value that is not valid # for val in range(val, len(enabledArray)+1): # try: # if enabledArray[val]: # break # except IndexError: # val = None # if val is not None: # self.overloadPrecedenceColl.setSelect( items[ val ] ) pm.setParent('..') pm.setParent('..') # frame pm.setParent('..') # column return True