Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #explosion
- from pymel.core import *
- import random as r
- import time
- def randoR(aList):
- for s in aList:
- rY = r.randint(0,360)
- rX = r.randint(0,360)
- rZ = r.randint(0,360)
- rotate(s,rX,rY,rZ)
- def randoT(aList,dis):
- for s in aList:
- rY = r.randint(0,int(dis))
- move(s[0],0,rY,0,r=1,os=1,wd=1)
- def selector():
- sl = selected()
- print "_______"
- print sl
- def cleaner():
- explosionGrp = ls("explosion_grp")
- if explosionGrp:
- delete(explosionGrp)
- explosionGrp = group(n="explosion_grp",em=1)
- return explosionGrp
- def exposion():
- start = time.clock()
- grp = cleaner()
- amnt = exAmnt.getText()
- dis = disAmnt.getText()
- aList = []
- for a in range(0,int(amnt)):
- print a
- c = duplicate("creeper")#polyCube(n="explosionPiece_{0}".format(a),ch=0)
- parent(c,grp)
- aList.append(c)
- randoR(aList)
- randoT(aList,dis)
- print "Explodeing: ",amnt
- elapsed = (time.clock() - start)
- print amnt," took:", elapsed
- buttonWidth = 50
- win = window(title= "Gui", s=0)
- mainLayout = rowColumnLayout(nc=1)
- exBtn = button(l="Explode!", command=Callback(exposion),w=buttonWidth)
- exAmntLayout = rowColumnLayout(nc=1)
- text(l="Amnt",p=exAmntLayout,w=50)
- exAmnt = textField(tx = "50",p=exAmntLayout,w=buttonWidth)
- #stopBtn = button(l="Clean", command=Callback(cleaner),w=buttonWidth)
- exAmntLayout0 = rowColumnLayout(nc=1)
- text(l="Distance",p=exAmntLayout0)
- exAmntLayout2 = rowColumnLayout(nc=4,p=exAmntLayout0)
- text(l="min",p=exAmntLayout2)
- disAmnt = textField(tx = "20",p=exAmntLayout2,w=50)
- text(l="max",p=exAmntLayout2)
- disAmnt = textField(tx = "20",p=exAmntLayout2,w=50)
- win.show()
Advertisement
Add Comment
Please, Sign In to add comment