Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // window - GUI
- {
- string $window = `window -t "Az' Automated SplitEdgeRing"`;
- rowColumnLayout;
- floatFieldGrp -label "< 0.5" -precision 3 greaterThan;
- floatFieldGrp -label "> 0.5" -precision 3 smallerThan;
- button -l "Center" -command "funcChangeWeight(1)";
- button -l "Non-Center" -command "funcChangeWeight(0)";
- showWindow $window;
- }
- proc funcChangeWeight(int $justCenter)
- {
- // declare an array called $polySplitRings. Call ls to list
- // all the polySplitRings in the scene
- $polySplitRings = `ls -et polySplitRing`;
- if ($justCenter == 1)
- {
- //print "just Center \n"; // debug: show that the button was clicked
- // loop through the array and set the weight to .5
- for( $polySplitRing in $polySplitRings )
- {
- select -addFirst $polySplitRing ;
- setAttr ($polySplitRing + ".weight") .5;
- select -d $polySplitRing;
- }
- }
- else
- {
- //print "Do not center \n"; // debug: show that the button was clicked
- float $greaterThan = `floatFieldGrp -q -v1 greaterThan`;
- float $smallerThan = `floatFieldGrp -q -v1 smallerThan`;
- // loop through the array and set the weight to $greaterThan or $smallerThan
- for( $polySplitRing in $polySplitRings )
- {
- float $fWeight = getAttr ($polySplitRing + ".weight");
- //print ($fWeight + "\n"); // debug: show current weight attribute
- select -addFirst $polySplitRing ;
- if ($fWeight < 0.5)
- {
- setAttr ($polySplitRing + ".weight") $smallerThan;
- }
- else
- {
- setAttr ($polySplitRing + ".weight") $greaterThan;
- }
- select -d $polySplitRing;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement