Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc sc_pRigger_GUI()
- {
- if (`window -exists "sc_pRig_gui"`) deleteUI "sc_pRig_gui";
- window -w 150 -h 300 -t "pRigger" -maximizeButton false -minimizeButton false sc_pRig_gui;
- columnLayout;
- rowColumnLayout -numberOfColumns 3
- -columnWidth 1 5
- -columnWidth 2 215
- -columnWidth 3 5;
- button -vis 0;
- textFieldGrp -l "Number of Emitters: " -cw2 100 110 -tx 1 numOfEmits;
- button -vis 0;
- button -vis 0;
- textFieldGrp -l "Rig Type: " -cw2 100 50 rigType;
- button -vis 0;
- setParent..;
- //rowColumnLayout -numberOfColumns 3
- // -columnWidth 1 45
- // -columnWidth 2 175
- // -columnWidth 3 5;
- //button -vis 0;
- //string $selectJointGroup = `optionMenu -label "JointGroups:" -changeCommand "#1"`;
- //menuItem -label "Select...";
- //menuItem -label "LeftHandFingers";
- //menuItem -label "RightHandFingers";
- //menuItem -label "LeftIndexFinger";
- //menuItem -label "RightIndexFinger";
- //setParent..;
- rowColumnLayout -numberOfColumns 7
- -columnWidth 1 5
- -columnWidth 2 70
- -columnWidth 3 5
- -columnWidth 4 70
- -columnWidth 5 5
- -columnWidth 6 70
- -columnWidth 7 5;
- button -vis 0;
- button -l "Refresh" -c sc_emitterPanal;
- button -vis 0;
- button -l "Create" -c sc_pRiggerCreate;
- button -vis 0;
- button -l "Set" -c sc_pRigNewPos;
- button -vis 0;
- setParent..;
- showWindow sc_pRig_gui;
- }
- proc sc_pRiggerCreate()
- //proc for the initial creation of the rig, taking the UI and implementing, shape is set at square.
- {
- //counter is based upon, the UI field "numOfEmits" where the user decideds how many to rig.
- int $counter = (`textFieldGrp -q -tx numOfEmits`);
- //not sure if this int is needed.
- int $cubeSubCounter = $counter + 1;
- //if the input contained in the $counter var. is greater than 0 then create the root,
- //rename it, contain it and move it to the 0 0 0 coord's and perform the while loop.
- if ($counter>0)
- {
- polyCube -n "pRigRoot";
- move -r -os -wd 0 0 0 ;
- string $pRigRoot[] = `ls -sl`;
- int $vertCount = $counter;
- spaceLocator -n "locGrouper";
- group -n pSet "locGrouper";
- string $pSet[] = `ls -sl`;
- print $pSet;
- select -cl;
- select locGrouper;
- delete "locGrouper";
- int $pRigRootCheck = `objExists "root"`;
- //if the root group exists then move the new root to the group.
- if($pRigRootCheck == 0)
- {
- spaceLocator -n "locGrouper";
- select -cl;
- group -n "root" "locGrouper";
- delete "locGrouper";
- }
- // while the counter is greater than 0, create a locator, emitter, and particals,
- //linking the partical to the emitter, and containing each in a var.
- //lastly subtracting 1 from the counter
- while ($counter>0)
- {
- //locator creation
- spaceLocator;
- rename pRigLoc;
- scale -r 1 1 1;
- string $pRigLoc[] = (`ls -sl`);
- //emitter creation
- emitter -pos 0 0 0 -type omni -r 100 -sro 0 -nuv 0 -cye none -cyi 1 -spd 1 -srn 0 -nsp 1 -tsp 0
- -mxd 0 -mnd 0 -dx 1 -dy 0 -dz 0 -sp 0 ;
- rename pRigEmit;
- move -r -os -wd 0 0 0 ;
- string $pRigEmit[] = (`ls -sl`);
- //partical creation
- particle;
- rename pRigPart;
- string $pRigPart[] = (`ls -sl`);
- //dynamic connection for the emiter and partical
- connectDynamic -em $pRigEmit $pRigPart;
- //parent constraints for the loc, emit, part and all parented to the root.
- select $pRigLoc;
- select -add $pRigEmit;
- parentConstraint -mo -weight 1;
- select -r $pRigEmit;
- select $pRigLoc;
- select -add $pRigPart;
- parentConstraint -mo -weight 1;
- select $pRigRoot;
- select -add $pRigLoc;
- doCreateParentConstraintArgList 1 { "1","0","0","0","0","0","0","1","","1" };
- parentConstraint -mo -weight 1;
- parent $pRigEmit $pRigLoc;
- parent $pRigPart $pRigLoc;
- parent $pRigLoc $pSet;
- //parent $pRigRoot $pSet;
- //counter for the while loop
- $counter = ($counter-1);
- }
- }
- }
- //sc_pRiggerCreate()
- proc sc_pRigNewPos()
- {
- //sceneTotals
- //pSets
- select "pSet*";
- string $pSetSceneArray[] = `ls -sl`;
- int $pSetSceneCount = size($pSetSceneArray);
- int $pSetCounter = 0;
- select -cl;
- //pc's
- select "pRigLoc_parentConstraint*";
- string $pLocSceneArray[] = `ls -sl`;
- int $pLocSceneCount = size($pLocSceneArray);
- int $locCounter = 1;
- select -cl;
- //COUNTING HOUSE
- //print "\nCOUNTING HOUSE\n";
- //print "~~~~~~~~~~~~~~\n";
- //print "Total pSets: ";
- //print $pSetSceneCount;
- //print "\nTotal Constraints: ";
- //print $pLocSceneCount;
- //print "\n\npSets:\n";
- //print "~~~~~~\n";
- //print $pSetSceneArray;
- //print "\nConstraints: \n";
- //print "~~~~~~~~~\n";
- //print $pLocSceneArray;
- //print "\n";
- for ($each in $pSetSceneArray)
- {
- if ($pSetCounter == 0)
- {
- string $pSetSel = "pSet";
- //print $pSetSel;
- //print "\n";
- string $pSetRoot = ($pSetSel + "|pRigRoot");
- //print $pSetRoot;
- //print $pSetCounter;
- //print "\nfirst pSet selected\n";
- $pSetCounter = $pSetCounter + 1;
- select $pSetSel;
- select -hi;
- string $subpSetArray[] = `ls -sl "pRigLoc_parentConstraint*"`;
- //print $subpSetArray;
- //print "\n";
- for ($each in $subpSetArray)
- {
- string $child = ("pRigLoc_parentConstraint" + $locCounter);
- parentConstraint -e -maintainOffset $pSetRoot $child;
- $locCounter = $locCounter + 1;
- }
- }
- else
- {
- string $pSetSel = ("pSet" + $pSetCounter);
- //print $pSetSel;
- //print "\n";
- string $pSetRoot = ($pSetSel + "|pRigRoot");
- //print $pSetRoot;
- //print $pSetCounter;
- //print "\nother pSets selected\n";
- $pSetCounter = $pSetCounter + 1;
- select $pSetSel;
- select -hi;
- string $subpSetArray[] = `ls -sl "pRigLoc_parentConstraint*"`;
- for ($each in $subpSetArray)
- {
- string $child = ("pRigLoc_parentConstraint" + $locCounter);
- parentConstraint -e -maintainOffset $pSetRoot $child;
- $locCounter = $locCounter + 1;
- }
- }
- select -cl;
- }
- }
- proc sc_emitterPanal()
- {
- if (`window -exists "sc_emitter"`) deleteUI "sc_emitter";
- window -w 300 -t "Emitter" -maximizeButton false -minimizeButton false sc_emitter;
- columnLayout -adj 1;
- rowColumnLayout -numberOfColumns 3
- -columnWidth 1 100;
- //button -l "Refresh";
- setParent..;
- select "pSet*";
- string $sel[] = `ls -sl`;
- int $pSetCount = size($sel);
- int $pSetArray = $pSetCount - 1;
- for ($each in $sel)
- {
- rowColumnLayout -numberOfColumns 3
- -columnWidth 1 100
- -columnWidth 2 1;
- checkBoxGrp -cw2 50 65 -l $each $each;
- setParent..;
- }
- rowColumnLayout -numberOfColumns 3
- -columnWidth 1 100
- -columnWidth 2 1;
- checkBoxGrp -l "All: " -cw2 50 60;
- setParent..;
- //string $query = (`checkBoxGrp -q -v1 pSet2`);
- rowColumnLayout -numberOfColumns 1
- -columnWidth 1 100;
- //button -c sc_emitterPanal;
- select -cl;
- showWindow sc_emitter;
- }
- sc_pRigger_GUI()
Add Comment
Please, Sign In to add comment