def addScrollListColor(): tsList = scrollListItemsColor() cAdd = cmds.colorSliderButtonGrp(csbgColor, rgbValue=True, query=True) tsList.append('%s, %s, %s' % (cAdd[0], cAdd[1], cAdd[2])) cmds.textScrollList(tslColorList, edit=True, removeAll=True) cmds.textScrollList(tslColorList, append=tsList, edit=True) cmds.colorSliderButtonGrp(csbgColor, rgbValue=[1.0, 1.0, 1.0], edit=True)
def addScrollListColor(): tsList = scrollListItemsColor() cAdd = cmds.colorSliderButtonGrp(csbgColor, rgbValue = True, query = True) tsList.append('%s, %s, %s' %(cAdd[0], cAdd[1], cAdd[2])) cmds.textScrollList(tslColorList, edit = True, removeAll = True) cmds.textScrollList(tslColorList, append = tsList, edit = True) cmds.colorSliderButtonGrp(csbgColor, rgbValue = [1.0, 1.0, 1.0], edit = True)
def clrWind(*args): if (cmds.window(clrWinMRC, q=True, ex=True)): cmds.deleteUI(clrWinMRC) if(cmds.windowPref(clrWinMRC,q=True, ex=True)): cmds.windowPref(clrWinMRC, r=True) cmds.window(clrWinMRC, t="Color Picker", w=520, tlb=1) cmds.columnLayout("clrLayout") cmds.colorSliderButtonGrp("clrButton", label="Button Color", buttonLabel="Apply", bc=clrChanger, rgb=(1, 0, 0), columnWidth=(5, 30)) cmds.colorSliderButtonGrp("clrButton", q=True, rgb=True) cmds.showWindow(clrWinMRC)
def mhCreateRGBSlider(udColorIndex, parentLayout): rgbValue = cmds.displayRGBColor('userDefined%d' % udColorIndex, query=True) cmds.colorSliderButtonGrp( 'mhCustomColorButtonGrp%d' % udColorIndex, parent=parentLayout, label='userColor %d' % udColorIndex, buttonCommand='mhSetCustomColor(%d)' % udColorIndex, buttonLabel='assign', rgb=rgbValue, symbolButtonDisplay=False, changeCommand='mhUpdateCustomColor(%d)' % udColorIndex)
def mhUpdateUserColor(udColorIndex): rgbValue = cmds.colorSliderButtonGrp('mhCustomColorButtonGrp%d' % udColorIndex, query=True, rgb=True) cmds.displayRGBColor('userDefined%d' % udColorIndex, rgbValue[0], rgbValue[1], rgbValue[2])
def build(): if mc.window( 'CreatParticleWin', ex=1 ): mc.deleteUI( 'CreatParticleWin' ) if mc.windowPref( 'CreatParticleWin', ex=1 ): mc.windowPref( 'CreatParticleWin', remove=1 ) mc.window( 'CreatParticleWin', t=u'快速创建尾随粒子', wh=(350, 65), menuBar=True) mc.formLayout('myFormLayout', numberOfDivisions=100) #mc.columnLayout(columnAttach=('both', 5), adj=0) mc.button('creatButton', l=u'创建粒子', c=creatSphere) #mc.colorIndexSliderGrp( 'myColorIndex', label=u'拾取颜色', min=0, max=1, value=.5 ) mc.colorSliderButtonGrp( 'myColorIndex', label=u'粒子颜色', buttonLabel=u'确定', rgb=(1, 0, 0), symbolButtonDisplay=True, columnWidth=(5, 30)) mc.rowLayout( 'myRowLayout', w=250, numberOfColumns=4, columnWidth2=(10, 135 ), adjustableColumn=1, columnAlign=(1, 'right'), columnAttach=[(1, 'left', 30), (2, 'left', 0), (1, 'both', 0), (2, 'left', 0)] ) mc.text('numParticle', l=u'粒子数量') mc.intField('numText', w=55) mc.text('lifeParticle', l=u'粒子寿命') mc.floatField('lifeText', w=55) mc.setParent('..') mc.formLayout('myFormLayout', e=1, attachForm=[('creatButton', 'top', 5), ('creatButton', 'left', 5), ('myColorIndex', 'left', -90), ('myColorIndex', 'bottom', 5),('myColorIndex', 'right', 5), ('myRowLayout', 'top', 30) ], attachControl=[('creatButton', 'bottom', 5, 'myColorIndex'), ('myRowLayout', 'bottom', 15, 'myColorIndex'), ('myRowLayout', 'left', -25, 'creatButton')], attachPosition=[('creatButton', 'right', 5, 25), ('myRowLayout', 'left', 35, 10)],attachNone=('myRowLayout', 'top') ) #mc.setParent( '..' ) #mc.setParent( '..' ) mc.showWindow('CreatParticleWin')
def updateShaverAttr(isShave,attr): targetShave="" selectedOrAll=mc.radioButtonGrp("selectOrAll",q=True,sl=True) if selectedOrAll==1: targetShave=mc.ls(sl=True) else: targetShave=mc.ls(type="shaveHair") if isShave==1: updateAttrValue=mc.floatSliderButtonGrp(attr,q=True,v=True,pre=3) for Shave in targetShave: mc.setAttr("%s.%s"%(Shave,attr),updateAttrValue) elif isShave==2: updateAttrColor=mc.colorSliderButtonGrp(attr,q=True,rgb=True) for Shave in targetShave: mc.setAttr("%s.%s"%(Shave,attr),updateAttrColor[0],updateAttrColor[1],updateAttrColor[2]) #update_Shaver_Attr_UI()
def setAttributeColorUI(): global csbgColor, tslColorList, colorUI colorUI = 'colorUI' closeUI(colorUI) cmds.window(colorUI, title = 'colorUI') cmds.columnLayout(columnAttach = ['both', 5], rowSpacing = 5, columnWidth = 210) cmds.text('..: random color :..', backgroundColor = (0.15, 0.15, 0.0)) cmds.button('ok', command = 'setAttributeColorRandom()') cmds.separator(style = 'out') cmds.text('..: color list :..', backgroundColor = (0.0, 0.15, 0.15)) tslColorList = cmds.textScrollList(allowMultiSelection = True) cmds.button('remove', command = 'removeScrollListColor()') csbgColor = cmds.colorSliderButtonGrp(buttonLabel='add..', symbolButtonDisplay=True, image='navButtonUnconnected.png', columnWidth4 = [30, 100, 30, 50], buttonCommand = 'addScrollListColor()', symbolButtonCommand = 'addScrollListTex()') cmds.button('random', command = 'setAttributeListColorRandom()') cmds.button('increment %', command = 'setAttributeListColorInc()') cmds.setParent('..') cmds.showWindow()
def setAttributeColorUI(): global csbgColor, tslColorList, colorUI colorUI = 'colorUI' closeUI(colorUI) cmds.window(colorUI, title='colorUI') cmds.columnLayout(columnAttach=['both', 5], rowSpacing=5, columnWidth=210) cmds.text('..: random color :..', backgroundColor=(0.15, 0.15, 0.0)) cmds.button('ok', command='setAttributeColorRandom()') cmds.separator(style='out') cmds.text('..: color list :..', backgroundColor=(0.0, 0.15, 0.15)) tslColorList = cmds.textScrollList(allowMultiSelection=True) cmds.button('remove', command='removeScrollListColor()') csbgColor = cmds.colorSliderButtonGrp( buttonLabel='add..', symbolButtonDisplay=True, image='navButtonUnconnected.png', columnWidth4=[30, 100, 30, 50], buttonCommand='addScrollListColor()', symbolButtonCommand='addScrollListTex()') cmds.button('random', command='setAttributeListColorRandom()') cmds.button('increment %', command='setAttributeListColorInc()') cmds.setParent('..') cmds.showWindow()
def update_Shaver_Attr_UI(): if mc.window("update_Shaver_Attr_UI",ex=True): mc.deleteUI("update_Shaver_Attr_UI") mc.window("update_Shaver_Attr_UI",title=u"更新shaveHair的属性",tlc=[180,200],wh=[460,350]) mc.scrollLayout("A",hst=0,vst=8) mc.rowLayout("defaultRowLayout",numberOfColumns=1,adjustableColumn=1,columnAttach=([1,"both",0],[2,"both",0]),columnWidth2=[400,300]) mc.frameLayout(borderStyle="etchedIn",label="Shader Multi Editor") mc.columnLayout(adjustableColumn=True,rs=5,cal="left") mc.separator() mc.radioButtonGrp("selectOrAll",nrb=2,l="Target",labelArray2=['selected','All in Scene'],select=1,cw=([1,60],[2,70])) mc.separator() mc.floatSliderButtonGrp("rootThickness",pre=3,label=u"毛发根部大小(Root Thckness)",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=([1,160],[2,60],[3,145]),image="navButtonUnconnected.xpm",bc=lambda*args:updateShaverAttr(1,"rootThickness")) mc.floatSliderButtonGrp("tipThickness",pre=3,label=u"毛发尖端大小(Tip Thckness)",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=([1,160],[2,60],[3,145]),image="navButtonUnconnected.xpm",bc=lambda*args:updateShaverAttr(1,"tipThickness")) mc.floatSliderButtonGrp("specular",pre=3,label=u"高光(Specular)",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=([1,160],[2,60],[3,145]),image="navButtonUnconnected.xpm",bc=lambda*args:updateShaverAttr(1,"specular")) mc.colorSliderButtonGrp('specularTint2',label=u"二次高光(Secondary Specular)",buttonLabel="UPDATE",symbolButtonDisplay=False,cw=([1,160],[2,60],[3,145]),image="navButtonUnconnected.xpm",bc=lambda*args:updateShaverAttr(2,"specularTint2")) mc.colorSliderButtonGrp('hairColor',label=u"尖端颜色(Tip Color)",buttonLabel="UPDATE",symbolButtonDisplay=False,cw=([1,160],[2,60],[3,145]),image="navButtonUnconnected.xpm",bc=lambda*args:updateShaverAttr(2,"hairColor")) mc.colorSliderButtonGrp('rootColor',label=u"根部颜色(RootColor)",buttonLabel="UPDATE",symbolButtonDisplay=False,cw=([1,160],[2,60],[3,145]),image="navButtonUnconnected.xpm",bc=lambda*args:updateShaverAttr(2,"rootColor")) mc.showWindow('update_Shaver_Attr_UI')
def clrChanger(*args): colorVal = cmds.colorSliderButtonGrp("clrButton", q=True, rgb=True) return colorVal
def arnoldProductionUI(self): if mc.window("arnoldProductionUI",ex=True): mc.deleteUI("arnoldProductionUI") mc.window("arnoldProductionUI",tlc=[180,200],wh=[430,400],menuBar=True,title=u"arnold模型属性修改",sizeable=False) mc.scrollLayout("A",hst=0,vst=8) mc.columnLayout(adjustableColumn=True) mc.rowLayout(nc=2,cw=[(1, 344),(2, 200)]) mc.checkBox("aiSelfShadows",v=True,label="Self Shadows",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiSelfShadows")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiOpaque",v=True,label="Opaque",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiOpaque")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiVisibleInDiffuse",v=True,label="Visible In Diffuse",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiVisibleInDiffuse")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiVisibleInGlossy",v=True,label="Visible In Glossy",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiVisibleInGlossy")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiExportTangents",v=True,label="Export Tangents",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportTangents")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiExportColors",v=True,label="Export Vertex Colors",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportColors")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiExportRefPoints",v=True,label="Export Reference Points",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportRefPoints")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiExportRefNormals",v=True,label="Export Reference Normals",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportRefNormals")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiExportRefTangents",v=True,label="Export Reference Tangents",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportRefTangents")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiExportRefTangents",v=True,label="Export Reference Tangents",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportRefTangents")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiMatte",v=True,label="Matte",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiMatte")) mc.setParent("..") mc.separator() mc.text("Subdivision") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.optionMenuGrp("Type",l="Type",h=20) mc.menuItem(l="none") mc.menuItem(l="catclart") mc.menuItem(l="linear") mc.button(l="UPDATE",c=lambda *args:self.ProductionType("Type")) mc.setParent("..") mc.floatSliderButtonGrp("aiSubdivIterations",en=True,pre=0,label="Iterations",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)],min=0,max=10,fieldMaxValue=1,bc=lambda *args:self.ProductionIterations("aiSubdivIterations")) mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.optionMenuGrp("AdaptiveMetric",l="Adaptive Metric",h=20) mc.menuItem(l = "auto") mc.menuItem(l = "edge_length") mc.menuItem(l = "flatness") mc.button(l="UPDATE",c=lambda *args:self.ProductionType("AdaptiveMetric")) mc.setParent("..") mc.floatSliderButtonGrp("aiSubdivPixelError",en=True,pre=3,label="Pixel Error",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)],min=0,max=10,fieldMaxValue=1,bc=lambda *args:self.ProductionIterations("aiSubdivPixelError")) mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.optionMenuGrp("aiExportRefTangents",l="UV Smoothing",h=20) mc.menuItem(l="pin_corners") mc.menuItem(l="pin_borders") mc.menuItem(l="linears") mc.menuItem(l="smooth") mc.button(l="UPDATE",c=lambda *args:self.ProductionType("aiExportRefTangents")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiSubdivSmoothDerivs",v=True,label="SmoothTangents",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiSubdivSmoothDerivs")) mc.setParent("..") mc.separator() mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.optionMenuGrp("ArnoldTranslatoer",l="Arnold Translatoer",h=20) mc.menuItem(l = "mesh_light") mc.menuItem(l = "polymesh") mc.menuItem(l = "procedural") mc.button(l="UPDATE",c=lambda *args:self.ProductionType("ArnoldTranslatoer")) mc.setParent("..") mc.colorSliderButtonGrp('color', l = 'Color', buttonLabel = 'UPDATE', rgb = [0, 0, 0], symbolButtonDisplay = True, cw = [(1, 80), (2, 50), (3, 180)], bc = lambda *args:self.updateColorAttr('color')) mc.rowLayout(nc = 3,cw=[(1,46),(2,296),(3,200)]) mc.text(l = "intensity") mc.floatField("intensity", precision = 3) mc.button(l= "UPDATE", c=lambda *args:self.updateFloatFieldAttr("intensity")) mc.setParent("..") mc.floatSliderButtonGrp("aiExposure", en=True, pre=0, min = -5, max = 5, label="aiExposure",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiExposure")) mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiUseColorTemperature",v=True,label="Use Color Temperature",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiUseColorTemperature")) mc.setParent("..") mc.floatSliderButtonGrp("aiColorTemperature", en=True, pre=0, min = 1000, max = 15000, label="Temperature",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiColorTemperature")) mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("emitDiffuse",v=True,label="Emit Diffuse",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("emitDiffuse")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("emitSpecular",v=True,label="Emit Specular",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("emitSpecular")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.optionMenuGrp("DecayType",l="Decay Type",h=20) mc.menuItem(l = "constant") mc.menuItem(l = "quadratic") mc.button(l="UPDATE",c=lambda *args:self.ProductionType("DecayType")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("lightVisible",v=True,label="Light Visible",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("lightVisible")) mc.setParent("..") mc.rowLayout(nc = 3,cw=[(1,46),(2,296),(3,200)]) mc.text(l = "Samples") mc.floatField("aiSamples", precision = 0) mc.button(l= "UPDATE", c=lambda *args:self.updateFloatFieldAttr("aiSamples")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiNormalize",v=True,label="Normalize",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiNormalize")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiCastShadows",v=True,label="Cast Shadows",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiCastShadows")) mc.setParent("..") mc.floatSliderButtonGrp("aiShadowDensity", en=True, pre=3, min = 0, max = 1, label="Shadow Density",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiShadowDensity")) mc.colorSliderButtonGrp('aiShadowColor', l = 'Shadow Color', buttonLabel = 'UPDATE', rgb = [0, 0, 0], symbolButtonDisplay = True, cw = [(1, 80), (2, 50), (3, 180)], bc = lambda *args:self.updateColorAttr('aiShadowColor')) mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiAffectVolumetrics",v=True,label="Affect Volumetrics",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiAffectVolumetrics")) mc.setParent("..") mc.rowLayout(nc=2,cw=[(1,344),(2,200)]) mc.checkBox("aiCastVolumetricShadows",v=True,label="Cast Volumetric Shadows",align="right") mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiCastVolumetricShadows")) mc.setParent("..") mc.rowLayout(nc = 3,cw=[(1,86),(2,256),(3,200)]) mc.text(l = "Volume Samples") mc.floatField("aiVolumeSamples", precision = 0) mc.button(l= "UPDATE", c=lambda *args:self.updateFloatFieldAttr("aiVolumeSamples")) mc.setParent("..") mc.floatSliderButtonGrp("aiDiffuse", en=True, pre=3, min = 0, max = 1, label="Diffuse",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiDiffuse")) mc.floatSliderButtonGrp('aiSpecular', en = True, pre = 3, min = 0, max = 1, label = 'Specular', field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiSpecular")) mc.floatSliderButtonGrp('aiSss', en = True, pre = 3, min = 0, max = 1, label = 'SSS', field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiSss")) mc.floatSliderButtonGrp('aiIndirect', en = True, pre = 3, min = 0, max = 1, label = 'Indiret', field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiIndirect")) mc.floatSliderButtonGrp('aiVolume', en = True, pre = 3, min = 0, max = 1, label = 'Volume', field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiVolume")) mc.rowLayout(nc = 3,cw=[(1,66),(2,276),(3,200)]) mc.text(l = "Max Bounces") mc.floatField("aiMaxBounces", precision = 0, value = 999) mc.button(l= "UPDATE", c=lambda *args:self.updateFloatFieldAttr("aiMaxBounces")) mc.setParent("..") mc.showWindow("arnoldProductionUI")
def updateColorAttr(self, attr): allShapes = mc.ls(selection = True, dagObjects = True, ni = True, shapes = True, rq = True) updateAttrValue = mc.colorSliderButtonGrp(attr, q = True, rgb = True) for obj in allShapes: mc.setAttr('%s.%s'%(obj, attr), updateAttrValue[0], updateAttrValue[1], updateAttrValue[2])