[Smtk-developers] Resource manager question
Robert Michael O'Bara
bob.obara at kitware.com
Sat Nov 4 19:27:38 EDT 2017
Hi David,
Since we have said that a resource does not have to have an resource manager to be loaded into memory I would say that a VTK reader would simply not use one - there really is no need since the filter is not trying to maintain any type of resource tracking or linkage between resources. Now if there was a reader that would take in a resource manager state file then yes - it would create a manager.
Bob
Sent from my iPad
> On Nov 4, 2017, at 5:52 PM, Haocheng Liu <haocheng.liu at kitware.com> wrote:
>
> Hi David,
>
>> On Sat, Nov 4, 2017 at 2:17 PM, David Thompson <david.thompson at kitware.com> wrote:
>> Hi TJ (et al.),
>>
>> I have some questions about how to use the resource manager:
>>
>> Let's say I have a VTK reader class that loads SMTK model files (one which is perhaps named vtkSMTKModelReader and located in smtk/extension/paraview/server). Since a file is a resource, making the reader behave as expected as far as both VTK and SMTK will be interesting.
>>
>> 1. VTK expects the reader object to work if the filename changes. This means the same reader can read multiple resources into the resource manager. Should the previous resource be removed when the reader's filename changes? If not, there will be things in memory that aren't shown on the screen.
> I would say no...
>> 2. Now let's say the file changes on disk or someone calls Modified() on the VTK reader... should it re-read the file? If it does, how should it go about this? By deleting the previous resource and calling read() again on the resource manager? This seems like it might work for PV-based applications where there's client-server separation. But in a standalone VTK app, it could be annoying since related GUI state like a model-tree view would get reset to empty before being re-populated with a default view in a different state than before.
>>
> It should not re-read the file.
> Would it makes sense that once a file is read, then the application does not care about its state any more?
> For instance, CMB loads a file called bar.smtk. Then a user changes the filename to bar42.smtk outside CMB. CMB doesn't care until user tries to quit CMB or save current state. In the first condition, if there is no such file called bar.smtk then CMB should warn user. In the second condition, CMB would not provide the overwrite option.( Sublime uses this logic and I think it makes sense).
>> 3. Finally, there doesn't appear to be a way for the resource manager to find resources by location. If we don't do this, it will be possible to have the same file loaded into the application multiple times. That might seem like a feature at first ("But I wanted to load it twice and render different things on each copy!") until someone clicks save ("Why did it overwrite my model with an old copy!?").
>>
> I would vote against allowing user to load the same file twice or more(As long as I recall, we used to call it a bug in discrete session :) ). If the user needs to render different things, fine then the user should use two seperate resources bar and foo though they are structurally identical in SMTK world.
>> David
>> _______________________________________________
>> Smtk-developers mailing list
>> Smtk-developers at smtk.org
>> http://public.kitware.com/mailman/listinfo/smtk-developers
>
>
>
> --
> Best regards
> Haocheng
>
> Haocheng LIU
> Kitware, Inc.
> R&D Engineer
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-4421
> _______________________________________________
> Smtk-developers mailing list
> Smtk-developers at smtk.org
> http://public.kitware.com/mailman/listinfo/smtk-developers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/smtk-developers/attachments/20171104/be1c1c86/attachment.html>
More information about the Smtk-developers
mailing list