Is storing persistent values (somewhere) while Blender is still open (ie beyond scene scope) possible in Blender, by other means than having python global variables? Something like this
bpy.types.WindowManager.session_integer = bpy.props.IntProperty(
name = "I want to keep my value in next scene")
bpy.context.window_manager.session_integer += 1
# Ctrl-N equivalent (File - New)
# 0 (should be 1?)
In the code above, last call prints 0, but I’m looking to keep the 1. Is this supported in Blender? If yes, what is the proper way to do it?
there are lots of ways to handle this… you could use a propertygroup and store it with your addon, you could use addonprefs, you could write your variable to a file and read it back, append it to the scene as an attribute, etc.
Storing it on a file would make the data survive beyond the execution of Blender, and appending it to the scene as an attribute does not survive for as long as Blender is open, it will get lost when user changes the scene, but…
you could use a propertygroup and store it with your addon
@testure this is the one I don’t understand what you mean. Can you please elaborate a bit more, maybe this is what I’m looking for?