I don't cleary understand the 2. what I imagine here is that I would have a 
member timer , and on compute() calls I will verify if the timer is >= 1 if 
it is I reset it and perform the calculations if it's not I return 
MS::kSuccess and wait for the other computes() ... 
I can see this go wrong for a misc of reasons , I investigated 
MEventMessage class and printed the list of events, and in there , there is 
this event : 
// DragRelease // , 
and it's a good find because the problem is actually this dragging that 
users do , changing numeric attr values and such only calls compute() one 
time, 
the user dragging/moving a shape calls it 10 more times.. however I don't 
know how to do good use of this callback event or if there is a better 
option , how come It's not a explicit feature of MPxNode ? ...

Le dimanche 4 mars 2018 07:31:22 UTC, Marcus Ottosson a écrit :
>
> If there isn’t functionality for this natively, which I’d think not due to 
> how it probably wouldn’t work that well with playback, then there is at 
> least two things that I’d try.
>
>    1. Add a live boolean to your node. When False, then you could bypass 
>    updating of the plug. That way, it’d be up to the user to decide whether 
> to 
>    recieve updates directly, or on demand. It isn’t quite as nice as an 
>    update *button*, but nearly. And with a little logic, you could 
>    possibly set it up to automatically False itself when turned into True. 
>    2. On update, start or reset a timer. A timer of e.g. 1 second could, 
>    once triggered, cause the plug to update. That way, during playback or 
>    general interaction, the only overhead is that of creating or restarting 
> an 
>    existing timer. Then, once the user has let go or Maya is idle, the timer 
>    would trigger, causing your mesh to update. 
>
> (2) wouldn’t play nicely with playback, as it would just constantly keep 
> resetting itself. However, again with a little logic, it’s possible you 
> could have the timer not reset when the change is coming from playback, as 
> opposed to an attribute change or something from any context. (1) I’ve 
> worked with before on the artist side and has worked well, though it’s been 
> for e.g. whether or not to use multi-threading or whether to enable some 
> effect like vertex colors. I’d expect it would work similarly with what 
> you’ve got in mind.
> ​
>
> On 4 March 2018 at 00:02, justin hidair <[email protected] <javascript:>
> > wrote:
>
>>
>> Let's say I have a Node which has an input mesh and an output mesh , 
>> everytime I move the input mesh , while I move it, compute() is called 
>> probably 15 times and the output is updated also 15 times,
>> That's great and all but what If I don't want continuous update ? 
>>
>> what if I want to move the input mesh from A to B , and only when it's at 
>> B, and I stop moving it, output will update ( so 1 call to compute() )
>> is there a way to do that ? 
>> is the time between the total change of the input and the call to 
>> compute() as a name or a concept in the API ?
>> See this is important , because it allows to reduce overhead 
>> significantly , increase performance on complex calculations ...Etc.
>>
>> -- 
>> 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/234585c5-6c53-45d6-bb7d-9909ae263cd0%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/python_inside_maya/234585c5-6c53-45d6-bb7d-9909ae263cd0%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/de4cf9e5-3bdb-44f6-918b-ba00d4038a90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to