I'm using a Python class static members properties in order to store the state of the addon I'm developing. It works fine and my Python class is brand new every time I start Blender. Problem is, if I do file->new or revert, that class is not created anew and still stores values that are relevant to the old file. Is there any way to achieve that?
A persistent onload handler
Code taken directly from Persistent Handler Example
import bpy from bpy.app.handlers import persistent @persistent def load_handler(dummy): print("Load Handler:", bpy.data.filepath) bpy.app.handlers.load_post.append(load_handler)
Other things to consider re comment for revert and new is look at
for toggle from
False. Wont matter if a clean file is reverted.