Skip to content

Instantly share code, notes, and snippets.

@fereria
Created February 21, 2014 03:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fereria/f652e708ab2284898a8d to your computer and use it in GitHub Desktop.
Save fereria/f652e708ab2284898a8d to your computer and use it in GitHub Desktop.
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