(...and a long one)
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.
"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();
outArrayHandle = data.outputValue(theArray);
Related: does anyone know how Maya Cloth (or some other similar node) stores its results in memory (i.e. not the disc cache).