global proc zbw_changeColor() { if (`window -exists changeColorUI`) { deleteUI changeColorUI; windowPref -remove changeColorUI; } string $window = `window -widthHeight 250 75 -title "changeColorUI" changeColorUI`; columnLayout; //intField named ColorNumber string $myIntField = `colorIndexSliderGrp -min 0 -max 32 -value 1 colorNumber`; button -label "changeColor" -command "zbw_getColor()"; /*text "yellow=22"; text "red=13"; text "blue=6"; text "brtGrn=14"; text "pink=20"; text "ltBlue=18"; text "dkGrn=7"; text "brown=10"; */ showWindow $window; } global proc zbw_getColor() { int $thisColorVal = `colorIndexSliderGrp -q -v colorNumber`; int $thisColorNew = $thisColorVal - 1; zbw_overrideColor($thisColorNew); } global proc zbw_overrideColor(int $color) { //to change colors of objects string $sel[] = `ls -sl`; int $sizeSel = size ($sel); for ($i=0;$i<$sizeSel;++$i){ string $this = $sel[$i]; string $thisChild[]=`listRelatives -c $this`; string $thisShape = $thisChild[0]; string $thisShapeOver = $thisShape + ".overrideEnabled"; string $thisShapeColor = $thisShape + ".overrideColor"; setAttr $thisShapeOver 1; setAttr $thisShapeColor $color; } } zbw_changeColor();