Perhaps I am not being clear. *setDependentsDirty* could be called a bunch of times, with different plugs (distance and amount) and different indices before compute is ever called. That would mean the code in *compute* would only have cached the results of the last call.
I understand the dependency graph evaluation to be: Step 1: propagate dirty flags from changed attribute(s) to *all* dependent destinations. One attribute change can cause numerous downstream attributes (possibly through different array indices) to dirty. Step 2: determine which, and compute now-dirty attributes needed to be evaluated (some attributes may have been dirtied but don't affect drawing or any open attribute editors, for example). This implies that, if you are caching info from calls to *setDependentsDirty*, you need to cache all the calls, not just the last one. In other words, I think "you only need to worry about one attribute change at a time" is incorrect. You only need to worry about one attribute *computation* at a time but, if you are storing information from *setDependentsDirty*, you can't just cache the last call. What happens in your code if BOTH distance and amount changed? What if they are coming from different indices? What am I missing here? thanks, Rob On Sat, Mar 17, 2018 at 12:59 PM, justin hidair <[email protected]> wrote: > Correct . However it is expensive(for a dev) to do it that way when you > know you can just use *one unsigned int *that get assigned in every call > of *setdepdirty() * , and it goes also with the fact that you only have > to worry about *one attribute change at a time *, and it is not necessary > to store every indices like that , the use of > MArrayDataHandle::jumpToArrayElement() > with MArrayDataHandle::elementIndex() is a recommended combo to iterate > over the array of compounds/element even in the documentation , and you > will need to call MDataBlock::inputArrayValue() once you are in compute > anyway so … this *m_element_index* thing is just here so I know what > element is tingling so that I don’t have to do expensive complete > calculations, it’s lazy evaluation if you want > > > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFLHEW3eMe3eG_roRj3EbJu3NAruwYynRwRPnOSECYtAGCoR4g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
