CODE;
proc sc_gui()
{
if (`window -exists "sc_gui"`) deleteUI "sc_gui";
window -w 150 -h 300 -t "Locator Randomiser" -
maximizeButton false -minimizeButton false sc_gui;
columnLayout;
string $sel[] = (`ls -sl`);
separator;
separator;
textFieldButtonGrp -label "Object:"
-text $sel
-buttonLabel "<<<"
-cw3 50 165 10
-ct3 "left" "both" "left"
-buttonCommand "sc_getObj()" selObj;
separator;
separator;
separator -style "double" -w 265;
rowColumnLayout -numberOfColumns 11
-columnWidth 1 5
-columnWidth 2 10
-columnWidth 3 5
-columnWidth 4 45
-columnWidth 5 5
-columnWidth 6 130
-columnWidth 7 5
-columnWidth 8 45
-columnWidth 9 5
-columnWidth 10 5
-columnWidth 11 5
;
button -vis 0;
button -vis 0;
button -vis 0;
button -vis 0;
button -vis 0;
text "Frame Settings";
button -vis 0;
button -vis 0;
button -vis 0;
button -vis 0;
setParent..;
rowColumnLayout -numberOfColumns 11
-columnWidth 1 5
-columnWidth 2 5
-columnWidth 3 5
-columnWidth 4 100
-columnWidth 5 5
-columnWidth 6 5
-columnWidth 7 5
-columnWidth 8 100
-columnWidth 9 5
-columnWidth 10 5
-columnWidth 11 5
;
button -vis 0;
button -vis 0;
button -vis 0;
textFieldGrp -l "Start:" -cw2 50 165 -text 1 start;
button -vis 0;
button -vis 0;
button -vis 0;
textFieldGrp -l "Min:" -cw2 50 165 -text 1 minFrame;
button -vis 0;
button -vis 0;
setParent..;
rowColumnLayout -numberOfColumns 11
-columnWidth 1 5
-columnWidth 2 5
-columnWidth 3 5
-columnWidth 4 100
-columnWidth 5 5
-columnWidth 6 5
-columnWidth 7 5
-columnWidth 8 100
-columnWidth 9 5
-columnWidth 10 5
-columnWidth 11 5
;
button -vis 0;
button -vis 0;
button -vis 0;
textFieldGrp -l "Finish:" -cw2 50 165 -text 100 finish;
button -vis 0;
button -vis 0;
button -vis 0;
textFieldGrp -l "Max:" -cw2 50 165 -text 10 maxFrame;
button -vis 0;
button -vis 0;
setParent..;
separator;
separator;
separator;
separator;separator;
separator;
separator -style "double" -w 265;
rowColumnLayout -numberOfColumns 11
-columnWidth 1 5
-columnWidth 2 10
-columnWidth 3 5
-columnWidth 4 45
-columnWidth 5 5
-columnWidth 6 130
-columnWidth 7 5
-columnWidth 8 45
-columnWidth 9 5
-columnWidth 10 5
-columnWidth 11 5
;
button -vis 0;
button -vis 0;
button -vis 0;
text "Min";
button -vis 0;
text "Movement Parameters";
button -vis 0;
text "Max";
button -vis 0;
button -vis 0;
setParent ..;
rowColumnLayout -numberOfColumns 11
-columnWidth 1 5
-columnWidth 2 10
-columnWidth 3 5
-columnWidth 4 45
-columnWidth 5 5
-columnWidth 6 130
-columnWidth 7 5
-columnWidth 8 45
-columnWidth 9 5
-columnWidth 10 5
-columnWidth 11 5
;
button -vis 0; //1
text "X:"; //2
button -vis 0; //3
textField -text -10 -aie true -ec sc_minMaxUpdateX minFltSldX;//4
button -vis 0;//5
floatSlider -min -10 -max 10 tranX;//6
button -vis 0;//7
textField -text 10 -aie true -ec sc_minMaxUpdateX maxFltSldX;//8
button -vis 0 ;//9
button -vis 0;//10
button -vis 0;//11
setParent..;
rowColumnLayout -numberOfColumns 11
-columnWidth 1 5
-columnWidth 2 10
-columnWidth 3 5
-columnWidth 4 45
-columnWidth 5 5
-columnWidth 6 130
-columnWidth 7 5
-columnWidth 8 45
-columnWidth 9 5
-columnWidth 10 5
-columnWidth 11 5
;
button -vis 0;//1
button -vis 0;//2
button -vis 0;//3
text "Random:";//4
button -vis 0;//5
checkBox -l " " randChkX;//6
button -vis 0;//7
button -vis 0;//8
button -vis 0;//9
button -vis 0;//10
button -vis 0;//11
setParent..;
separator;
separator;
separator -style "single" -w 265;
separator;
separator;
rowColumnLayout -numberOfColumns 11
-columnWidth 1 5
-columnWidth 2 10
-columnWidth 3 5
-columnWidth 4 45
-columnWidth 5 5
-columnWidth 6 130
-columnWidth 7 5
-columnWidth 8 45
-columnWidth 9 5
-columnWidth 10 5
-columnWidth 11 5
;
button -vis 0; //1
text "Y:"; //2
button -vis 0; //3
textField -text -10 -aie true -ec sc_minMaxUpdateY minFltSldY;//8//4
button -vis 0;//5
floatSlider -min -10 -max 10 tranY;//6
button -vis 0;//7
textField -text 10 -aie true -ec sc_minMaxUpdateY maxFltSldY;//8
button -vis 0 ;//9
button -vis 0;//10
button -vis 0;//11
setParent..;
rowColumnLayout -numberOfColumns 9
-columnWidth 1 5
-columnWidth 2 50
-columnWidth 3 5
-columnWidth 4 20
-columnWidth 5 45
-columnWidth 6 75
-columnWidth 7 5
-columnWidth 8 45
-columnWidth 9 5
;
button -vis 0;//1
text "Random:";//2
button -vis 0;//3
checkBox -l " Y" randChkY;//4
button -vis 0;//5
button -vis 0;//6
button -vis 0;//7
button -vis 0;//8
button -vis 0;//9
setParent..;
separator;
separator;
separator -style "single" -w 265;
separator;
separator;
rowColumnLayout -numberOfColumns 11
-columnWidth 1 5
-columnWidth 2 10
-columnWidth 3 5
-columnWidth 4 45
-columnWidth 5 5
-columnWidth 6 130
-columnWidth 7 5
-columnWidth 8 45
-columnWidth 9 5
-columnWidth 10 5
-columnWidth 11 5
;
button -vis 0; //1
text "Z:"; //2
button -vis 0; //3
textField -text -10 -aie true -ec sc_minMaxUpdateZ minFltSldZ;//4
button -vis 0;//5
floatSlider -min -10 -max 10 tranZ;//6
button -vis 0;//7
textField -text 10 -aie true -ec sc_minMaxUpdateZ maxFltSldZ;//8
button -vis 0 ;//9
button -vis 0;//10
button -vis 0;//11
setParent..;
rowColumnLayout -numberOfColumns 9
-columnWidth 1 5
-columnWidth 2 50
-columnWidth 3 5
-columnWidth 4 20
-columnWidth 5 45
-columnWidth 6 75
-columnWidth 7 5
-columnWidth 8 45
-columnWidth 9 5
;
button -vis 0;//1
text "Random:";//2
button -vis 0;//3
checkBox -l " Z" randChkZ;//4
button -vis 0;//5
button -vis 0;//6
button -vis 0;//7
button -vis 0;//8
button -vis 0;//9
setParent..;
separator;
separator;
separator -style "single" -w 265;
separator;
separator;
rowColumnLayout -numberOfColumns 3;
button -vis 0 -w 160;
button -l "Key" -c sc_frameCount;
button -vis 0;
setParent ..;
separator;
separator;
showWindow "sc_gui";
}
proc sc_getObj()
{
string $sel[] = (`ls -sl`);
string $firstObj = $sel[0];
textFieldButtonGrp -edit -text $firstObj selObj;
print $firstObj;
}
proc sc_applyMinMax()
{
int $minX = (`textField -query -text minFltSldX`);
int $maxX = (`textField -query -text maxFltSldX`);
print ($minX + "\n");
print ($maxX + "\n\n");
}
proc sc_minMaxUpdateX()
{
float $minX;
float $maxX;
$minX = (`textField -q -text minFltSldX`);
$maxX = (`textField -q -text maxFltSldX`);
floatSlider -edit -min $minX -max $maxX tranX;
}
proc sc_minMaxUpdateY()
{
float $minY;
float $maxY;
$minY = (`textField -q -text minFltSldY`);
$maxY = (`textField -q -text maxFltSldY`);
floatSlider -edit -min $minY -max $maxY tranY;
}
proc sc_minMaxUpdateZ()
{
float $minZ;
float $maxZ;
$minZ = (`textField -q -text minFltSldZ`);
$maxZ = (`textField -q -text maxFltSldZ`);
floatSlider -edit -min $minZ -max $maxZ tranZ;
}
proc sc_frameCount()
{
int $start = (`textFieldGrp -query -text start`);
int $end = (`textFieldGrp -query -text finish`);
int $min = (`textFieldGrp -query -text minFrame`);
int $max = (`textFieldGrp -query -text maxFrame`);
int $randMoveX;
int $randMoveY;
int $randMoveZ;
string $objAttrX;
string $objAttrY;
string $objAttrZ;
int $finalMoveX;
int $finalMoveY;
int $finalMoveZ;
int $objAttrGetX;
int $objAttrGetY;
int $objAttrGetZ;
string $sel[] = (`select`);
string $Ty = "ty";
int $currentFrame = $start;
for ($currentFrame > $start; $currentFrame < $end;)
{
int $randGen = rand($min,$max);
string $selObj = (`textFieldButtonGrp -query -text selObj`);
int $minFltSldX = (`textField -q -text minFltSldX`);
int $minFltSldY = (`textField -q -text minFltSldY`);
int $minFltSldZ = (`textField -q -text minFltSldZ`);
int $maxFltSldX = (`textField -q -text maxFltSldX`);
int $maxFltSldY = (`textField -q -text maxFltSldY`);
int $maxFltSldZ = (`textField -q -text maxFltSldZ`);
currentTime -edit $currentFrame;
$currentFrame = ($currentFrame + $randGen);
//~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~X~
//~~~~~~~~~~~~~~~~~~~~~~
if (`checkBox -q -v randChkX`)
{
$randMoveX = rand($minFltSldX,$maxFltSldX);
}
else
{
$randMoveX = (`floatSlider -query -value tranX`);
}
$objAttrX = $selObj + ".translateX";
$objAttrGetX = `getAttr $objAttrX`;
$finalMoveX = ($objAttrGetX + $randMoveX);
setAttr $objAttrX $finalMoveX;
//~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~Y~
//~~~~~~~~~~~~~~~~~~~~~~
if (`checkBox -q -v randChkY`)
{
$randMoveY = rand($minFltSldY,$maxFltSldY);
}
else
{
$randMoveY = (`floatSlider -query -value tranY`);
}
$objAttrY = $selObj + ".translateY";
$objAttrGetY = `getAttr $objAttrY`;
$finalMoveY = ($objAttrGetY + $randMoveY);
setAttr $objAttrY $finalMoveY;
//~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~Z~
//~~~~~~~~~~~~~~~~~~~~~~
if (`checkBox -q -v randChkZ`)
{
$randMoveZ = rand($minFltSldZ,$maxFltSldZ);
}
else
{
$randMoveZ = (`floatSlider -query -value tranZ`);
}
$objAttrZ = $selObj + ".translateZ";
$objAttrGetZ = `getAttr $objAttrZ`;
$finalMoveZ = ($objAttrGetZ + $randMoveZ);
setAttr $objAttrZ $finalMoveZ;
//~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~End~
//~~~~~~~~~~~~~~~~~~~~~~
setKeyframe `textFieldButtonGrp -query -text selObj`;
}
}
sc_gui()
No comments:
Post a Comment