PDA

View Full Version : Compute function without output


yellowFattyBean
07-23-2012, 02:12 PM
Hi,

I have created a custom locator node where I take one input. At the moment I am running the draw function to perform the necessary calculations to draw, however as the project goes deeper, I will need to have a function which does not run as frequently as the draw, preferably the compute although I have no need for an output.

Any suggestions?

Keilun
07-23-2012, 07:32 PM
Is the data that you are computing transient? Do you need it to persist between sessions of Maya? If not, then you can:

1. Set your input attributes to internal.
2. Create a caching structure holding the results of your calculations and just store it on the node.
3. Override the setInternalValueInContext method. This is invoked whenever an internal value is touched. Make sure you return false here if you still want Maya to handle storage of the attribute value.
4. Then you can just update your internal cache whenever your attribute changes rather than every draw.

If you do need to persist then you'll want output attributes to act as storage. At least that's how I would do it.

CGTalk Moderation
07-23-2012, 07:32 PM
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.