So still stuck with that annoying problem =[
I found this interesting page 
(http://theorangeduck.com/page/maya-velocity-node), talking about the same 
issue, more or less. But firstly, it's not *exactly *the same, and secondly 
it uses a callback to fix it, while I'm not sure this is the only solution 
in my case.
I tried tons of different workarounds, but nothing worked at this point.

I progressed a bit, though ! I know that it's not because of the loop 
itself, just because i query the mplug value twice.
In other word, to stick to my previous example :

MDGContext ctx( MTime(10.) );
plug.getValue(oInput, ctx );
*will work*

MDGContext ctx( MTime(11.) );
plug.getValue(oInput, ctx );
*will work*

but 
MDGContext ctx1( MTime(10.) );
plug.getValue(oInput, ctx1 );
MDGContext ctx2( MTime(11.) );
plug.getValue(oInput, ctx2 );
*will put me in an infinite loop.*

Any help, suggestion or anything would be more than welcome, i'm really 
stuck with that !
Many thanks !




Le dimanche 23 octobre 2016 10:48:16 UTC-7, fruity a écrit :
>
> Hi there, 
>
> I'm working on an MPxLocatorNode, and i have to get the value of a plug at 
> a given time. I can do it, using an MContext, and it works perfectly :
> MTime t( 10. );
> MDGContext ctx( t );
> plug.getValue( oInput, ctx );
>
> However, when i'm doing it in a loop (i.e. with a dynamic time), Maya will 
> run indefinitely, even after the draw() has been done : 
> for (double i=0.; i < 2.; i += 1.)
> {
>
> MTime t( i );
> MDGContext ctx( t );
> plug.getValue( oInput, ctx );
>
> }
> // this will never stop being evaluated.
>
> I'm assuming it's because even though i'm using a MContext, a redraw of my 
> locator is triggered, somehow. Then, because this redraw is triggered, my 
> draw method gets run again, causing another redraw, and so on ? 
> But then, why it's not happening if i'm not using a loop ? And then, how 
> can i query a plug at a given time, in a loop ? Is there some hack, based 
> on a setDirty or setClean call ? Is it reliable ?
> Any help would be much appreciated, as i couldn't find lots of information 
> about it online =[
> Many thanks !
>

-- 
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/afe1a000-8e6f-4624-ad96-eaa464c90946%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to