Advertisement
sacredgeometry

pr_Spawner

May 22nd, 2011
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.72 KB | None | 0 0
  1. #--------------------------------------------------------------------------------------
  2. # PARTICLE SPAWNER: Creates the pSets of emitters, particals and geometry.
  3. # ( Brian Williams (Translator) / Scott Cormier (Creator) ) 2011
  4. #--------------------------------------------------------------------------------------
  5. #
  6. #--------------------------------------------------------------------------------------
  7. # To-Do List
  8. #--------------------------------------------------------------------------------------
  9. """
  10. - Use the inputted name as the instantiated class name when making new rigs, this way you can have multiple sequences...populate
  11. a list of the sets with a loop then group them so that there is a hierachy.
  12.  
  13. -Encapsualte into this one file and reference it in another file for easy reading.
  14.  
  15. """
  16. #--------------------------------------------------------------------------------------
  17. # Importing
  18. #--------------------------------------------------------------------------------------
  19. """
  20. from pymel.core import *
  21. import maya.cmds as mc
  22. """
  23. #--------------------------------------------------------------------------------------
  24.  
  25. class ParticleSpawner():
  26.    
  27.     cntSet = 1
  28.     group( em=True, name='Root' )
  29.        
  30.     def makeEmitters(self, emitAmt = 0, placer = 0):
  31.    
  32.         for i in range(0,emitAmt,1):
  33.             select(cl=True)
  34.             lpIndex = i+1
  35.             emitter(n='emit_' + str(self.cntSet) + '_' + str(lpIndex))
  36.             particle(n='part_'  + str(self.cntSet) + '_' + str(lpIndex))
  37.             connectDynamic('part_' + str(self.cntSet) + '_' + str(lpIndex), em='emit_' + str(self.cntSet) + '_' + str(lpIndex))
  38.             spaceLocator(n='pLoc_'  + str(self.cntSet) + '_' + str(lpIndex))
  39.             parent('emit_' + str(self.cntSet) + '_' + str(lpIndex),'pLoc_'  + str(self.cntSet) + '_' + str(lpIndex))
  40.             parent('part_' + str(self.cntSet) + '_' + str(lpIndex),'pLoc_'  + str(self.cntSet) + '_' + str(lpIndex))
  41.                    
  42.         polyCube(n='pRigRoot_' + str(self.cntSet))    
  43.         select('pLoc_'+ str(self.cntSet) + '_*', 'pRigRoot_' + str(self.cntSet))
  44.         group(n='pSet_' + str(self.cntSet))
  45.        
  46.     def popSet(self,emitAmt):
  47.         self.makeEmitters(emitAmt)
  48.         parent('pSet_' + str(self.cntSet), 'Root')
  49.         self.cntSet += 1
  50.  
  51. #--------------------------------------------------------------------------------------
  52. # Run Script: mc.file( f=True, new=True )
  53. #--------------------------------------------------------------------------------------
  54.  
  55. #Run This and Above class first
  56. rigTest = ParticleSpawner()
  57. rigTest.cntSet = 1
  58.  
  59. # Run this for every time you want a new pSet, the argument controls how many emitters are in each pSet
  60. rigTest.popSet(2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement