Python: Maya Particles |
Introduction
This challenge will enable you to explore several basic concepts of python programming: Maya ParticlesTo successfully complete this challenge you will write two python scripts. The first script will contain at least 5 procedures. Each procedure will produce a list of "xyz" values that will control the positions of the nParticles so that they form a specific shape. For example, the following python script implements a procedure called cubic().
#------------------------- gen_points.py --------------------
import random
import math
def cubic(num_points, side):
data = []
count = 0
half_side = side/2
while count < num_points:
x = random.uniform(-half_side, half_side)
y = random.uniform(-half_side, half_side)
z = random.uniform(-half_side, half_side)
data.append( (x,y,z) )
count += 1
return data
#------------------------------------------------------------
You are expected to implement the following procedures, spherical(num_points, radius)
cylindrical(num_points, radius, height)
box(num_points, width, length, height)
cone(num_points, radius, height)
|
|
The second python script will use functions defined in the first script. For example, the next code snippet implements a procedure called cubicCloud().
#-------------------- maya_particles.py -----------------------
import maya.cmds as cmds
import gen_points
def cubicCloud(num_particles, side):
# Use the gen_points module to create a list of points
data = gen_points.cubic(num_particles, side)
# Use Maya's python command to add the cubic particle
# cloud to the viewport. Capture and return the name of
# the particle system.
return cmds.nParticle(p=data)[0]
#------------------------------------------------------------
You are expected to implement and add following procedures to the maya_particles script, sphericalCloud(num_points, radius)
cylindricalCloud(num_points, radius, height)
boxCloud(num_points, width, length, height)
conicalCloud(num_points, radius, height)
|
What is Expected?
The technical breakdown on your web page should show the following.
|
GradingThe following categories will be used for grading your work. |
|