This is the timer I had in mind.

http://doc.qt.io/qt-5/qtimer.html

It'd be able to delay a callback till later, and run it in the main thread
without special treatment. Ultimately, it'd mean updating the plug outside
of your `compute()` function, where your `compute()` is merely calling this
timer, which is connected to something capable of updating your plug.

At the end of the day, what you're asking is to aggregate multiple calls
that Maya makes to `compute()` into a single call by an arbitrary amount of
time. It isn't going to be pretty. The more robust option is probably the
boolean toggle. If you have a drag context involved, you could
automatically set the boolean toggle to `False` when entering drag, and
reset it to `True` once done. That way, you'd probably get the effect
you're looking for.



On 4 March 2018 at 14:55, justin hidair <[email protected]> wrote:

>
>
> Le dimanche 4 mars 2018 00:02:17 UTC, justin hidair a écrit :
>>
>>
>> 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].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/34ed49b6-2f80-41c3-8a32-
> e907d7509d40%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/34ed49b6-2f80-41c3-8a32-e907d7509d40%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/CAFRtmOAawKVa8E%3DOWntim%3Dro5ddFZBWdZOjh6PCtp7UXfYSjJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to