PDA

View Full Version : API: Internal data attribute question


jdj
08-29-2003, 03:58 PM
This is a hairy question... :)
(...and a long one)

Anyway:

I have created a DG node in the Maya 4.0 API which creates polygonal hair guided from a few nurbs curves.

So far so good.

Now I want to add dynamic attributes to this hair, and I am a little unsure of which approach to go for.

The standard Maya dynamics is disqualified and I am left with the option to do a home brewed version.

So what I have is an internal data structure where each strand is a MPoint array describing the points of the (in most cases imaginary) curve that the strand follows.

And then the problem:

I want to animate this MPoint structure. I have worked out the physics of it all, but I am unsure of how to realize this in a Maya-proper way.

The documentation tells me that the worst of all evil things I can do to Maya in my DG node is to sneak away information inside my DG node:

"A node must not know anything outside of its attributes and plugs" etc. etc.

...and...

"If any other data is required then it should be made into an attribute. Even if it is only temporarily cached information to speed up computation, it could be useful as a hidden attribute"

My thought is then to connect my node to a time node and then make the current MPoint array to such an attribute. But this attribute is then used as both an input and an output... output for the current iteration and input to the next.

So my qustion is (unless any of you have a better solution to my dynamics problem); How do I correctly create & use such an attribute?

Is it as simple as reading & writing to the same attribute?
i.e. something like;

array = data.inputValue(theArray).asSomething();
...do iteration...
outArrayHandle = data.outputValue(theArray);
outArrayHandle.set(array);
outArrayHandle.setClean();

Related: does anyone know how Maya Cloth (or some other similar node) stores its results in memory (i.e. not the disc cache).

Cheers!
/ Daniel
:beer:

CGTalk Moderation
01-16-2006, 12:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.