<div dir="ltr"><div>Thanks for the report.  That vtkTransform code was actually written before ModifiedEvent even existed.</div><div dir="ltr"><br></div><div>I've submitted a patch: <a href="https://gitlab.kitware.com/vtk/vtk/merge_requests/4680">https://gitlab.kitware.com/vtk/vtk/merge_requests/4680</a></div><div><br></div><div>Be careful with how you use ModifiedEvent. The events in vtkCommand.h are handled synchronously, so if you have a callback bound to the ModifiedEvent for an object, then any code that modifies that object has to sit and wait until your callback finished running.</div><div><br></div><div>The Modified() method was initially designed to do only one thing: change the object's timestamp.  VTK was designed from the ground up to be a pull pipeline: the pipeline is meant to be driven by either user interaction (mouse, keyboard, I/O) or by timer events (e.g. for animation); the pipeline checks timestamps to see what has changed since the last time it executed.  Driving actions from ModifiedEvent goes against this and will lead to less efficient code, and can cause instability depending on how your ModifiedEvent callback changes the pipeline state.</div><div><br></div><div>I recommend using ModifiedEvent only for logging, debugging, or simple bookkeeping.  I'll stop ranting now :)</div><div><br></div><div>Thanks again for the bug report,</div><div><br></div><div> - David</div><div><br></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Sep 18, 2018 at 9:12 AM Anka Kochanowska <<a href="mailto:anka@bic.mni.mcgill.ca">anka@bic.mni.mcgill.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">void</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkTransform</span>::<span style="font-weight:600;color:rgb(0,103,124)">Identity</span>()</pre>
<pre style="margin-top:0px;margin-bottom:0px">{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(128,128,0)">this</span>-><span style="color:rgb(128,0,0)">Concatenation</span>-><span style="color:rgb(0,103,124)">Identity</span>();</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(128,128,0)">this</span>-><span style="font-style:italic;color:rgb(0,103,124)">Modified</span>();</pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">support</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">for</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">legacy</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">hack</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">in</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">InternalUpdate</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(128,128,0)">if</span><span style="color:rgb(192,192,192)"> </span>(<span style="color:rgb(128,128,0)">this</span>-><span style="color:rgb(128,0,0)">Matrix</span>-><span style="font-style:italic;color:rgb(0,103,124)">GetMTime</span>()<span style="color:rgb(192,192,192)"> </span>><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">this</span>-><span style="color:rgb(128,0,0)">MatrixUpdateMTime</span>)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">  </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">this</span>-><span style="color:rgb(128,0,0)">Matrix</span>-><span style="color:rgb(0,103,124)">Identity</span>();</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">  </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px">}</pre>
<pre style="margin-top:0px;margin-bottom:0px">Modified() is called before the matrix is reset to Identity.</pre><pre style="margin-top:0px;margin-bottom:0px">Should it be called at the end?</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">My code reacts to Modified event and promptly uses matrix that was not yet changed.</pre><pre style="margin-top:0px;margin-bottom:0px">I patch it by calling transform<span style="font-family:Arial,Helvetica,sans-serif">-></span><span style="font-family:Arial,Helvetica,sans-serif;font-style:italic;color:rgb(0,103,124)">Modified</span><span style="font-family:Arial,Helvetica,sans-serif">() after</span> <span style="font-family:Arial,Helvetica,sans-serif;color:rgb(9,46,100)">transform</span><span style="font-family:Arial,Helvetica,sans-serif">-></span><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(0,103,124)">Identity</span><span style="font-family:Arial,Helvetica,sans-serif">();</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:Arial,Helvetica,sans-serif"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><font face="Arial, Helvetica, sans-serif">Anka</font></pre></div></div></div></div></div>
</blockquote></div></div>