- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to make a custom MPxNode evaluate only selected elements from an array input under Evaluation Manager. The node has an index selector input that decides which array element to use.
In DG mode this can be done by overriding setDependentsDirty() and only marking the output dirty when the dirtied element matches the active index. That gives true lazy evaluation.
Under parallel mode, setDependentsDirty() is never called. Instead preEvaluation() runs, and the system always dirties the parent array plug. You can detect dirtiness in preEvaluation(), but you cannot change it. EM has already built the evaluation graph, so every element of the array input will still be pulled. As a result you must rely on attributeAffects (Which cannot capture which option is "chosen").
So upstream nodes for all array elements are evaluated even when only one is needed. You can skip computation in compute(), but you cannot stop EM from evaluating inputs.
The docs lack any examples showing such "choice" implementations, I'd note the maya "choice" node somehow achieves clean/lazy parallel eval without over-zealous input dirty propagation.
How can a devloper replicate this?
Solved! Go to Solution.