Skip to content

Instantly share code, notes, and snippets.

@JustinPedersen
Created September 1, 2017 11:24
Show Gist options
  • Save JustinPedersen/072cafecaa38e60fa1adbedcd64ee724 to your computer and use it in GitHub Desktop.
Save JustinPedersen/072cafecaa38e60fa1adbedcd64ee724 to your computer and use it in GitHub Desktop.
//=============================================================//
/*===================ASTRA COLOUR DIVIDER======================*/
//=============================================================//
//======== Colour divider created by Justin Pedersen ==========//
//================== Justin@tcgcape.co.za =====================//
/*=============================================================*/
string $Win = "OutlinerDivider";
if ( `window -exists $Win` ) {
deleteUI $Win;
}
int $w = 80;
int $h = 40;
window -t $Win $Win;
frameLayout -l "Outliner Colour Divider creator";
rowColumnLayout -nc 4;
button -w $w -h $h -l "" -bgc 0 0.9 0.2 -c "Create($Colour = \"green\")" green;
button -w $w -h $h -l "" -bgc 0.8 1 0.6 -c "Create($Colour = \"lime\")" lime;
button -w $w -h $h -l "" -bgc 1 1 0.3 -c "Create($Colour = \"yellow\")" yellow;
button -w $w -h $h -l "" -bgc 1 0.8 0.2 -c "Create($Colour = \"orange\")" orange;
button -w $w -h $h -l "" -bgc 0 0.4 1 -c "Create($Colour = \"blue\")" blue;
button -w $w -h $h -l "" -bgc 1 0 0.3 -c "Create($Colour = \"red\")" red;
button -w $w -h $h -l "" -bgc 0.7 0.2 0.9 -c "Create($Colour = \"purple\")" purple;
button -w $w -h $h -l "" -bgc 1 0.6 0.9 -c "Create($Colour = \"pink\")" pink;
setParent ..;
columnLayout;
button -w 320 -h 30 -l "Custom Colour" -c CustomClr;
button -w 320 -h 30 -l "Default" -c Default;
showWindow $Win;
proc Default(){
string $Selection[] = `ls-sl`;
for($SEL in $Selection){
setAttr ($SEL + ".useOutlinerColor") false;
}
}
proc CustomClr(){
colorEditor;
if (`colorEditor -query -result`) {
float $values[];
$values = `colorEditor -query -rgb`;
string $Selection[] = `ls-sl`;
for($SEL in $Selection){
setAttr ($SEL + ".useOutlinerColor") true;
setAttr ($SEL + ".outlinerColor") $values[0] $values[1] $values[2];
}
} else {
print ("Editor was dismissed\n");
}
}
proc Create(string $Colour){
float $clr[] = `button -q -bgc $Colour`;
string $Selection[] = `ls-sl`;
int $S = `size($Selection)`;
if ($S > 0){
for ($SEL in $Selection){
setAttr ($SEL + ".useOutlinerColor") true;
setAttr ($SEL + ".outlinerColor") $clr[0] $clr[1] $clr[2];
}
}if ($S < 1){
ColourDiv($Colour);
}
}
proc ColourDiv(string $Colour){
float $clr[] = `button -q -bgc $Colour`;
Divider;
string $sel[] = `ls-sl`;
setAttr ($sel[0] + ".outlinerColor") $clr[0] $clr[1] $clr[2];
select -cl;
}
proc Divider(){
// styles strings
string $st1 = "________________________________________________________________________";
string $Grp = `group -em -n $st1`;
setAttr -lock true -keyable false -channelBox false ($Grp + ".tx");
setAttr -lock true -keyable false -channelBox false ($Grp + ".ty");
setAttr -lock true -keyable false -channelBox false ($Grp + ".tz");
setAttr -lock true -keyable false -channelBox false ($Grp + ".rx");
setAttr -lock true -keyable false -channelBox false ($Grp + ".ry");
setAttr -lock true -keyable false -channelBox false ($Grp + ".rz");
setAttr -lock true -keyable false -channelBox false ($Grp + ".sx");
setAttr -lock true -keyable false -channelBox false ($Grp + ".sy");
setAttr -lock true -keyable false -channelBox false ($Grp + ".sz");
setAttr ($Grp + ".useOutlinerColor") true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment