Re: vtkTransform::Identity() where it gets wrong?
Anka Kochanowska <[email protected]> Mon, 4 Feb 2019 12:50:19 -0500
| Newsgroups | gmane.comp.lib.vtk.user |
|---|---|
| Message-ID | <CANnbg4HFWMdNQLhwCHe+-8iBaW+br1GEUg5StU9yOJC1NGr93Q@mail.gmail.com> |
Hi! I still see the same code in vtk 8, your patch has not been applied. I am trying to follow ypur advice. Anka On Tue, Sep 18, 2018 at 12:12 PM David Gobbi <[email protected]> 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 <[email protected]> > 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 > _______________________________________________ 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://vtk.org/mailman/listinfo/vtkusers