//
// CC_CharaSetGizmo
//
// MEL to do that and it on Character Set(CS).
//
// usage of buttons:
//
// (A) Set Keys
// (1) Select Character Sets.
// (2) Push this button and members are keyed.
// (B) Get Values
// (1) Select Character Sets.
// (2) Push this button and generate MEL to regain current value.
// (C) CS Zero Out
// (1) Select Character Sets.
// (2) Push this button and zero-out members.
// (D) Eval Text
// (1) Write some MEL text in the textfield.
// (2) Push this button and the text is evaluated as MEL.
//
//==============================================================
//==============================================================
//
// CC_CharaSetGizmo
//
// MEL to do that and it on Character Set(CS).
//
// usage of buttons:
//
// (A) Set Keys
// (1) Select Character Sets.
// (2) Push this button and members are keyed.
// (B) Get Values
// (1) Select Character Sets.
// (2) Push this button and MEL to regain current values is generated.
// (C) CS Zero Out
// (1) Select Character Sets.
// (2) Push this button and members are zero-outed.
// (D) Eval Text
// (1) Write some MEL in the textfield.
// (2) Push this button and the text is evaluated as MEL.
//
//==============================================================
//==============================================================
// Window
//==============================================================
if (`window -exists window_cccsg`){
deleteUI window_cccsg;
}
window -t "CC CharaSetGizmo v1.0" window_cccsg;
window -e -wh 400 70 -sizeable false window_cccsg;
columnLayout;
rowColumnLayout -nr 1 -rh 1 30;
// Button
rowColumnLayout -nc 4 -cw 1 100 -cw 2 100 -cw 3 100 -cw 4 100;
button -h 30 -bgc 1 .75 .90 -l "Set Keys" -c "cccsg_proc(1)" buttonSetKeys;
button -h 30 -bgc .90 1 .75 -l "Get Values" -c "cccsg_proc(2)" buttonGetValues;
button -h 30 -bgc .75 .90 1 -l "CS Zero Out" -c "cccsg_proc(3)" buttonZeroOut;
button -h 30 -bgc .9 .9 .9 -l "Eval Text" -c "cccsg_eval" buttonEval;
setParent..;
setParent..;
// ScrollField
scrollField -w 400 -h 120 -tx "" textCsgField;
showWindow window_cccsg;
//==============================================================
// Buttons
//==============================================================
proc cccsg_proc(int $arg){
string $sel[] = `ls -sl`;
string $txt = "";
for($item in $sel) {
if(`nodeType $item` != "character"){continue;}
string $attrs[] = `listConnections -p true ($item + ".dnSetMembers")`;
for ($attr in $attrs) {
if( gmatch($attr, "*.message") == 1 ){continue;}
switch($arg) {
case 1:
$txt = ($item + "." + substituteAllString($attr, ".", "_") );
print ( $txt + "\n");
setKeyframe $txt;
break;
case 2:
$txt += ("setAttr " + $attr + " " + `getAttr $attr` + ";\n");
break;
case 3:
cccsg_zeroout($attr);
break;
}
if($arg == 2){
print $txt;
scrollField -e -tx $txt textCsgField;
}
}
//==============================================================
// Zero Out
//==============================================================
proc cccsg_zeroout(string $attr){
int $targetValue = 0;
if($attr == "visibility"){return;}
if( gmatch($attr, "*.scale*") == 1 ){$targetValue = 1;}
if( gmatch($attr, "*.__*") == 1 ){
return;
}else if( gmatch($attr, "*._*") == 1 ){
$targetValue = 1;
}
print ("setAttr " + $attr + " " + $targetValue + "\n");
if(!`getAttr -l $attr`) setAttr $attr $targetValue;
}
//==============================================================
// Eval
//==============================================================
proc cccsg_eval(){
eval `scrollField -q -tx textCsgField`;
}