Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pymel.core import *
- import random as r
- def grpr(name):
- g = ls(name)
- if g:
- delete(g)
- g = group(n=name,em=1)
- return g
- x = 0
- y = 0
- z = 0
- gridSizeX = 4
- gridSizeY = 4
- gridSizeZ = 2
- tmpGrp = grpr("temp_grp")
- toGrp = []
- i = 0
- for z in range(0, gridSizeZ):
- for y in range(0, gridSizeY):
- for x in range(0, gridSizeX):
- #refresh(cw=1)
- c = polyCube()[0]
- #a = annotate(c, tx=str(x)+str(y)+str(z)+"_"+str(i), p = [x, y, z])
- #setAttr(a+".displayArrow", 0)
- move(c, x, y, z)
- #parent(a, c)
- scale(c, .005,.005,.005)
- toGrp.append(c)
- i+=1
- parent(toGrp, tmpGrp)
- randomI = r.randint(0,len(toGrp)-1)
- print "Random I : ", randomI, " Group length ", len(toGrp)
- randomCube = toGrp[randomI]
- #scale(randomCube, .2,.2,.2)
- pos = randomCube.getTranslation()
- xI = pos.x + gridSizeX * pos.y + gridSizeX * gridSizeY * pos.z
- scale(toGrp[int(xI)], .3,.3,.3)
- print "Index array number: ", int(xI)," ",pos.y+1
- if pos.y < gridSizeY-1:
- xY = pos.x + gridSizeX * (pos.y+1) + gridSizeX * gridSizeY * pos.z
- scale(toGrp[int(xY)], .1,.1,.1)
- """
- i = x + width*y;
- i = x + width*y + width*height*z;
- x = i % width;
- y = (i / width)%height;
- z = i / (width*height);
- """
- select(cl=1)
Advertisement
Add Comment
Please, Sign In to add comment