- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So I have an option Menu with a list of colours. When I select the curve, and the colour from the options and I run the code nothing happens. Can someone help please?
CODE:
import maya.cmds as cmds
if cmds.window('change_colors', exists = True):
cmds.deleteUI('change_colors')
cmds.window('change_colors')
cmds.columnLayout()
cmds.optionMenu( label='Colors')
red = cmds.menuItem( label='Red' )
blue = cmds.menuItem( label='Blue' )
yellow = cmds.menuItem( label='Yellow' )
green = cmds.menuItem( label='Green' )
pink = cmds.menuItem( label='Pink' )
lightBlue = cmds.menuItem( label='Light Blue' )
cmds.showWindow()
crvSel = cmds.ls(sl=True)
crv_shape = cmds.listRelatives(crvSel, s = True)
cmds.setAttr(crv_shape[0] + '.overrideEnabled', 1)
if red == True:
cmds.setAttr(crv_shape[0] + '.overrideColor', 13)
if blue == True:
cmds.setAttr(crv_shape[0] + '.overrideColor', 6)
if yellow == True:
cmds.setAttr(crv_shape[0] + '.overrideColor', 17)
if green == True:
cmds.setAttr(crv_shape[0] + '.overrideColor', 14)
if pink == True:
cmds.setAttr(crv_shape[0] + '.overrideColor', 9)
if lightBlue == True:
cmds.setAttr(crv_shape[0] + '.overrideColor', 18)
Solved! Go to Solution.