Guest User

Untitled

a guest
Jan 22nd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.91 KB | None | 0 0
  1. proc sc_pRigger_GUI()
  2. {
  3. if (`window -exists "sc_pRig_gui"`) deleteUI "sc_pRig_gui";
  4. window -w 150 -h 300 -t "pRigger" -maximizeButton false -minimizeButton false sc_pRig_gui;
  5. columnLayout;
  6.  
  7. rowColumnLayout -numberOfColumns 3
  8. -columnWidth 1 5
  9. -columnWidth 2 215
  10. -columnWidth 3 5;
  11. button -vis 0;
  12. textFieldGrp -l "Number of Emitters: " -cw2 100 110 -tx 1 numOfEmits;
  13. button -vis 0;
  14.  
  15. button -vis 0;
  16. textFieldGrp -l "Rig Type: " -cw2 100 50 rigType;
  17. button -vis 0;
  18. setParent..;
  19.  
  20.  
  21. //rowColumnLayout -numberOfColumns 3
  22. // -columnWidth 1 45
  23. // -columnWidth 2 175
  24. // -columnWidth 3 5;
  25. //button -vis 0;
  26. //string $selectJointGroup = `optionMenu -label "JointGroups:" -changeCommand "#1"`;
  27. //menuItem -label "Select...";
  28. //menuItem -label "LeftHandFingers";
  29. //menuItem -label "RightHandFingers";
  30. //menuItem -label "LeftIndexFinger";
  31. //menuItem -label "RightIndexFinger";
  32. //setParent..;
  33.  
  34. rowColumnLayout -numberOfColumns 7
  35. -columnWidth 1 5
  36. -columnWidth 2 70
  37. -columnWidth 3 5
  38. -columnWidth 4 70
  39. -columnWidth 5 5
  40. -columnWidth 6 70
  41. -columnWidth 7 5;
  42. button -vis 0;
  43. button -l "Refresh" -c sc_emitterPanal;
  44. button -vis 0;
  45. button -l "Create" -c sc_pRiggerCreate;
  46. button -vis 0;
  47. button -l "Set" -c sc_pRigNewPos;
  48. button -vis 0;
  49. setParent..;
  50.  
  51. showWindow sc_pRig_gui;
  52. }
  53.  
  54.  
  55. proc sc_pRiggerCreate()
  56.  
  57. //proc for the initial creation of the rig, taking the UI and implementing, shape is set at square.
  58. {
  59.  
  60. //counter is based upon, the UI field "numOfEmits" where the user decideds how many to rig.
  61. int $counter = (`textFieldGrp -q -tx numOfEmits`);
  62.  
  63. //not sure if this int is needed.
  64. int $cubeSubCounter = $counter + 1;
  65.  
  66.  
  67. //if the input contained in the $counter var. is greater than 0 then create the root,
  68. //rename it, contain it and move it to the 0 0 0 coord's and perform the while loop.
  69. if ($counter>0)
  70.  
  71. {
  72.  
  73. polyCube -n "pRigRoot";
  74. move -r -os -wd 0 0 0 ;
  75. string $pRigRoot[] = `ls -sl`;
  76.  
  77. int $vertCount = $counter;
  78.  
  79. spaceLocator -n "locGrouper";
  80. group -n pSet "locGrouper";
  81. string $pSet[] = `ls -sl`;
  82. print $pSet;
  83. select -cl;
  84. select locGrouper;
  85. delete "locGrouper";
  86. int $pRigRootCheck = `objExists "root"`;
  87.  
  88.  
  89.  
  90. //if the root group exists then move the new root to the group.
  91. if($pRigRootCheck == 0)
  92. {
  93. spaceLocator -n "locGrouper";
  94. select -cl;
  95. group -n "root" "locGrouper";
  96. delete "locGrouper";
  97. }
  98.  
  99. // while the counter is greater than 0, create a locator, emitter, and particals,
  100. //linking the partical to the emitter, and containing each in a var.
  101. //lastly subtracting 1 from the counter
  102. while ($counter>0)
  103.  
  104. {
  105.  
  106. //locator creation
  107. spaceLocator;
  108. rename pRigLoc;
  109. scale -r 1 1 1;
  110. string $pRigLoc[] = (`ls -sl`);
  111.  
  112.  
  113.  
  114. //emitter creation
  115. 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
  116. -mxd 0 -mnd 0 -dx 1 -dy 0 -dz 0 -sp 0 ;
  117. rename pRigEmit;
  118. move -r -os -wd 0 0 0 ;
  119. string $pRigEmit[] = (`ls -sl`);
  120.  
  121.  
  122. //partical creation
  123.  
  124.  
  125.  
  126. particle;
  127. rename pRigPart;
  128. string $pRigPart[] = (`ls -sl`);
  129.  
  130. //dynamic connection for the emiter and partical
  131. connectDynamic -em $pRigEmit $pRigPart;
  132.  
  133. //parent constraints for the loc, emit, part and all parented to the root.
  134. select $pRigLoc;
  135. select -add $pRigEmit;
  136. parentConstraint -mo -weight 1;
  137. select -r $pRigEmit;
  138. select $pRigLoc;
  139. select -add $pRigPart;
  140.  
  141. parentConstraint -mo -weight 1;
  142. select $pRigRoot;
  143. select -add $pRigLoc;
  144. doCreateParentConstraintArgList 1 { "1","0","0","0","0","0","0","1","","1" };
  145. parentConstraint -mo -weight 1;
  146.  
  147.  
  148.  
  149. parent $pRigEmit $pRigLoc;
  150. parent $pRigPart $pRigLoc;
  151. parent $pRigLoc $pSet;
  152. //parent $pRigRoot $pSet;
  153.  
  154. //counter for the while loop
  155. $counter = ($counter-1);
  156.  
  157. }
  158.  
  159. }
  160. }
  161. //sc_pRiggerCreate()
  162.  
  163. proc sc_pRigNewPos()
  164. {
  165. //sceneTotals
  166. //pSets
  167. select "pSet*";
  168. string $pSetSceneArray[] = `ls -sl`;
  169. int $pSetSceneCount = size($pSetSceneArray);
  170. int $pSetCounter = 0;
  171. select -cl;
  172. //pc's
  173. select "pRigLoc_parentConstraint*";
  174. string $pLocSceneArray[] = `ls -sl`;
  175. int $pLocSceneCount = size($pLocSceneArray);
  176. int $locCounter = 1;
  177. select -cl;
  178. //COUNTING HOUSE
  179. //print "\nCOUNTING HOUSE\n";
  180. //print "~~~~~~~~~~~~~~\n";
  181. //print "Total pSets: ";
  182. //print $pSetSceneCount;
  183. //print "\nTotal Constraints: ";
  184. //print $pLocSceneCount;
  185. //print "\n\npSets:\n";
  186. //print "~~~~~~\n";
  187. //print $pSetSceneArray;
  188. //print "\nConstraints: \n";
  189. //print "~~~~~~~~~\n";
  190. //print $pLocSceneArray;
  191. //print "\n";
  192.  
  193. for ($each in $pSetSceneArray)
  194. {
  195. if ($pSetCounter == 0)
  196. {
  197. string $pSetSel = "pSet";
  198. //print $pSetSel;
  199. //print "\n";
  200. string $pSetRoot = ($pSetSel + "|pRigRoot");
  201. //print $pSetRoot;
  202. //print $pSetCounter;
  203. //print "\nfirst pSet selected\n";
  204. $pSetCounter = $pSetCounter + 1;
  205. select $pSetSel;
  206. select -hi;
  207. string $subpSetArray[] = `ls -sl "pRigLoc_parentConstraint*"`;
  208. //print $subpSetArray;
  209. //print "\n";
  210. for ($each in $subpSetArray)
  211. {
  212. string $child = ("pRigLoc_parentConstraint" + $locCounter);
  213. parentConstraint -e -maintainOffset $pSetRoot $child;
  214. $locCounter = $locCounter + 1;
  215. }
  216.  
  217. }
  218. else
  219. {
  220. string $pSetSel = ("pSet" + $pSetCounter);
  221. //print $pSetSel;
  222. //print "\n";
  223. string $pSetRoot = ($pSetSel + "|pRigRoot");
  224. //print $pSetRoot;
  225. //print $pSetCounter;
  226. //print "\nother pSets selected\n";
  227. $pSetCounter = $pSetCounter + 1;
  228. select $pSetSel;
  229. select -hi;
  230. string $subpSetArray[] = `ls -sl "pRigLoc_parentConstraint*"`;
  231. for ($each in $subpSetArray)
  232. {
  233. string $child = ("pRigLoc_parentConstraint" + $locCounter);
  234. parentConstraint -e -maintainOffset $pSetRoot $child;
  235. $locCounter = $locCounter + 1;
  236. }
  237. }
  238. select -cl;
  239. }
  240.  
  241. }
  242.  
  243. proc sc_emitterPanal()
  244. {
  245. if (`window -exists "sc_emitter"`) deleteUI "sc_emitter";
  246. window -w 300 -t "Emitter" -maximizeButton false -minimizeButton false sc_emitter;
  247. columnLayout -adj 1;
  248.  
  249. rowColumnLayout -numberOfColumns 3
  250. -columnWidth 1 100;
  251.  
  252.  
  253. //button -l "Refresh";
  254.  
  255.  
  256. setParent..;
  257.  
  258. select "pSet*";
  259. string $sel[] = `ls -sl`;
  260. int $pSetCount = size($sel);
  261. int $pSetArray = $pSetCount - 1;
  262.  
  263. for ($each in $sel)
  264. {
  265. rowColumnLayout -numberOfColumns 3
  266. -columnWidth 1 100
  267. -columnWidth 2 1;
  268. checkBoxGrp -cw2 50 65 -l $each $each;
  269. setParent..;
  270. }
  271. rowColumnLayout -numberOfColumns 3
  272. -columnWidth 1 100
  273. -columnWidth 2 1;
  274. checkBoxGrp -l "All: " -cw2 50 60;
  275. setParent..;
  276. //string $query = (`checkBoxGrp -q -v1 pSet2`);
  277.  
  278.  
  279. rowColumnLayout -numberOfColumns 1
  280. -columnWidth 1 100;
  281. //button -c sc_emitterPanal;
  282. select -cl;
  283. showWindow sc_emitter;
  284. }
  285.  
  286. sc_pRigger_GUI()
Add Comment
Please, Sign In to add comment