def gen_button(self, *args): if self.col != None: cmds.deleteUI(self.col) self.col = cmds.columnLayout(co=['both', 5], parent=self.dyna) # Loop through given objects. for obj in self.objs: cmds.nodeIconButton( p=self.col, w=self.width - 40, style='iconAndTextHorizontal', image1='cone.png', label=obj, c=pm.Callback(self.select_obj, obj) )
def loadB(self, *a): for x in self.ctrl: if cmds.nodeIconButton(x[1], exists=1): cmds.deleteUI(x[1], control=1) if cmds.button(x[1], exists=1): cmds.deleteUI(x[1], control=1) if cmds.floatSliderGrp(x[1], exists=1): cmds.deleteUI(x[1], control=1) for x in self.facial: if cmds.nodeIconButton(x[1], exists=1): cmds.deleteUI(x[1], control=1) if cmds.button(x[1], exists=1): cmds.deleteUI(x[1], control=1) if cmds.floatSliderGrp(x[1], exists=1): cmds.deleteUI(x[1], control=1) for x in self.tail: if cmds.nodeIconButton(x[1], exists=1): cmds.deleteUI(x[1], control=1) if cmds.button(x[1], exists=1): cmds.deleteUI(x[1], control=1) if cmds.floatSliderGrp(x[1], exists=1): cmds.deleteUI(x[1], control=1) if cmds.optionMenu('oMenu', q=1, numberOfItems=1) > 0: if cmds.optionMenu('pMenu', q=1, value=1) == 'body': #self.bodyButton() self.generateButton(self.ctrl) if cmds.optionMenu('pMenu', q=1, value=1) == 'face': self.generateButton(self.facial) if cmds.optionMenu('pMenu', q=1, value=1) == 'tail': self.generateButton(self.tail)
def button(l='Button', i='circle.png', c=None, bgc=[], *args): b = cmds.nodeIconButton(label=l, style='iconAndTextHorizontal', h=40, image1=i, nbg=False) if bgc: cmds.nodeIconButton(b, e=True, bgc=bgc) if c: cmds.nodeIconButton(b, e=True, c=c) return b
def OCT_DownloadProxyUI(): proxyType = [] proxyType = os.listdir(OCT_PROXYPATH) if mc.window("OCT_ProxySeed", q=True, exists=True): mc.deleteUI("OCT_ProxySeed") mc.window("OCT_ProxySeed", title=u"代理库工具", widthHeight=(490, 730), sizeable=False) form = mc.formLayout() tabs = mc.tabLayout("tabs") mc.formLayout(form, edit=True, attachForm=((tabs, 'top', 0), (tabs, 'left', 0), (tabs, 'bottom', 0), (tabs, 'right', 0))) if proxyType: for proxy in proxyType: mc.scrollLayout(proxy, p=tabs) mc.rowColumnLayout(proxy, numberOfColumns=3) PathType = OCT_PROXYPATH + "\\" + proxy path = os.listdir(PathType) if path: for j in range(len(path)): iconFile = PathType + "\\" + path[j] + "\\images\\" + path[ j] + ".bmp" mc.nodeIconButton( path[j], style='iconAndTextVertical', numberOfPopupMenus=True, image=iconFile, label=path[j], h=130, w=160, p=proxy, c='OCT_proxy.OCT_DownloadProxy.Opendir(%d)' % j) mc.popupMenu(path[j], parent=path[j], b=3) mc.menuItem(l=u"打开maya原文件", c='OCT_proxy.OCT_DownloadProxy.OpenMaya(%d)' % j, parent=path[j]) mc.menuItem( l=u"打开maya_Vray原文件", c='OCT_proxy.OCT_DownloadProxy.OpenMayaVray(%d)' % j, parent=path[j]) mc.menuItem( l=u"打开maya_Arnold原文件", c='OCT_proxy.OCT_DownloadProxy.OpenMayaArnold(%d)' % j, parent=path[j]) mc.menuItem( l=u"导入Vray代理文件", c='OCT_proxy.OCT_DownloadProxy.ImportVray(%d)' % j, parent=path[j]) mc.menuItem( l=u"导入Arnold代理文件", c='OCT_proxy.OCT_DownloadProxy.importArnold(%d)' % j, parent=path[j]) mc.setParent("..") mc.setParent("..") mc.showWindow("OCT_ProxySeed")
def gen_button(self, *args): if self.col != None: cmds.deleteUI(self.col) self.col = cmds.columnLayout(w=self.width-10) self.rowCol = [] for obj in self.objs: new_rowCol = cmds.rowColumnLayout(nc=2, cw=[150, 10], cs=[2,10]) cmds.nodeIconButton(w=300, style='iconAndTextHorizontal', image1='cone.png', label=obj, c=pm.Callback(self.select_obj, obj) ) cmds.checkBox(l=' ', w=10, onc=pm.Callback(self.remove_object, obj)) cmds.setParent(self.col) self.rowCol.append(new_rowCol)
def gen_button(self, *args): self.rowCol = [] self.objsList = [] self.col = cmds.columnLayout(w=self.width-10, p=self.dyna) col = cmds.columnLayout() for obj in self.objs: new_rowCol = cmds.rowColumnLayout(nc=2, cw=[150, 10], cs=[2,10]) cmds.nodeIconButton(w=300, style='iconAndTextHorizontal', image1='cone.png', label=obj, c=pm.Callback(self.select_obj, obj) ) cmds.checkBox(l=' ', w=10, onc=pm.Callback(self.remove_object, obj)) cmds.setParent(col) self.rowCol.append(new_rowCol) self.objsList.append(obj) cmds.button(l='Reload', c=self.reload_button, p=self.col)
def gen_button(self, *args): # Generates clickable buttons for each invalid object found during testing self.rowCol = [] self.objsList = [] self.col = cmds.columnLayout(w=self.width-10, p=self.dyna) col = cmds.columnLayout() for obj in self.objs: new_rowCol = cmds.rowColumnLayout(nc=2, cw=[150, 10], cs=[2,10]) cmds.nodeIconButton(w=300, style='iconAndTextHorizontal', image1='cone.png', label=obj, c=pm.Callback(self.select_obj, obj) ) cmds.checkBox(l=' ', w=10, onc=pm.Callback(self.remove_object, obj)) cmds.setParent(col) self.rowCol.append(new_rowCol) self.objsList.append(obj) cmds.columnLayout(co=['left', 50]) cmds.button(l='Reload', w=75, c=self.reload_button)
def iconButton_UI(self, fileName, filePath, iconPath): iconBName = '%s_iconB' %fileName popName = '%s_pop' %fileName icon_B = mc.nodeIconButton(iconBName, style = 'iconAndTextVertical', numberOfPopupMenus = True, ann = fileName, image1 = iconPath, label = fileName, h = 135, w = 135, p = 'lightRow') pop_M = mc.popupMenu(popName, parent = icon_B, b = 3 ) mc.menuItem(l = u'新建灯光', parent = pop_M, c=lambda *arg:self.createArnoldLight(filePath)) mc.menuItem(l = u'赋予选择灯光', parent = pop_M, c=lambda *arg:self.changeArnoldLight(filePath))
def gen_button(self, *args): if self.col != None: cmds.deleteUI(self.col) self.col = cmds.columnLayout(w=self.width - 10) self.rowCol = [] for obj in self.objs: new_rowCol = cmds.rowColumnLayout(nc=2, cw=[150, 10], cs=[2, 10]) cmds.nodeIconButton(w=300, style='iconAndTextHorizontal', image1='cone.png', label=obj, c=pm.Callback(self.select_obj, obj)) cmds.checkBox(l=' ', w=10, onc=pm.Callback(self.remove_object, obj)) cmds.setParent(self.col) self.rowCol.append(new_rowCol)
def refreshControls(self): if cmds.columnLayout(self.column, exists=True): cmds.setParent(self.column) for rowChild in cmds.columnLayout(self.column, query=True, childArray=True) or []: row = self.column+"|"+rowChild cmds.deleteUI(rowChild) for element in self.listElements: elementName = element[1] cmds.rowLayout(numberOfColumns=6, adjustableColumn=2, columnWidth6=[50, 160, 160, 180, 180, 110], columnAttach=[(1, 'both', 5), (2, 'both', 5), (3, 'both', 5), (4, 'both', 5), (5, 'both', 5), (6, 'both', -5)] ) selectCommand='import maya.cmds as cmds\ncmds.select(\''+elementName+'\')' cmds.nodeIconButton( style='iconOnly', command=selectCommand, image1=element[0]+'.png' ) cmds.text(label=elementName, align='left') cmds.attrColorSliderGrp(label='C:', at=elementName+'.color', columnWidth4=[15,30,70,40], columnAlign=[1,"center"]) if element[0] == 'MeshLightShelf': cmds.attrFieldSliderGrp(label='I:', at=elementName+'.intensity', columnWidth2=[15,45], columnAlign=[1,"center"]) cmds.attrFieldSliderGrp(label='E:', at=elementName+'.aiExposure', columnWidth3=[15,45,70], columnAlign=[1,"center"]) else: cmds.attrFieldSliderGrp(label='I:', at=elementName+'.intensity', columnWidth4=[15,45,70,40], columnAlign=[1,"center"]) cmds.attrFieldSliderGrp(label='E:', at=elementName+'.aiExposure', columnWidth4=[15,45,70,40], columnAlign=[1,"center"]) cmds.rowLayout(numberOfColumns=2, columnWidth2=[60, 50], columnAttach=[(1, 'both', 0), (2, 'both', 5)] ) cmds.intFieldGrp('lightManager_samples_'+elementName, label='S:', columnWidth2=[20,30], columnAlign2=['center','center']) cmds.connectControl('lightManager_samples_'+elementName, elementName+'.aiSamples', index=1) cmds.connectControl('lightManager_samples_'+elementName, elementName+'.aiSamples', index=2) cmds.checkBoxGrp('lightManager_visibility_'+elementName, label="E:", columnWidth2=[18,22]) try: cmds.connectControl('lightManager_visibility_'+elementName, elementName+'.visibility', index=1) cmds.connectControl('lightManager_visibility_'+elementName, elementName+'.visibility', index=2) except: pass cmds.setParent('..') cmds.setParent('..')
def gen_button(self, *args): # Generates clickable buttons for each invalid object found during testing self.rowCol = [] self.objsList = [] self.col = cmds.columnLayout(w=self.width - 10, p=self.dyna) col = cmds.columnLayout() for obj in self.objs: new_rowCol = cmds.rowColumnLayout(nc=2, cw=[150, 10], cs=[2, 10]) cmds.nodeIconButton(w=300, style='iconAndTextHorizontal', image1='cone.png', label=obj, c=pm.Callback(self.select_obj, obj)) cmds.checkBox(l=' ', w=10, onc=pm.Callback(self.remove_object, obj)) cmds.setParent(col) self.rowCol.append(new_rowCol) self.objsList.append(obj) cmds.columnLayout(co=['left', 50]) cmds.button(l='Reload', w=75, c=self.reload_button)
def iconButton_UI(self, types, pathName, iconName, dirname): tabsName = mc.tabLayout("tabs", q=True, selectTab=True) dIconName = '%s(%s).jpg' % (types, iconName) dIconPath = os.path.join(OCT_ImagePath, dirname, dIconName) mc.nodeIconButton( types, style='iconAndTextVertical', numberOfPopupMenus=True, ann=pathName, image1=r"%s\%s\%s.jpg" % (OCT_ImagePath, dirname, types), label=iconName, h=135, w=135, p='%sRow' % tabsName, c=lambda *arg: self.AttrCassIfication(types, dIconPath, 0)) mc.popupMenu(types, parent=types, b=3) mc.menuItem(l=u'创建', c=lambda *arg: self.AttrCassIfication(types, dIconPath, 1), parent=types) mc.menuItem(l=u'设置', c=lambda *arg: self.AttrCassIfication(types, dIconPath, 2), parent=types)
def nodeIconButton(*args, **kwargs): if len(args): doPassSelf = kwargs.pop('passSelf', False) else: doPassSelf = False for key in [ 'c', 'command', 'dgc', 'dpc', 'dragCallback', 'dropCallback', 'vcc', 'visibleChangeCommand' ]: try: cb = kwargs[key] if callable(cb): kwargs[key] = _factories.makeUICallback(cb, args, doPassSelf) except KeyError: pass res = cmds.nodeIconButton(*args, **kwargs) return res
def createUI(self): cmds.scrollLayout(childResizable=True, minChildWidth=800) cmds.columnLayout(adjustableColumn=True, columnAlign="right", rowSpacing=10) cmds.rowLayout(numberOfColumns=9, columnAttach=[(1, 'both', 10), (2, 'both', 5), (3, 'both', 5), (4, 'both', 5), (5, 'both', 5), (6, 'both', 5), (7, 'both', 5), (8, 'both', 5), (9, 'both', 5)] ) cmds.text(label='Create Light:') selectCommand='import maya.cmds as cmds\ncmds.select(\''+'directionalLightShape1'+'\')' cmds.nodeIconButton( style='iconOnly', command=lambda *args: cmds.CreateDirectionalLight(), image1='directionallight.png' ) cmds.nodeIconButton( style='iconOnly', command=lambda *args: cmds.CreatePointLight(), image1='pointlight.png' ) cmds.nodeIconButton( style='iconOnly', command=lambda *args: cmds.CreateSpotLight(), image1='spotlight.png' ) cmds.nodeIconButton( style='iconOnly', command=lambda *args: cmds.CreateAreaLight(), image1='arealight.png' ) cmds.nodeIconButton( style='iconOnly', command=lambda *args: mutils.createLocator('aiAreaLight', asLight=True), image1='AreaLightShelf.png' ) cmds.nodeIconButton( style='iconOnly', command=lambda *args: mutils.createLocator('aiSkyDomeLight', asLight=True), image1='SkydomeLightShelf.png' ) cmds.nodeIconButton( style='iconOnly', command=lambda *args: mutils.createLocator('aiPhotometricLight', asLight=True), image1='PhotometricLightShelf.png' ) cmds.nodeIconButton( style='iconOnly', command=lambda *args: self.doCreateMeshLight(), image1='MeshLightShelf.png' ) cmds.setParent('..') cmds.separator() cmds.setParent('..') cmds.columnLayout(adjustableColumn=True, columnAlign="right", rowSpacing=10) cmds.rowLayout(numberOfColumns=6, adjustableColumn=2, columnWidth6=[50, 160, 160, 180, 180, 110], columnAttach=[(1, 'both', 5), (2, 'both', 5), (3, 'both', 5), (4, 'both', 5), (5, 'both', 5), (6, 'both', -5)] ) cmds.text(label='Select') cmds.text(label='Light Name') cmds.text(label='Color') cmds.text(label='Intensity') cmds.text(label='Exposure') cmds.rowLayout(numberOfColumns=2, columnWidth2=[60, 50], columnAttach=[(1, 'both', 0), (2, 'both', 5)] ) cmds.text(label='Samples') cmds.text(label='Enable') cmds.setParent('..') cmds.setParent('..') cmds.separator() cmds.setParent('..') self.column = cmds.columnLayout(adjustableColumn=True, columnAlign="right", rowSpacing=10) self.refreshControls() '''for element in self.listElements:
def createshader(self): mc.nodeIconButton( style='iconAndTextHorizontal', command="""maya.mel.eval("ArtPaintSkinWeightsTool();")""", image1='paintSkinWeights.png', label='PaintWeights', h=50, w=50) mc.nodeIconButton(style='iconAndTextHorizontal', command="""maya.mel.eval("HypershadeWindow();")""", image1='menuIconWindow.png', label='Hypershade', h=100, w=50) mc.rowLayout(nc=3) lastshader = '' lastshadersg = '' mc.nodeIconButton(style='iconAndTextHorizontal', command=self.blinn, image1='blinn.svg', label='blinn', h=50, w=90, ann='create a blinn shader.') mc.nodeIconButton(style='iconAndTextHorizontal', command=self.lambert, image1='lambert.svg', label='lambert', h=50, w=90, ann='create a lambert shader.') mc.nodeIconButton(style='iconAndTextHorizontal', command=self.phong, image1='phong.svg', label='phong', h=50, w=90, ann='create a phong shader.') mc.setParent('..') mc.nodeIconButton(style='iconAndTextHorizontal', command=self.showeditor, image1='menuIconWindow.png', label='last shader editwindow', h=50, w=90, ann='show edit window of last created shader') mc.nodeIconButton(style='iconAndTextHorizontal', command=self.assignshader, image1='aselect.png', label='assign last shader', h=50, w=90, ann='assign last created shader to selection.') mc.nodeIconButton(style='iconAndTextHorizontal', command=self.changecolor, image1='colorPresetSpectrum.png', label='chage last shader color', h=50, w=90, ann='change color last created shader.') mc.rowLayout(nc=3) mc.nodeIconButton( style='iconAndTextHorizontal', command="""maya.mel.eval("RenderIntoNewWindow();")""", image1='render.png', label='1Frame', h=90, w=90, ann='render this frame.') mc.nodeIconButton( style='iconAndTextHorizontal', command="""maya.mel.eval("unifiedRenderGlobalsWindow();")""", image1='renderGlobals.png', label='setting', h=90, w=90, ann='render setting window.') mc.nodeIconButton(style='iconAndTextHorizontal', command="""maya.mel.eval("BatchRender();")""", image1='menuIconRender.png', label='Batch', h=90, w=90, ann='BatchRender.') mc.setParent('..')
def layout(self): ma.frameLayout(lv=0, mw=6, mh=6) ma.rowColumnLayout(nc=1) ma.text('text01', l=info) ma.frameLayout(lv=0, mw=6, mh=6) ma.rowColumnLayout(nc=3) ma.textField("textFieldInput_attribute", w=self.size[0] / 2.0, tx=cycleAttributeDefaultName) ma.text(' ') #space ma.text(' cycle attribute name ') #space ma.setParent('..') ma.rowColumnLayout(nc=3) ma.textField("textFieldInput_curvePath", w=self.size[0] / 2.0, tx="curve path") ma.text(' ') #space ma.nodeIconButton('button_curvePath"', l=self.button_label1, w=self.buttonSize[0], h=self.buttonSize[1], fn='boldLabelFont', st='textOnly', c=lambda x=None: self.setCurvePath()) ma.setParent('..') ma.rowColumnLayout(nc=3) ma.textField("textFieldInput_upObject", w=self.size[0] / 2.0, tx="up object") ma.text(' ') #space ma.nodeIconButton('button_upObject', l=self.button_label2, w=self.buttonSize[0], h=self.buttonSize[1], fn='boldLabelFont', st='textOnly', c=lambda x=None: self.setUpObject()) ma.setParent('..') ma.rowColumnLayout(nc=3) ma.radioButtonGrp('radioButtonGrp_curvePath', l='Front axis: ', la3=axis, nrb=3, cw4=[ self.size[0] / 3, self.size[0] / 12, self.size[0] / 12, self.size[0] / 3 ], sl=3) ma.text(' ') #space ma.checkBox('checkBox_curvePath', l='Inverse ', v=0) ma.radioButtonGrp('radioButtonGrp_upObject', l='Up axis: ', la3=axis, nrb=3, cw4=[ self.size[0] / 3, self.size[0] / 12, self.size[0] / 12, self.size[0] / 3 ], sl=2) ma.text(' ') #space ma.checkBox('checkBox_upObject', l='Inverse ', v=0) ma.setParent('..') ma.frameLayout(lv=0, mw=6, mh=6) ma.rowColumnLayout(nc=1) ma.text('text02', l=usage) ma.nodeIconButton('button03', l=self.button_label3, w=self.size[0] / 1.75, h=self.buttonSize[1], fn='boldLabelFont', st='textOnly', c=lambda x=None: self.command()) ma.setParent('..')
def primitiveMenu(self): if cmds.window('primitives', exists=True): cmds.deleteUI('primitives', window=True ) else: cmds.window('primitives', sizeable = 0, t='' ) cmds.rowColumnLayout( numberOfColumns=3, columnWidth=[(1, 40), (2, 40), (3, 40)] ) cmds.nodeIconButton( style='iconOnly', command= partial(self.primitiveActions, 'CreatePolyCubeCtx', 'cmds.polyCube()') , image1='polyCube.png' ) cmds.nodeIconButton( style='iconOnly', command= partial(self.primitiveActions, 'CreatePolySphereCtx', 'cmds.polySphere()'), image1='polySphere.png' ) cmds.nodeIconButton( style='iconOnly', command= partial(self.primitiveActions, 'CreatePolyCylinderCtx', 'cmds.polyCylinder()'), image1='polyCylinder.png' ) cmds.nodeIconButton( style='iconOnly', command= partial(self.primitiveActions, 'CreatePolyTorusCtx', 'cmds.polyTorus()'), image1='polyTorus.png' ) cmds.nodeIconButton( style='iconOnly', command= partial(self.primitiveActions,'CreatePolyConeCtx', 'cmds.polyCone()'), image1='polyCone.png' ) cmds.nodeIconButton( style='iconOnly', command= partial(self.primitiveActions,'CreatePolyPyramidCtx','cmds.polyPyramid()'), image1='polyPyramid.png' ) cmds.nodeIconButton( style='iconOnly', command= partial(self.primitiveActions, 'CreatePolyPipeCtx', 'cmds.polyPipe()'), image1='polyPipe.png' ) cmds.nodeIconButton( style='iconOnly', command= partial(self.primitiveActions, 'CreatePolyPlaneCtx', 'cmds.polyPlane()'), image1='polyMesh.png') cmds.nodeIconButton( style='iconOnly', command= partial(self.primitiveActions, 'cmds.EPCurveTool()', 'cmds.warning("Create your own curve drop automatically")' ), image1='curveEP.png' ) cmds.nodeIconButton( style='iconOnly', command= partial(self.primitiveActions, 'cmds.JointTool()', 'self.jointTool()' ), image1='kinJoint.png' ) cmds.nodeIconButton( style='iconOnly', command= partial(self.primitiveActions, 'cmds.SculptGeometryTool()', 'cmds.SculptGeometryTool()'), image1='brush.png' ) cmds.showWindow( 'primitives' )
def primitiveMenu(self): if cmds.window('primitives', exists=True): cmds.deleteUI('primitives', window=True) else: cmds.window('primitives', sizeable=0, t='') cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 40), (2, 40), (3, 40)]) cmds.nodeIconButton(style='iconOnly', command=partial(self.primitiveActions, 'CreatePolyCubeCtx', 'cmds.polyCube()'), image1='polyCube.png') cmds.nodeIconButton(style='iconOnly', command=partial(self.primitiveActions, 'CreatePolySphereCtx', 'cmds.polySphere()'), image1='polySphere.png') cmds.nodeIconButton(style='iconOnly', command=partial(self.primitiveActions, 'CreatePolyCylinderCtx', 'cmds.polyCylinder()'), image1='polyCylinder.png') cmds.nodeIconButton(style='iconOnly', command=partial(self.primitiveActions, 'CreatePolyTorusCtx', 'cmds.polyTorus()'), image1='polyTorus.png') cmds.nodeIconButton(style='iconOnly', command=partial(self.primitiveActions, 'CreatePolyConeCtx', 'cmds.polyCone()'), image1='polyCone.png') cmds.nodeIconButton(style='iconOnly', command=partial(self.primitiveActions, 'CreatePolyPyramidCtx', 'cmds.polyPyramid()'), image1='polyPyramid.png') cmds.nodeIconButton(style='iconOnly', command=partial(self.primitiveActions, 'CreatePolyPipeCtx', 'cmds.polyPipe()'), image1='polyPipe.png') cmds.nodeIconButton(style='iconOnly', command=partial(self.primitiveActions, 'CreatePolyPlaneCtx', 'cmds.polyPlane()'), image1='polyMesh.png') cmds.nodeIconButton( style='iconOnly', command=partial( self.primitiveActions, 'cmds.EPCurveTool()', 'cmds.warning("Create your own curve drop automatically")' ), image1='curveEP.png') cmds.nodeIconButton(style='iconOnly', command=partial(self.primitiveActions, 'cmds.JointTool()', 'self.jointTool()'), image1='kinJoint.png') cmds.nodeIconButton(style='iconOnly', command=partial(self.primitiveActions, 'cmds.SculptGeometryTool()', 'cmds.SculptGeometryTool()'), image1='brush.png') cmds.showWindow('primitives')
def quickSelect(*args): currentValue = cmds.optionMenu(save_Slot, query=True, value=True) if '1' in currentValue: set1 = cmds.sets(name='SET1') if '2' in currentValue: set2 = cmds.sets(name='SET2') if '3' in currentValue: set3 = cmds.sets(name='SET3') cmds.window(width=325, height=100, title="Quick Poser Tim Kelly 13th Dec") cmds.columnLayout(adjustableColumn=True) cmds.nodeIconButton(style='iconAndTextHorizontal', label='Revert Rotate', align='left', command=setRotate, image1='sphere.xpm') cmds.nodeIconButton(style='iconAndTextHorizontal', label='Save Rotate', align='center', command=getRotate, image1='sphere.xpm') cmds.nodeIconButton(style='iconAndTextHorizontal', label='Revert Translate', align='left', command=setTrans, image1='cube.xpm') cmds.nodeIconButton(style='iconAndTextHorizontal', label='Save Translate', align='center',
def generateButton(self, btnList): ov = cmds.optionMenu('oMenu', q=1, value=1) if ov == 'root': ov = ':' for i in range(len(btnList)): s = 0.15 if btnList[i][7] == -1: s = 0 if btnList[i][0] == 'itbtn': if btnList[i][3] == 'sel': if cmds.objExists(ov + ':' + btnList[i][4]): cmds.nodeIconButton(btnList[i][1], label=btnList[i][2], width=btnList[i][5], height=btnList[i][6], backgroundColor=self.hsvRgb( btnList[i][7], s, 0.35), command=self.selCtrlCmd( btnList[i][4]), parent='form_warAnimMain', style='iconAndTextCentered') if btnList[i][0] == 'btn': if btnList[i][3] == 'sel': if cmds.objExists(ov + ':' + btnList[i][4]): cmds.button(btnList[i][1], label=btnList[i][2], width=btnList[i][5], height=btnList[i][6], backgroundColor=self.hsvRgb( btnList[i][7], s, 0.35), command=self.selCtrlCmd(btnList[i][4]), parent='form_warAnimMain') #cmds.nodeIconButton(btnList[i][1],label=btnList[i][2],width=btnList[i][5],height=btnList[i][6],backgroundColor=self.hsvRgb(btnList[i][7],s,0.35),command=self.selCtrlCmd(btnList[i][4]),parent='form_warAnimMain',style='iconAndTextCentered') cmds.popupMenu() if len(btnList[i][10]) > 0: cmds.menuItem(label='Select Set', command=self.selCtrlsCmd( btnList[i][10])) cmds.menuItem(label='Set Default', command=self.setDefCmd(btnList[i][4])) if btnList[i][11] != '': cmds.menuItem(label='Mirror Attribute', command=self.mirCtrlCmd( btnList[i][4], btnList[i][11])) if btnList[i][3] == 'sels': cmds.button(btnList[i][1], label=btnList[i][2], width=btnList[i][5], height=btnList[i][6], backgroundColor=self.hsvRgb( btnList[i][7], s, 0.35), command=self.selCtrlsCmd(btnList[i][4]), parent='form_warAnimMain') #cmds.nodeIconButton(btnList[i][1],label=btnList[i][2],width=btnList[i][5],height=btnList[i][6],backgroundColor=self.hsvRgb(btnList[i][7],s,0.35),command=self.selCtrlsCmd(btnList[i][4]),parent='form_warAnimMain',style='iconAndTextCentered') if btnList[i][3] == 'def': cmds.button(btnList[i][1], label=btnList[i][2], width=btnList[i][5], height=btnList[i][6], backgroundColor=self.hsvRgb( btnList[i][7], s, 0.35), command=self.setSelDef, parent='form_warAnimMain') #cmds.nodeIconButton(btnList[i][1],label=btnList[i][2],width=btnList[i][5],height=btnList[i][6],backgroundColor=self.hsvRgb(btnList[i][7],s,0.35),command=self.setSelDef,parent='form_warAnimMain',style='iconAndTextCentered') if btnList[i][0] == 'sld': if btnList[i][3] == 'FKIK': if cmds.objExists(ov + ':' + btnList[i][4]): cmds.floatSliderGrp(btnList[i][1], width=btnList[i][5], minValue=0.0, maxValue=1.0, changeCommand=self.sliderAttrCmd( btnList[i][1], btnList[i][4], 'FKIK'), parent='form_warAnimMain') for i in range(len(btnList)): if cmds.button(btnList[i][1], exists=1) or cmds.floatSliderGrp( btnList[i][1], exists=1) or cmds.nodeIconButton( btnList[i][1], exists=1): # if cmds.nodeIconButton(btnList[i][1],exists=1) or cmds.floatSliderGrp(btnList[i][1],exists=1) : for j in range(8, 10): if len(btnList[i][j]) == 3: cmds.formLayout('form_warAnimMain', e=1, af=btnList[i][j]) if len(btnList[i][j]) == 4: if type(btnList[i][j][3]) == type(0): cmds.formLayout('form_warAnimMain', e=1, ap=btnList[i][j]) if type(btnList[i][j][3]) == type(''): cmds.formLayout('form_warAnimMain', e=1, ac=btnList[i][j]) if type(btnList[i][j][3]) == type([]): aList = btnList[i][j][3] tList = btnList[i][j][:] for x in aList: if cmds.button(x, q=1, exists=1): tList[3] = x cmds.formLayout('form_warAnimMain', e=1, ac=tList) break ref = cmds.ls(type='reference') for x in ref: ns = cmds.referenceQuery(x, namespace=True) if ns == ov: fp = cmds.referenceQuery(x, filename=1) fp = fp.replace('.ma', '.jpg') fp = fp.replace('.mb', '.jpg') if cmds.file(fp, q=1, exists=1): cmds.nodeIconButton('btn_asset', e=1, image1=fp, label='')
def refreshControls(self): if cmds.columnLayout(self.column, exists=True): cmds.setParent(self.column) for rowChild in cmds.columnLayout( self.column, query=True, childArray=True) or []: row = self.column + "|" + rowChild cmds.deleteUI(rowChild) for element in self.listElements: elementName = element[1] cmds.rowLayout(numberOfColumns=6, adjustableColumn=2, columnWidth6=[50, 160, 160, 180, 180, 110], columnAttach=[(1, 'both', 5), (2, 'both', 5), (3, 'both', 5), (4, 'both', 5), (5, 'both', 5), (6, 'both', -5)]) selectCommand = 'import maya.cmds as cmds\ncmds.select(\'' + elementName + '\')' cmds.nodeIconButton(style='iconOnly', command=selectCommand, image1=element[0] + '.png') cmds.text(label=elementName, align='left') cmds.attrColorSliderGrp(label='C:', at=elementName + '.color', columnWidth4=[15, 30, 70, 40], columnAlign=[1, "center"]) if element[0] == 'MeshLightShelf': cmds.attrFieldSliderGrp(label='I:', at=elementName + '.intensity', columnWidth2=[15, 45], columnAlign=[1, "center"]) cmds.attrFieldSliderGrp(label='E:', at=elementName + '.aiExposure', columnWidth3=[15, 45, 70], columnAlign=[1, "center"]) else: cmds.attrFieldSliderGrp(label='I:', at=elementName + '.intensity', columnWidth4=[15, 45, 70, 40], columnAlign=[1, "center"]) cmds.attrFieldSliderGrp(label='E:', at=elementName + '.aiExposure', columnWidth4=[15, 45, 70, 40], columnAlign=[1, "center"]) cmds.rowLayout(numberOfColumns=2, columnWidth2=[60, 50], columnAttach=[(1, 'both', 0), (2, 'both', 5)]) cmds.intFieldGrp('lightManager_samples_' + elementName, label='S:', columnWidth2=[20, 30], columnAlign2=['center', 'center']) cmds.connectControl('lightManager_samples_' + elementName, elementName + '.aiSamples', index=1) cmds.connectControl('lightManager_samples_' + elementName, elementName + '.aiSamples', index=2) cmds.checkBoxGrp('lightManager_visibility_' + elementName, label="E:", columnWidth2=[18, 22]) try: cmds.connectControl('lightManager_visibility_' + elementName, elementName + '.visibility', index=1) cmds.connectControl('lightManager_visibility_' + elementName, elementName + '.visibility', index=2) except: pass cmds.setParent('..') cmds.setParent('..')
def createUI(self): cmds.scrollLayout(childResizable=True, minChildWidth=800) cmds.columnLayout(adjustableColumn=True, columnAlign="right", rowSpacing=10) cmds.rowLayout(numberOfColumns=9, columnAttach=[(1, 'both', 10), (2, 'both', 5), (3, 'both', 5), (4, 'both', 5), (5, 'both', 5), (6, 'both', 5), (7, 'both', 5), (8, 'both', 5), (9, 'both', 5)]) cmds.text(label='Create Light:') selectCommand = 'import maya.cmds as cmds\ncmds.select(\'' + 'directionalLightShape1' + '\')' cmds.nodeIconButton( style='iconOnly', command=lambda *args: cmds.CreateDirectionalLight(), image1='directionallight.png') cmds.nodeIconButton(style='iconOnly', command=lambda *args: cmds.CreatePointLight(), image1='pointlight.png') cmds.nodeIconButton(style='iconOnly', command=lambda *args: cmds.CreateSpotLight(), image1='spotlight.png') cmds.nodeIconButton(style='iconOnly', command=lambda *args: cmds.CreateAreaLight(), image1='arealight.png') cmds.nodeIconButton(style='iconOnly', command=lambda *args: mutils.createLocator( 'aiAreaLight', asLight=True), image1='AreaLightShelf.png') cmds.nodeIconButton(style='iconOnly', command=lambda *args: mutils.createLocator( 'aiSkyDomeLight', asLight=True), image1='SkydomeLightShelf.png') cmds.nodeIconButton(style='iconOnly', command=lambda *args: mutils.createLocator( 'aiPhotometricLight', asLight=True), image1='PhotometricLightShelf.png') cmds.nodeIconButton(style='iconOnly', command=lambda *args: self.doCreateMeshLight(), image1='MeshLightShelf.png') cmds.setParent('..') cmds.separator() cmds.setParent('..') cmds.columnLayout(adjustableColumn=True, columnAlign="right", rowSpacing=10) cmds.rowLayout(numberOfColumns=6, adjustableColumn=2, columnWidth6=[50, 160, 160, 180, 180, 110], columnAttach=[(1, 'both', 5), (2, 'both', 5), (3, 'both', 5), (4, 'both', 5), (5, 'both', 5), (6, 'both', -5)]) cmds.text(label='Select') cmds.text(label='Light Name') cmds.text(label='Color') cmds.text(label='Intensity') cmds.text(label='Exposure') cmds.rowLayout(numberOfColumns=2, columnWidth2=[60, 50], columnAttach=[(1, 'both', 0), (2, 'both', 5)]) cmds.text(label='Samples') cmds.text(label='Enable') cmds.setParent('..') cmds.setParent('..') cmds.separator() cmds.setParent('..') self.column = cmds.columnLayout(adjustableColumn=True, columnAlign="right", rowSpacing=10) self.refreshControls() '''for element in self.listElements: