I actually prefer to do this sort of thing in Python.
Use a triple quoted string so you don't have to worry about the newlines.
myExprString = '''
if ( frame <= 2.0 ) {
rotateInitPP = << rand( rotMultMin,rotMultMax ),
rand(rotMultMin,rotMultMax), rand(rotMultMin,rotMultMax ) >>;
mass *= rand( massMultMin, massMultMax );
}
else {
vector $vel = velocity;
vector $rot = rotateInitPP;
rotatePP = <<$vel.x * $rot.x, $vel.y * $rot.y, $vel.z * $rot.z >>;
}
'''
cmds.dynExpression( particleShapeName , [creation=boolean],
[runtimeAfterDynamics=boolean], [runtimeBeforeDynamics=boolean],
string=myExprString)
If for whatever reason you need to put python variable names, you can do:
myExprString = '''
MYTARGET.ty = MYMASTER.tx;
'''
myExprString = myExprString.replace('MYTARGET',
'pSphere1').replace('MYMASTER','pCube1') #or whatever
If the chained up .replaces are too much, there are some good multi-replace
functions out there.
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---