FORUMS: list search recent posts

Controller for expressions

COW Forums : Autodesk Maya

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
John Pilgrim
Controller for expressions
on Feb 10, 2010 at 9:31:22 pm

Hi all,
This is my first post in the Maya forum. (I usually frequent the After Effects, Apple Color and Final Cut Pro fora.)

I'm setting up a rigid body simulation, and want to more easily control some parameters of my rigid bodies and fields. Specifically, I have 11 objects and 11 radial fields, each paired one to one in Dynamics Relationships.

I know how to add expressions, but would like to somehow add a new "master variable" (or whatever the proper name is) for each of the parameters and then quickly add expressions from the object or field to the master variable, so that I can change the value of the specific parameter for all 11 objects or fields.

For example, object 1 has a parameter "rigidBody1.staticFriction" and object 2 has "rigidBody2.staticFriction".

Question 1: How do I define a new independent variable, such as MASTER.staticFriction (or MASTER_staticFriction if that's easier)?

Question 2: How/where do I most easily enter the following expression?

rigidBody1.staticFriction=MASTER.staticFriction;
rigidBody2.staticFriction=MASTER.staticFriction;
rigidBody3.staticFriction=MASTER.staticFriction;
rigidBody4.staticFriction=MASTER.staticFriction;
rigidBody5.staticFriction=MASTER.staticFriction;
rigidBody6.staticFriction=MASTER.staticFriction;
...
rigidBody10.staticFriction=MASTER.staticFriction;
rigidBody11.staticFriction=MASTER.staticFriction;

Thanks in advance!
John
Maya 2010, MacOS
SF,CA



Return to posts index

Michiel Duvekot
Re: Controller for expressions
on Feb 11, 2010 at 1:26:07 am

I wouldn't use expressions but simply connect the attributes. This bit of MEL will connect the staticFricition attribute of a node called rigidBodyMaster to all other rigid bodies:

string $rigidBodies[] = `ls -typ rigidBody`;
$rigidBodies= stringArrayRemove({"rigidBodyMaster"}, $rigidBodies);
string $tmp;
for ($tmp in $rigidBodies) {
connectAttr "rigidBodyMaster.staticFriction" ($tmp + ".staticFriction" );
}




Michiel
http://www.thnkr.com


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]