cwisbg

#explosion

Jun 8th, 2014
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.75 KB | None | 0 0
  1. #explosion
  2. from pymel.core import *
  3. import random as r
  4. import time
  5.  
  6. def randoR(aList):
  7.     for s in aList:
  8.         rY = r.randint(0,360)
  9.         rX = r.randint(0,360)
  10.         rZ = r.randint(0,360)
  11.         rotate(s,rX,rY,rZ)
  12. def randoT(aList,dis):
  13.     for s in aList:
  14.         rY = r.randint(0,int(dis))
  15.         move(s[0],0,rY,0,r=1,os=1,wd=1)
  16.        
  17.  
  18. def selector():
  19.     sl = selected()
  20.     print "_______"
  21.     print sl
  22.    
  23. def cleaner():
  24.     explosionGrp = ls("explosion_grp")
  25.     if explosionGrp:
  26.         delete(explosionGrp)
  27.     explosionGrp = group(n="explosion_grp",em=1)
  28.     return explosionGrp
  29. def exposion():
  30.     start = time.clock()
  31.     grp = cleaner()
  32.     amnt = exAmnt.getText()
  33.     dis = disAmnt.getText()
  34.     aList = []
  35.     for a in range(0,int(amnt)):
  36.         print a
  37.         c = duplicate("creeper")#polyCube(n="explosionPiece_{0}".format(a),ch=0)
  38.         parent(c,grp)
  39.         aList.append(c)
  40.     randoR(aList)
  41.     randoT(aList,dis)
  42.     print "Explodeing: ",amnt
  43.     elapsed = (time.clock() - start)
  44.     print amnt," took:", elapsed
  45.    
  46.  
  47.  
  48. buttonWidth = 50  
  49. win = window(title= "Gui", s=0)
  50. mainLayout = rowColumnLayout(nc=1)
  51.  
  52. exBtn = button(l="Explode!", command=Callback(exposion),w=buttonWidth)
  53.  
  54. exAmntLayout = rowColumnLayout(nc=1)
  55. text(l="Amnt",p=exAmntLayout,w=50)
  56. exAmnt = textField(tx = "50",p=exAmntLayout,w=buttonWidth)
  57. #stopBtn = button(l="Clean", command=Callback(cleaner),w=buttonWidth)
  58. exAmntLayout0 = rowColumnLayout(nc=1)
  59. text(l="Distance",p=exAmntLayout0)
  60.  
  61. exAmntLayout2 = rowColumnLayout(nc=4,p=exAmntLayout0)
  62. text(l="min",p=exAmntLayout2)
  63. disAmnt = textField(tx = "20",p=exAmntLayout2,w=50)
  64. text(l="max",p=exAmntLayout2)
  65. disAmnt = textField(tx = "20",p=exAmntLayout2,w=50)
  66. win.show()
Advertisement
Add Comment
Please, Sign In to add comment