def __init__(self): windowID = 'selNodeWnd' if pm.window('selNodeWnd', exists=1): pm.deleteUI('selNodeWnd') tmpl = pm.uiTemplate(windowID + '_uiTmpl', force=1) tmpl.define('columnLayout', adj=1, cat=('both', 5), rs=5) tmpl.define('button', h=40) tmpl.define('textFieldGrp', cl2=['center', 'left'], ad2=2, cw2=[30, 40]) tmpl.define('checkBoxGrp', v1=0, cw=[1, 80]) wnd = pm.window(windowID, t='Sel Node Editor', s=1, rtf=1, toolbox=1) with tmpl: with pm.columnLayout(): with pm.horizontalLayout() as createLayout: pm.textFieldGrp( 'nameTxt', l='Node Name', ann=self.uiAnn['kwTxt'], cw2=[80, 80], cal=[1, 'left'], en=1, tx="userNode", ) pm.button('createNodeBtn', l='Create Node', ann=self.uiAnn['createNode'], w=30, c=self.createNodeBtnCmd) with pm.horizontalLayout() as kwTxtLayout: pm.textFieldGrp('kwTxt', l='Searching KeyWords', ann=self.uiAnn['kwTxt'], cw2=[110, 40], cal=[1, 'left'], en=1) with pm.horizontalLayout() as btnLayout3: pm.button('readNodeBtn', l='Read Node', ann=self.uiAnn['selNode'], c=self.readNodeBtnCmd) pm.button('addToNodeBtn', l='Add to Node', ann=self.uiAnn['addToNode'], c=self.addToNodeBtnCmd) pm.button('reMoveFrmNodeBtn', l='Remove Frm Node', ann=self.uiAnn['reMoveFrmNode'], c=self.reMoveFrmNodeCmd) wnd.show()
def set_template(): template = pm.uiTemplate('tim_template', force=1) template.define(pm.window, edit=1, resizeToFitChildren=1) template.define(pm.button, width=100, height=30, align='left') template.define(pm.frameLayout, borderVisible=1, labelVisible=0, height=35, borderStyle="etchedIn") template.define(pm.rowLayout, columnAlign1=('left'), height=30) template.define(pm.text, align='left', height=30) return template
def build(self): template = pm.uiTemplate('MovieTemplate', force = 1) template.define(pm.frameLayout, bv = 1, lv = 0, mh = 5, mw = 2) with pm.window('ImportMovieWin', title = 'ImportMovieWin', wh = (300, 120), s = 0) as win: with template: with pm.columnLayout(rs = 3, adj = 1): with pm.frameLayout(): self.path = pm.textFieldButtonGrp( label='Path', text='', buttonLabel='Browse', cw3 = (30,155,20), adjustableColumn3 = 2, cl3 = ('left', 'center', 'right'), bc = self.browse, cc = self.getPath ) with pm.frameLayout(): with pm.rowColumnLayout(nc = 2, cw = [(1, 70), (2, 50)], cs = (5, 5)): pm.text(l = 'Offset Frame:', w = 60) self.frameOffset = pm.intField() with pm.frameLayout(): with pm.rowColumnLayout(nc = 3, cw = [(1, 100), (2, 100), (3, 100)]): pm.button(l = 'Import', c = self.importBtnCmd) pm.button(l = 'Modify', c = self.modifyBtnCmd) pm.button(l = 'Delete', c = self.deleteBtnCmd)
def ui(self): template = pm.uiTemplate('ExampleTemplate', force=True) template.define(pm.button, height=30, w=80) template.define(pm.frameLayout, mw=2, mh=2, borderVisible=False, labelVisible=False) if pm.window(self.name, q=1, ex=1): pm.deleteUI(self.name) with pm.window("TiltTool_win", t=self.title, s=False, tlb=True, mnb=True) as win: with template: with pm.frameLayout(): with pm.columnLayout(adj=True, rs=10): pm.text(label="OPTIONS", h=30, fn="boldLabelFont") with pm.frameLayout(): with pm.columnLayout(adj=True, rs=5): with pm.rowLayout(columnWidth3=(0, 0, 0), adj=True, numberOfColumns=4): pm.text(label="Tilt Control ", align='left') self.tiltCtrl = pm.textFieldGrp( pht="Select the tilt control", cw1=150, tx=self.tiltCtrl_txt) pm.text(label="< < < ") pm.button(label="Add", h=25, backgroundColor=colordic['green3'], c=pm.Callback(self.getCtrl)) with pm.rowLayout(columnWidth3=(0, 0, 0), adj=True, numberOfColumns=4): pm.text(label="Mesh ", align='left') self.mesh = pm.textFieldGrp( pht="Select the mesh", cw1=150, tx=self.mesh_txt) pm.text(label="< < < ") pm.button(label="Add", h=25, backgroundColor=colordic['green3'], c=pm.Callback(self.getMesh)) with pm.rowLayout(columnWidth3=(0, 0, 0), adj=True, numberOfColumns=4): pm.text(label="Target Parent Group", align='left') self.target = pm.textFieldGrp( pht="Select the target", cw1=150, tx=self.parent_txt) pm.text(label="< < < ") pm.button(label="Add", h=25, backgroundColor=colordic['green3'], c=pm.Callback(self.getTarget)) with pm.rowLayout(columnWidth3=(0, 0, 0), adj=True, numberOfColumns=4): pm.text(label="Mesh Last Offset Ctrl", align='left') self.offset_ctrl = pm.textFieldGrp( pht="Select the target", cw1=150, tx=self.offset_txt) pm.text(label="< < < ") pm.button(label="Add", h=25, backgroundColor=colordic['green3'], c=pm.Callback(self.getOffsetCtrl)) pm.separator() pm.text(label="RIGGING", h=20, fn="boldLabelFont") pm.separator() with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=7): pm.text( label=" CHOOSE AXIS ", h=50, ) if self.axisZ_setdata == 'True': pm.checkBox("myChBxZ", l="Z axis", h=25, value=True) else: pm.checkBox("myChBxZ", l="Z axis", h=25, value=False) if self.axisX_setdata == 'True': pm.checkBox("myChBxX", l="X axis", h=25, value=True) else: pm.checkBox("myChBxX", l="X axis", h=25, value=False) pm.button(label="Save Data", w=88, h=25, backgroundColor=colordic['blue'], c=pm.Callback(self.saveData)) pm.button(label="Clear Info", w=88, h=25, backgroundColor=colordic['darkblue'], c=pm.Callback(self.refresh)) with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=2): pm.button(label="Build Basic Guide", w=197, backgroundColor=colordic['grey'], c=pm.Callback(self.buildGuide)) pm.button(label="Build Basic Rig", w=197, backgroundColor=colordic['grey'], c=pm.Callback(self.buildRig))
def create(self): """ Generates a new maya window object and binds it to the singleton instance. """ SCENE = Scene() self._win = window(title=self.window_title, resizeToFitChildren=True) with self._win: template = uiTemplate('LocalSubmitTemplate', force=True ) template.define(frameLayout, bs='etchedIn', mw=6, mh=6, labelVisible=False) template.define(columnLayout, adj=True, rs=4) template.define(formLayout, nd=100) # padding adjustment for pre-qt maya versions if versions.current() <= versions.v2010: template.define(text, align='right', h=22) else: template.define(text, align='right', h=20) with template: with formLayout() as mainForm: with frameLayout() as setFrame: with formLayout() as setForm: with columnLayout() as setCol1: text(label="Title:") text(label="Start Frame:") text(label="End Frame:") text(label="Frame Step:") text(label="Emulation:", annotation='If selected, the local render will behave in the same environtment as the Cluster, otherwise it will act as a normal local batch render') with columnLayout() as setCol2: self._controls['title'] = textField(text=get_scene_name()) self._controls['start'] = intField(value=get_frame_range()[0]) self._controls['end'] = intField(value=get_frame_range()[1]) self._controls['step'] = intField(value=int(SCENE.defaultRenderGlobals.byFrameStep.get())) self._controls['emulate'] = checkBox(label="Cluster Emulation", annotation='If selected, the local render will behave in the same environtment as the Cluster, otherwise it will act as a normal local batch render') self._controls['pause'] = checkBox(label="Pause before exit") # self._controls['debug'] = checkBox(label="Show debug messages") setForm.attachForm(setCol1, 'left', 4) setForm.attachControl(setCol1, 'right', 2, setCol2) setForm.attachForm(setCol2, 'right', 4) setForm.attachPosition(setCol2, 'left', 40, 20) with frameLayout() as subFrame: submit_btn = button(label="Submit", width=200, height=40, align='center') submit_btn.setCommand(self.submit_job) mainForm.attachForm(setFrame, 'top', 4) mainForm.attachForm(setFrame, 'left', 4) mainForm.attachForm(setFrame, 'right', 4) mainForm.attachControl(setFrame, 'bottom', 4, subFrame) mainForm.attachForm(subFrame, 'bottom', 4) mainForm.attachForm(subFrame, 'left', 4) mainForm.attachForm(subFrame, 'right', 4) """ We force the closure of an open submit window on scene open to ensure the new scene's settings are reflected. """ scriptJob(parent=self._win, runOnce=True, event=('SceneOpened', SubmitGui.destroy))
def RecostructUI(self): template = pm.uiTemplate() template.define(pm.frameLayout , mh=6 , mw=5) template.define(pm.columnLayout , adj=1 , rs=2) with pm.window('RecostructWin' , title='Recostruct Subdiv v1.3' , menuBar=True , menuBarVisible=True) as win: pm.window('RecostructWin' , edit=True , width=420 , height=172) with pm.frameLayout(lv=False , bv=False , mh=2 , mw=7): with template: with pm.columnLayout(): pm.button(label='Recostruct Subdiv' , c=pm.Callback(self.Main) , h=40 , bgc=self.clrs['orange']) with pm.frameLayout('more' , l='More' , cll=True , cl=True , ec=pm.Callback(self.expand) , cc=pm.Callback(self.collapse)): with pm.columnLayout(cat=('left' , -20)): pm.checkBoxGrp( numberOfCheckBoxes=1 , columnAlign=(1 , 'right') , label='Settings: ' , label1='Keep original (Recostructing is not undoable)' , v1=True , on1=pm.Callback(self.keepOrig_True) , of1=pm.Callback(self.keepOrig_False) ) pm.checkBoxGrp( numberOfCheckBoxes=1 , columnAlign=(1 , 'right') , label='' , label1='Recostruct vertex positions' , v1=True , on1=pm.Callback(self.curvature_True) , of1=pm.Callback(self.curvature_False) , ) pm.checkBoxGrp( 'sharpCorners' , numberOfCheckBoxes=1 , columnAlign=(1 , 'right') , label='' , label1='Sharp corners' , v1=True , on1=pm.Callback(self.sharpCorners_True) , of1=pm.Callback(self.sharpCorners_False) , ) pm.checkBoxGrp( numberOfCheckBoxes=1 , columnAlign=(1 , 'right') , label='' , label1='Turn Off progress bar (Increase speed)' , v1=False , on1=pm.Callback(self.progress_False) , of1=pm.Callback(self.progress_True) ) rb = pm.radioButtonGrp(numberOfRadioButtons=1 , on1=pm.Callback(self.reverse_False) , label='' , sl=1 , label1='Default starting point (For most cases)') pm.radioButtonGrp(numberOfRadioButtons=1 , on1=pm.Callback(self.reverse_True) , shareCollection=rb , label='' , label1='Reverse starting point (For special cases)') with pm.frameLayout(l='Progress'): pm.progressBar('progress' , h=25 , ii=True) with pm.rowColumnLayout( numberOfColumns=2 , cal=[(1 , 'left') , (2 , 'right')] , columnWidth=[(1 , 275) , (2 , 125)] ): pm.textField('meshes' , text='' , ed=False , width=200) pm.text('meshesNum' , label='' , height=25)
def create(self): """ Generates a new maya window object and binds it to the singleton instance. """ SCENE = Scene() self._win = window(title=self.window_title, resizeToFitChildren=True) with self._win: template = uiTemplate('HpcSubmitTemplate', force=True ) template.define(frameLayout, bs='etchedIn', mw=6, mh=6, labelVisible=False) template.define(columnLayout, adj=True, rs=4) template.define(formLayout, nd=100) # padding adjustment for pre-qt maya versions if versions.current() <= versions.v2010: template.define(text, align='right', h=22) else: template.define(text, align='right', h=20) with template: with formLayout() as mainForm: with frameLayout() as setFrame: with formLayout() as setForm: with columnLayout() as setCol1: text(label="Head Node:") text(label="Title:") text(label="Start Frame:") text(label="End Frame:") text(label="Frame Step:") # text(label="Cores:") with columnLayout() as setCol2: self._controls['head_node'] = optionMenu() with self._controls['head_node']: for host in HEAD_NODES: menuItem(label=host) self._controls['head_node'].setSelect(randint(1,len(HEAD_NODES))) self._controls['title'] = textField(text=get_scene_name()) self._controls['start'] = intField(value=get_frame_range()[0]) self._controls['end'] = intField(value=get_frame_range()[1]) self._controls['step'] = intField(value=int(SCENE.defaultRenderGlobals.byFrameStep.get())) # with columnLayout(adj=False): # self._controls['threads'] = optionMenu(w=40) # with self._controls['threads']: # menuItem(label=2) # menuItem(label=4) # self._controls['threads'].setSelect(1) self._controls['pause'] = checkBox(label="Pause before exit") self._controls['debug'] = checkBox(label="Show debug messages") setForm.attachForm(setCol1, 'left', 4) setForm.attachControl(setCol1, 'right', 2, setCol2) setForm.attachForm(setCol2, 'right', 4) setForm.attachPosition(setCol2, 'left', 40, 20) with frameLayout() as subFrame: submit_btn = button(label="Submit", width=200, height=40, align='center') submit_btn.setCommand(self.submit_job) mainForm.attachForm(setFrame, 'top', 4) mainForm.attachForm(setFrame, 'left', 4) mainForm.attachForm(setFrame, 'right', 4) mainForm.attachControl(setFrame, 'bottom', 4, subFrame) mainForm.attachForm(subFrame, 'bottom', 4) mainForm.attachForm(subFrame, 'left', 4) mainForm.attachForm(subFrame, 'right', 4) """ We force the closure of an open submit window on scene open to ensure the new scene's settings are reflected. """ scriptJob(parent=self._win, runOnce=True, event=('SceneOpened', SubmitGui.destroy))
upDirLabel = pm.radioButton(pm.radioCollection(upAxisCollection, query = True, select = True), query = True, label = True) if aimDirStr == 'aimX' and upDirLabel == 'X': pm.radioButton(upAxisYBtn, edit = True, select = True) elif aimDirStr == 'aimY' and upDirLabel == 'Y': pm.radioButton(upAxisZBtn, edit = True, select = True) elif aimDirStr == 'aimZ' and upDirLabel == 'Z': pm.radioButton(upAxisXBtn, edit = True, select = True) elif aimDirStr == 'upX' and aimDirLabel == 'X': pm.radioButton(aimAxisYBtn, edit = True, select = True) elif aimDirStr == 'upY' and aimDirLabel == 'Y': pm.radioButton(aimAxisZBtn, edit = True, select = True) elif aimDirStr == 'upZ' and aimDirLabel == 'Z': pm.radioButton(aimAxisXBtn, edit = True, select = True) # create template for UI template = pm.uiTemplate('jointOrientTemplate', force = True) template.define(pm.frameLayout, labelVisible = False, marginHeight = 2, marginWidth = 2, width = 455) template.define(pm.rowLayout, columnWidth5 = [455/5, 455/5, 455/5, 455/5, 455/5]) # create window with template and ui elements with pm.window(title="joakimJointOrient 1.0.1", sizeable = False) as win: with template: with pm.columnLayout(rowSpacing = 5): with pm.frameLayout(): pm.text(label = "Show or Hide Local Rotation Axes") with pm.rowLayout(numberOfColumns = 2): showAxisBtn = pm.button(label='Show', width = 455/2) hideAxisBtn = pm.button(label='Hide', width = 455/2) with pm.columnLayout(columnWidth = 455, columnAttach = ('both', 5)): PropToChildrenBox = pm.checkBox(label = "Show/Hide children", value = True) with pm.frameLayout():
def ui(self): template = pm.uiTemplate('ExampleTemplate', force=True) template.define(pm.button, width=120, 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) as self.win: with template: with pm.frameLayout(): with pm.columnLayout(adj=True, rs=2): with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=2): pm.text(label="All Cameras", w=120) pm.text(label="Selected Cameras", w=120) with pm.rowLayout(numberOfColumns=4): self.all_cams = pm.textScrollList( h=120, allowMultiSelection=True, append=self.allCam, dcc=pm.Callback(self.getSelected), w=120) self.sel_cam = pm.textScrollList( h=120, allowMultiSelection=True, w=120, dcc=pm.Callback(self.getSelected2)) with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=2): pm.button(label="Refresh", backgroundColor=(0.373, 0.404, 0.459), c=pm.Callback(self.refresh_allCam)) pm.button(label="Reset", backgroundColor=(0.373, 0.404, 0.459), c=pm.Callback(self.refresh_selCam)) with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=2): pm.button(label="Add Custom Cam", w=240, backgroundColor=colordic['darkblue'], c=pm.Callback(self.AddCams)) with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=2): pm.button(label="Remove Custom Cam", w=240, backgroundColor=colordic['darkblue'], c=pm.Callback(self.removeCam)) with pm.rowLayout(columnWidth3=(0, 0, 0), numberOfColumns=1): pm.button(label="Toggle", w=240, backgroundColor=colordic['green3'], c=pm.Callback(self.toggleCam))
def ui(self): template = pm.uiTemplate('ExampleTemplate', force=True) template.define(pm.button, width=200, height=25) template.define(pm.frameLayout, borderVisible=False, labelVisible=False) with template: with pm.formLayout(): pm.dockControl("adb_Module", content=self.win, a="left") with pm.columnLayout(adj=True, rs=1): with pm.columnLayout(adj=True, rs=4): self.docString = pm.checkBox(l='Doc String') with pm.frameLayout(cll=True, bgc=(0.202, 0.202, 0.202), labelVisible=True, cl=False, label="INFORMATION"): with pm.columnLayout(adj=True, rs=4): pm.button(label="Print List", backgroundColor=colordic['grey1'], c=pm.Callback(adb.List)) pm.button(label="Print Type", backgroundColor=colordic['grey1'], c=pm.Callback(self.Type)) pm.button(label="Print Type PyMel", backgroundColor=colordic['grey1'], c=pm.Callback(self.TypePymel)) with pm.frameLayout(cll=True, bgc=(0.202, 0.202, 0.202), labelVisible=True, cl=False, label="RIGGING"): with pm.columnLayout(adj=True, rs=4): pm.button(label="Pv Guide", backgroundColor=colordic['grey1'], c=pm.Callback(self._pvGuide)) pm.button(label="Find Constraint Driver", backgroundColor=colordic['grey1'], c=pm.Callback(self.consDriver)) pm.button(label="Find Constraint Target", backgroundColor=colordic['grey1'], c=pm.Callback(self.consTarget)) pm.button(label="DrivenKeys to Remap Value", backgroundColor=colordic['grey1'], c=pm.Callback(self.DkToRv)) pm.button(label="Rivet From Face", backgroundColor=colordic['grey1'], c=lambda *args: adbRivet. rivet_from_faces(scale=0.2)) pm.button(label="Sticky From Face", backgroundColor=colordic['grey1'], c=lambda *args: adbRivet. sticky_from_faces(scale=0.2)) def proxyPlane(axis): if axis == " - X AXIS -": adbProxy.plane_proxy( pm.selected(), 'proxy_plane', 'x') elif axis == " - Y AXIS -": adbProxy.plane_proxy( pm.selected(), 'proxy_plane', 'y') elif axis == " - Z AXIS -": adbProxy.plane_proxy( pm.selected(), 'proxy_plane', 'z') elif axis == " - Create Proxy Plane -": pass else: pm.warning('Choice None Existant') pm.optionMenu(w=200, h=30, cc=proxyPlane) pm.menuItem( label=" - Create Proxy Plane -") pm.menuItem( label=" - X AXIS -") pm.menuItem( label=" - Y AXIS -") pm.menuItem( label=" - Z AXIS -") def mirrorChoice(axis): if axis == " - X AXIS -": adbTransform.Transform( pm.selected()).mirror(axis='x') elif axis == " - Y AXIS -": adbTransform.Transform( pm.selected()).mirror(axis='y') elif axis == " - Z AXIS -": adbTransform.Transform( pm.selected()).mirror(axis='z') elif axis == " - Choose Axis Mirror -": pass else: pm.warning('Choice None Existant') pm.optionMenu(w=200, h=30, cc=mirrorChoice) pm.menuItem( label=" - Choose Axis Mirror -") pm.menuItem( label=" - X AXIS -") pm.menuItem( label=" - Y AXIS -") pm.menuItem( label=" - Z AXIS -") with pm.rowLayout(adj=True, numberOfColumns=2): pm.button(label="Get Node Type", backgroundColor=colordic['green3'], c=pm.Callback(self.NodeType), w=20, h=25) self.nodeName = pm.textField( pht="Name the animation node", tx='animCurve', ) with pm.columnLayout(adj=True, rs=4): pm.button(label="DrivenKeys to Remap Value", backgroundColor=colordic['grey1'], c=pm.Callback(self.DkToRv)) pm.separator(h=2) with pm.rowLayout(adj=True, numberOfColumns=1): pm.text( label="Follicules Options", h=20, ) with pm.rowLayout(adj=True, numberOfColumns=4): pm.text(label="Number") self.folli = pm.floatField(v=5, precision=1, showTrailingZeros=0) pm.text(label=" Radius ") self.radius = pm.floatField(v=1, precision=2, showTrailingZeros=0) self.folli_ctrl = pm.checkBox(l='With Controls', v=True) pm.button(label="Create Follicules", backgroundColor=colordic['grey1'], c=pm.Callback(self.Folli)) pm.button(label="Add Controls", backgroundColor=colordic['grey1'], c=pm.Callback(self._addControls)) with pm.frameLayout(cll=True, bgc=(0.202, 0.202, 0.202), labelVisible=True, cl=False, label="OUTPUT WINDOW"): with pm.columnLayout(adj=True, rs=5): pm.text(label="Output Window", h=20) self.outputWin = pm.textScrollList(w=150, h=60) pm.button( label="Refresh", backgroundColor=colordic['grey2'], c=lambda *args: pm.textScrollList( self.outputWin, edit=True, removeAll=True), h=25) with pm.frameLayout(cll=True, bgc=(0.202, 0.202, 0.202), labelVisible=True, cl=False, label="SKINNING"): with pm.columnLayout(adj=True, rs=4): pm.button(label="Reset Skin", backgroundColor=colordic['grey1'], c=pm.Callback(adb.resetSkin)) pm.button(label="Replace Lattice", backgroundColor=colordic['grey1'], c=pm.Callback( adb.find_and_replace_lattices)) pm.button(label="Blend Two Groups", backgroundColor=colordic['grey1'], c=pm.Callback(self._blend2grps)) pm.button(label="Wrap", backgroundColor=colordic['grey1'], c=pm.Callback(self._wrap)) pm.button(label="Wrap SetUp", backgroundColor=colordic['grey1'], c=pm.Callback(self._wrapSetup)) with pm.frameLayout(cll=True, bgc=(0.202, 0.202, 0.202), labelVisible=True, cl=False, label="CONTROLS"): with pm.columnLayout(adj=True, rs=4): pm.button(label="Get Curve Information", backgroundColor=colordic['grey1'], c=pm.Callback(adb.GetCurveShape)) pm.button(label="Combine Shapes", backgroundColor=colordic['grey1'], c=lambda *agrs: adb.CombineShape( oNurbs=pm.selected())) pm.button(label="Replace Shape", backgroundColor=colordic['grey1'], c=pm.Callback(self._ReplaceShape))
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 ui(self): template = pm.uiTemplate('ExampleTemplate', force=True) template.define(pm.button, w=60, height=25) template.define(pm.frameLayout, borderVisible=False, labelVisible=False) if pm.window(self.object, q=1, ex=1): pm.deleteUI(self.object) with pm.window(self.object, t=self.name, s=True, tlb=False, mnb=True) as win: with template: with pm.columnLayout(adj=True, rs=1): pm.text('MESH') with pm.rowLayout(adj=True, numberOfColumns=4): pm.separator(w=2, vis=0) self.symetry_status = pm.iconTextButton( h=20, w=20, i=ICONS_FOLDER + 'red_status') pm.button(label="Load Symetry Data", w=200, backgroundColor=colordic['grey1'], c=pm.Callback(self.load_symetry_data)) with pm.columnLayout(adj=True, rs=4): self.targetGeoInput = pm.textField(pht='Target Geo', w=60, ed=0, bgc=(0.15, 0.15, 0.15), tx=str(self.edge)) pm.popupMenu() pm.menuItem(l='Select Mesh', c=pm.Callback(self.selectTargetMesh)) pm.menuItem(l='Clear', c=pm.Callback(self.clearAB, 'target')) with pm.frameLayout(cll=True, bgc=(0.15, 0.15, 0.15), labelVisible=True, cl=True, label=" BLENDSHAPE"): with pm.columnLayout(adj=True, rs=4): pm.button(label="Delete History", backgroundColor=colordic['grey1'], c=mc.DeleteHistory) pm.button(label="Add BlendShape", w=110, backgroundColor=colordic['grey1'], c=pm.Callback(self.addBlendshapeAB)) with pm.rowLayout(adj=True, numberOfColumns=4): pm.iconTextButton(h=20, w=20, i='refresh', c=pm.Callback( self.refreshBlsMenu)) self.bls_node = pm.optionMenu('bls_node', w=130) all_bls = self.getAllBLS() if all_bls != []: for node in all_bls: pm.menuItem( label="{}".format(node.bs_node)) else: pm.menuItem(label='None') pm.separator(w=2) pm.button(label="Add Target", backgroundColor=colordic['grey1'], c=pm.Callback(self.addTargetAB)) with pm.columnLayout(adj=True, rs=4): pm.button(label="Mirror Blendshape Map", backgroundColor=colordic['green3'], c=pm.Callback( self.mirrorBlsWeightsMapAB)) with pm.frameLayout(cll=True, bgc=[0.15, 0.15, 0.15], labelVisible=True, cl=False, label=" RESET"): with pm.rowLayout(adj=True, numberOfColumns=2): self.baseGeoInput = pm.textField( pht='Base Geo', w=50, ed=0, bgc=(0.15, 0.15, 0.15), tx=str(self.baseGeo)) pm.popupMenu() pm.menuItem(l='Select Mesh', c=pm.Callback(self.selectBaseMesh)) pm.menuItem(l='Clear', c=pm.Callback(self.clearAB, 'base')) pm.button('<<<', w=40, c=pm.Callback(self.addBaseGeo)) with pm.rowLayout(numberOfColumns=4): pm.text(' RESET : ') self.inputXchbx = pm.checkBox(l='X', w=40, v=1) self.inputYchbx = pm.checkBox(l='Y', w=40, v=1) self.inputZchbx = pm.checkBox(l='Z', w=40, v=1) with pm.rowLayout(numberOfColumns=4): pm.separator(w=25, vis=0) pm.radioCollection() pm.separator(vis=0, w=30) self.posInput = pm.radioButton( label="Pos", sl=0, ) self.negInput = pm.radioButton(label="Neg", sl=1, w=80) with pm.columnLayout(adj=True, rs=4): self.percentageSlider = pm.intSliderGrp( field=True, minValue=1, maxValue=100, fieldMinValue=0, fieldMaxValue=100, value=100, cw2=(40, 100), ann="percentage of modification on your mesh") pm.popupMenu() pm.menuItem( l='20', c=lambda *args: pm.intSliderGrp( self.percentageSlider, e=1, value=20)) pm.menuItem( l='50', c=lambda *args: pm.intSliderGrp( self.percentageSlider, e=1, value=50)) pm.menuItem( l='75', c=lambda *args: pm.intSliderGrp( self.percentageSlider, e=1, value=75)) pm.button('Reset Mesh', w=40, backgroundColor=colordic['green3'], c=pm.Callback(self.resetMeshAB)) with pm.frameLayout(cll=True, bgc=[0.15, 0.15, 0.15], labelVisible=True, cl=False, label=" SELECTION"): with pm.rowLayout(adj=True, numberOfColumns=3): pm.button( label="Invert", backgroundColor=colordic['grey1'], w=110, c=lambda *args: mel.eval('InvertSelection')) pm.button(label="Match", backgroundColor=colordic['grey1'], w=110, c=pm.Callback(self.MatchSelection)) with pm.rowLayout(adj=True, numberOfColumns=4): pm.button(label="R", backgroundColor=colordic['grey1'], w=70, c=pm.Callback(self.select_right_edge)) pm.button(label="C", backgroundColor=colordic['grey1'], w=70, c=pm.Callback(self.select_center_edge)) pm.button(label="L", backgroundColor=colordic['grey1'], w=70, c=pm.Callback(self.select_left_edge)) with pm.rowLayout(adj=True, numberOfColumns=2): pm.button(label="Mirror Selection", backgroundColor=colordic['grey1'], c=pm.Callback(self.selectMirrorVtxAB)) with pm.frameLayout(cll=True, bgc=[0.15, 0.15, 0.15], labelVisible=True, cl=False, label=" MODIFY"): pm.text('MIRRORING', h=20) with pm.rowLayout(adj=True, numberOfColumns=3): pm.radioCollection() self.leftInput = pm.radioButton( label="Left > Right", sl=1) self.rightInput = pm.radioButton( label="Right > Left", sl=0) with pm.columnLayout(adj=True, rs=4): pm.button(label="Mirror Position", backgroundColor=colordic['grey1'], c=pm.Callback(self.mirrorAB)) pm.button(label="Flip", backgroundColor=colordic['grey1'], c=pm.Callback(self.flipMeshAB)) pm.separator(h=10) self.outputWin = pm.textScrollList(h=20, w=200)
def _showUI(self, parent=None): self._uiName = 'CreateControlUI' self._windowSize = (260, 10) if pm.window(self._uiName + 'Window', ex=True): pm.deleteUI(self._uiName + 'Window', window=True) pm.windowPref(self._uiName + 'Window', remove=True) if parent is not None and isinstance(parent, pm.uitypes.Window): self._window = parent else: self._window = pm.window(self._uiName + 'Window', title=self._uiName, rtf=True, widthHeight=self._windowSize) self._uiTemplate = pm.uiTemplate('CreateControlUITemplace', force=True) self._uiTemplate.define(pm.button, width=5, height=40, align='left', bgc=[0.15, 0.25, 0.35]) self._uiTemplate.define(pm.columnLayout, adjustableColumn=1, w=10) self._uiTemplate.define(pm.frameLayout, borderVisible=False, labelVisible=True, mh=2, mw=2, width=self._windowSize[0], bgc=[0.2, 0.2, 0.2]) self._uiTemplate.define(pm.rowColumnLayout, rs=[ (1, 5), ], adj=True, numberOfColumns=2, cal=[ (1, 'left'), ], columnWidth=[(1, 100), (2, 100)]) with self._window: with self._uiTemplate: with pm.frameLayout(label='Create Control'): with pm.columnLayout(): with pm.rowColumnLayout(): self._uiElement['ctlName'] = pm.textFieldGrp( cl2=('left', 'right'), co2=(0, 0), cw2=(40, 100), label='Name:', text=self.name, cc=self._getUIValue) self._uiElement['ctlType'] = pm.optionMenu( label='Type:', cc=self._getUIValue) with self._uiElement['ctlType']: for ct in self._controlType: pm.menuItem(label=ct) with pm.rowColumnLayout(numberOfColumns=3, columnWidth=[ (1, 10), ]): self._uiElement['ctlLength'] = pm.floatFieldGrp( cl2=('left', 'right'), co2=(0, 0), cw2=(40, 30), numberOfFields=1, label='Length:', value1=3.0, cc=self._getUIValue) self._uiElement['ctlRadius'] = pm.floatFieldGrp( cl2=('left', 'right'), co2=(0, 0), cw2=(40, 30), numberOfFields=1, label='Radius:', value1=0.5, cc=self._getUIValue) self._uiElement['ctlRes'] = pm.optionMenu( label='Step:', cc=self._getUIValue) with self._uiElement['ctlRes']: for ct in self._resolutions: pm.menuItem(label=ct) with pm.rowColumnLayout(): self._uiElement['ctlColor'] = pm.colorSliderGrp( label='Color:', rgb=(0, 0, 1), co3=(0, 0, 0), cw3=(30, 60, 60), cl3=('left', 'center', 'right'), cc=self._getUIValue) self._uiElement['ctlAxis'] = pm.optionMenu( label='Axis:', cc=self._getUIValue) with self._uiElement['ctlAxis']: for ct in self._axisList: pm.menuItem(label=ct) self._uiElement['ctlOffset'] = pm.floatFieldGrp( cl4=('left', 'center', 'center', 'center'), co4=(0, 5, 0, 0), cw4=(45, 50, 50, 50), numberOfFields=3, label='Offset:', cc=self._getUIValue) self._uiElement['ctlOption'] = pm.checkBoxGrp( cl5=('left', 'center', 'center', 'center', 'center'), co5=(0, 5, 0, 0, 0), cw5=(45, 50, 50, 50, 50), numberOfCheckBoxes=4, label='Options:', labelArray4=[ 'group', 'setAxis', 'sphere', 'mirror' ], cc=self._getUIValue) pm.button(label='Create', c=pm.Callback(self.createControl)) pm.button(label='Change Current Select', c=lambda x: ul.do_function_on() (self.changeControlShape)(sl=True)) pm.button(label='Set Color Select', c=lambda x: ul.do_function_on() (self.setColor)(sl=True)) self._getUIValue() self.reset_window_height()