Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import maya.cmds as cmds
- import random
- class CloudGenerator(object):
- def __init__(self):
- print "objeto creado"
- def Make_Clouds(self,numero):
- #creamos Locator y grupo
- locator = cmds.spaceLocator(name="Locator_Nubes")
- grupo = cmds.group(em=True, name="Nubes")
- for i in xrange(numero):
- #creamos esfera
- ph = cmds.polySphere(r = .2, sa = 20, sh = 20, n = "Cloud001")[0]
- #Cambiamos posicion
- xValue = random.randrange(0, 5)
- yValue = random.randrange(0, 5)
- zValue = random.randrange(0, 5)
- cmds.setAttr(ph +".translate", xValue, yValue, zValue, type="double3")
- #cambiamos rotacion
- xRotation = random.randrange(0, 360)
- yRotation = random.randrange(0, 360)
- zRotation = random.randrange(0, 360)
- cmds.rotate(xRotation,yRotation,zRotation,ph)
- #cambiamos tamaƱo
- xSize = random.randrange(1,5)
- ySize = random.randrange(1,5)
- zSize = random.randrange(1,5)
- cmds.scale(xSize,ySize,zSize,ph)
- #ubicamos el locator con el ultim objeto creado
- cmds.delete(cmds.parentConstraint(ph,locator,w=1,mo=0))
- #metemos el objeto al grupo
- cmds.parent(ph,grupo)
- #ponemos constraint al grupo con el locator
- cmds.parentConstraint(locator, grupo,w = 1, mo=0)
- def Replace_clouds(self):
- print "ya"
- test = CloudGenerator()
- test.Make_Clouds(5)
- test.Replace_clouds()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement