Hey, i'm having a problem where, even though i'm assigning each
particle it's own individual indexPP, i'm still not able to bring in
multiple instances. It will bring in the first istance in the corrent
position but not the second. I'm at a loss as to why though, my code
seems correct ...
# Index PP
mc.addAttr (longName = 'indexPP0', dt= 'doubleArray')
mc.addAttr (longName = 'indexPP', dt= 'doubleArray')
mc.setAttr ('Wall_TestShape.indexPP', keyable=True)
# Main loop, loop through selected objects and assign particle
# at the center of each object. Also freezing transformations.
for i in range (0, numObjects, 1):
stringObject = objectList [i]
mc.select (stringObject)
# Freeze Transformations and center pivot
mc.makeIdentity (apply=True, translate=True, rotate=True, scale=True,
normal=False)
mc.xform (cp=True, ztp=True)
# Get particles position
floatParticlePosition = mc.xform (stringObject, query=True,
rotatePivot=True)
# Object Index
floatObjectIndex = i
# Query bounding Box positions
floatBoundBoxList = mc.xform(stringObject, query=True,
worldSpace=True, boundingBox= True)
# Get absolute value of BB values
floatX = fabs(floatBoundBoxList[3] - floatBoundBoxList[0])
floatY = fabs(floatBoundBoxList[4] - floatBoundBoxList[1])
floatZ = fabs(floatBoundBoxList[5] - floatBoundBoxList[2])
# Need to add a vector component.
floatVector = om.MFloatVector(floatX, floatY, floatZ)
# Get total length of vector
vectorMag = sqrt((floatVector[0]*floatVector[0])+(floatVector[1]
*floatVector[1])+(floatVector[2]*floatVector[2]))
# Emit particle to object postion with attributes.
mc.emit (object = 'Wall_Test', position = (floatParticlePosition[0],
floatParticlePosition[1], floatParticlePosition[2]), at= 'indexPP',
floatValue= floatObjectIndex)
mc.dynExpression ('Wall_Test', s= " mass = 0.49; ", c=True)
# Save initial sate of particles
mc.saveInitialState('Wall_Test')
Any help any one can give will be greatly appreciated. This problem is
really beginning to bug me.
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---