-
-
Save fereria/f652e708ab2284898a8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as mc | |
def selectPalette(): | |
selectNum = mc.palettePort(palette,q=True,scc=True) | |
print selectNum | |
changeCurveColor(selectNum) | |
def changeCurveColor(colorNum): | |
selectNode = mc.ls(sl=True,fl=True) | |
if selectNode != None: | |
for node in selectNode: | |
shapeNode =mc.listRelatives(node,s=True) | |
if shapeNode != None: | |
for shape in shapeNode: | |
if mc.objectType(shape) == "nurbsCurve": | |
mc.setAttr(shape + ".overrideEnabled",1) | |
mc.setAttr(shape + ".overrideColor",int(colorNum)) | |
windowName = "changeCurveColorUI" | |
if mc.window(windowName,exists=True) == True: | |
mc.deleteUI(windowName) | |
paletteWindow = mc.window(windowName,title=windowName) | |
paletteLayout = mc.frameLayout(labelVisible=0) | |
palette = mc.palettePort( dimensions=(16,2),width=16 * 20,height= 2 * 20,transparent = 0,topDown=True,colorEditable=False,cc=selectPalette) | |
for i in range(1,31): | |
col = mc.colorIndex(i,q=True) | |
mc.palettePort(palette,e=True,rgbValue=(i,col[0],col[1],col[2])) | |
mc.showWindow(paletteWindow) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment