Hi there
Just ran into a slight issue, we’ve been writing an addon for a while now, its about to have its seventh release in fact. We’d been storing custom properties on the scene, in particular a unique id for the blend file that we use to locate that file amongst potentially millions of other blend files. The uuid is quite long so its able to be used as a global uuid.
Anyway, storing this as a custom property of the scene allowed it to be saved to the blend file and read by our addon each time the file was loaded by blender. The problem with this was that this assumed just one scene when in fact there can be as many as the user wants. So I started looking into finding another more general/global location to store this property so that I would not have to search through all scenes in the blend file to find it.
I noticed another addon used the window_manager to store custom properties, so I decided to give this a try, but sadly, it appears that this doesn’t work. Its a shame since there appears to only ever be one window manager, making it ideal for a place to store the uuid of the file.
So, I just wanted to check in and ask, should one be able to save custom properties to the blend file if they are appended to the window manager? I was under the impression that as long as a datablock is subclassed from bpy.types.ID, then one can use it to save custom properties to he blend file.
Note I did use the proper method for doing this which involves updating the type of the window manager rather than just dynamically placing a new property on the current window_manager object. This is the way I managed to save the uuid to the active scene prior to experimenting.
So, my question is, in summary, should I be able to save custom properties to the blend file by extending the window_manager type? If not, where else could I store custom properties that are not part of a scene, or anything that is per scene?
My alternative is to go back to using the scene, but this feels in-elegant and requires looping through all scenes to find/set the uuid to make sure its saved, and also I’d have to handle new scenes, making sure the uuid was added to them. I suppose I could just save it to one of them, but that scene could be deleted so the approach of using the scene just feels fragile.
Thanks guys
James