Hi Nil, AFAIK the Persistence Service was intentionally designed to be not included in a scene file as it is indeed something similar to QSettings. If you want to store settings in your scene file, you can do so by using properties.
Note that there are several property lists. The lists you see by default in the Properties View are the general DataNODE properties. There are also specialized DataNODE properties per render window. Properties in these specialized lists are used instead of the general ones in the according render window if present. DataNODE properties are usually dedicated to the appearance of data. There is also a BASEData property list for each data item in your scene. This list is dedicated to meta data like the original path of an image, DICOM tags, and so on. In the Preferences you can switch on the “Developer Mode” for the Properties, which enables you to switch between the lists in the view to get an idea of all the lists. Best, Stefan From: Nil Goyette [mailto:nil.goye...@imeka.ca] Sent: Montag, 28. November 2016 21:33 To: mitk-users@lists.sourceforge.net Subject: Re: [mitk-users] Scene properties Hi all, I was testing the persistence system again, but on MITK 2016.03 this time. I did fall on all the same traps so this old conversation helped me. I have some new questions though. Right now, the persistence system simply creates PersistentData.xml in AppData/.../#_MitkPersistence, with '#' starting at 45 and going up. * The first file (45) is never used after. It's never found by MITK. On the second run, it creates '46' and the data are read on all the next runs. But the real problem comes next. * Why? I don't understand the point of saving a xml file in AppData. Isn't this a new QSettings? I thought the data was going to be saved in the scene. In fact, I searched in your code using 'git grep' and I can't find where PersistenceService is used when saving a scene. I can see it is used in PersistenceService::Save() and PersistenceService::Load() when a filename is passed, but afaik it never happens. GetDataNodes() could be called by the scene-saving code but it's not. Knowing all this, I'm less surprised that BeforePropertyListReplaced() was never called! Can someone please confirm that the persistence system is working when saving and loading a scene? And if it does, can you please tell me how!?! Where in SceneSerialization does it happens? Thank you for your time. Nil Le 2016-04-06 à 12:22, Nil Goyette a écrit : Ah, thank you, mitk::PersistenceService::LoadModule() was the missing piece of information. The service is not a nullptr anymore and I can get the properties associated with an ID and they are kept during the lifetime of the application. So, I added the call to AddPropertyListReplacedObserver(this) but BeforePropertyListReplaced() and AfterPropertyListReplaced() are never called. I thought they would be called when the user saves and load a scene. Did I miss something? Le 2016-04-06 05:49, Kolb, Christoph a écrit : I have just tested the PersistenceService in a Plugin and got the same error message: "The calling module probably misses a US_MODULE_NAME compile definition and/or a call to US_INITIALIZE_MODULE in one of its source files." It worked after I added a dependency to MitkPersistence and called mitk::PersistenceService::LoadModule() in the constructor of my pluginView. I also needed to put US_INITIALIZE_MODULE in the source. Regards Christoph
------------------------------------------------------------------------------
_______________________________________________ mitk-users mailing list mitk-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mitk-users