Hi All,

I am a Rigging Artist. a few months ago I start to learn the python 
language. from youtube and then  i wite my first python script "Controller 
Creator" here is link -- 
https://www.highend3d.com/maya/script/controller-creator-for-maya 
in this script, you can create 16 different types of nurbs curve shapes in 
on click.

and now I move forward to add a new option in the script to change curve 
color. so I write code for that but it's hard for me and I can't change 
curve color. can anyone tell me how to command execute and it will change 
the curve color
I send you my script in the attachment you can download and fix the problem.

Thank you 
Sachendra

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/f82928f7-dab9-4981-8b17-50a93915b912%40googlegroups.com.
import maya .cmds as cmds

def override_color(color_index):
	sel = cmds. ls (selection=True)

	shape =cmds.listRelatives (sel, shapes = True )


	for node in shape:	
		cmds. setAttr (node + ".overrideEnabled" ,True) 
		cmds. setAttr (node + ".overrideColor" ,color_index)
	


def display():
	main_window = cmds.window(title= "COLOR", sizeable=False)
	main_layout = cmds.frameLayout()

	columns = 16
	rows = 2
	sell_width = 17.5
	sell_height = 17.5
	color_palette = cmds. palettePort (dimensions = (columns, rows), width = columns*sell_width, height = rows*sell_height,topDown = True,  colorEditable=False)

	for index in range(1, 31):
		color_component = cmds. colorIndex (index,query=True)
		cmds. palettePort (color_palette, edit=True, rgbValue = (index, color_component[0], color_component[1], color_component[2]))
	cmds. palettePort(color_palette, edit = True, rgbValue=(0, 0.6, 0.6, 0.6))

	cmds. button ("Apply",command = "applyColor ()" )



	cmds.showWindow(main_window)

def applyColor ():
	color_index = cmds.palettePort(color_palette, q=True, setCurCell=True)
	override_color(color_index)
	print color_index
	
display()

Reply via email to