[vtkusers] vtkTransform::Identity() where it gets wrong?

Anka Kochanowska anka at bic.mni.mcgill.ca
Tue Sep 18 12:26:28 EDT 2018


Thanks!
Anka


On Tue, Sep 18, 2018 at 12:12 PM David Gobbi <david.gobbi at gmail.com> wrote:

> Thanks for the report.  That vtkTransform code was actually written before
> ModifiedEvent even existed.
>
> I've submitted a patch:
> https://gitlab.kitware.com/vtk/vtk/merge_requests/4680
>
> 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.
>
> 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.
>
> I recommend using ModifiedEvent only for logging, debugging, or simple
> bookkeeping.  I'll stop ranting now :)
>
> Thanks again for the bug report,
>
>  - David
>
>
> On Tue, Sep 18, 2018 at 9:12 AM Anka Kochanowska <anka at bic.mni.mcgill.ca>
> wrote:
>
>> void vtkTransform::Identity()
>>
>> {
>>
>>   this->Concatenation->Identity();
>>
>>   this->Modified();
>>
>>
>>   // support for the legacy hack in InternalUpdate
>>
>>   if (this->Matrix->GetMTime() > this->MatrixUpdateMTime)
>>
>>   {
>>
>>     this->Matrix->Identity();
>>
>>   }
>>
>> }
>>
>> Modified() is called before the matrix is reset to Identity.
>>
>> Should it be called at the end?
>>
>>
>> My code reacts to Modified event and promptly uses matrix that was not yet changed.
>>
>> I patch it by calling transform->Modified() after transform->Identity();
>>
>>
>> Anka
>>
>> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180918/1b6334e1/attachment.html>


More information about the vtkusers mailing list