My addon relies on checking
bpy.data.is_dirty. This seems to work fine in interactive mode, however when I tried adding automated tests for my addon I have faced issue with
bpy.data.is_dirty not updating correctly when things are getting changed from my tests (Python script).
Example script to reproduce (on Blender 2.79):
>>> bpy.data.scenes.frame_start = bpy.data.scenes.frame_start + 1 >>> bpy.data.is_dirty False
I can see starting frame change on the timeline, however there is no asterisk “*” visible in title (which generally indicates unsaved changes).
If I change starting frame by clicking on small arrow by number it marks the file correctly as changed (both the asterisk appears and
bpy.data.is_dirty returns `True).
I have also managed to get a state in tests that have
True even on the next line just after call to
Is there some function I need to call to get Blender’s internal state to update
Alternatively, as I need it only for tests, is there some way to make sure that
bpy.data.is_dirty is in a desired state? (i.e. I need to be able to set it both to
False depending on scenario)
I read https://docs.blender.org/api/2.79/info_gotcha.html#no-updates-after-setting-values and tried using
bpy.context.scene.update(), but it doesn’t seem to impact
Note: this is clone of my question on blender.stackexchange