Skip to content

Instantly share code, notes, and snippets.

@mclavan
Created November 16, 2014 04:34
Show Gist options
  • Save mclavan/a0938fe275838b886ed6 to your computer and use it in GitHub Desktop.
Save mclavan/a0938fe275838b886ed6 to your computer and use it in GitHub Desktop.
Aaron's Color Control Script
'''
TELIMS - Color Curves
How to Use:
import telims_color_curves_wireframe
reload(telims_color_curves_wireframe)
Select 1 or multiple curves > run Script
Enter Yellow, Red or blue
'''
print "Welcome to Telims' curve/wirframe color changer"
print ''
# import pymel.core
import pymel.core as pm
def color_selected_controls():
# define some variables
user_input = pm.promptDialog(title = 'Change curve/wireframe color', message = 'Please enter "yellow", "red", or "blue"', button =['Colorize', 'Cancel'], defaultButton = 'Colorize', cancelButton = 'Cancel', dismissString = 'Cancel')
selected_control = pm.ls(selection = True)
# prompt the User
if user_input == 'Colorize':
# query the input of the user
text = pm.promptDialog(query = True, text = True)
# make all text lowercase
text = text.lower()
if text != 'yellow' and text != 'red' and text != 'blue':
pm.error("You did not choose one of the three colors or you have multiple words...")
# recolor curve/wireframe yellow...
if text == 'yellow':
color_controls(selected_controls, 17)
# recolor curve/wireframe red
elif text == 'red':
color_controls(selected_controls, 13)
# recolor curve/wireframe blue...
elif text == 'blue':
color_controls(selected_controls, 6)
print 'Color of curve/wireframe has been changed.'
def color_controls(selected_controls, color):
for control in selected_controls:
# enable color override...
control.overrideEnabled.set(True)
# recolor curve/wireframe red...
control.overrideColor.set(color)
def color_controls_orienation():
left_controls = pm.ls('lt_*_icon') # lt_arm_icon
right_controls = pm.ls('rt_*_icon')
center_controls = pm.ls('ct_*_icon')
color_controls(left_controls, 6)
color_controls(right_controls, 13)
color_controls(center_controls, 17)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment