Cleanup: avoid using context in versioning code

Also extract versioning into a function that makes it's purpose clear.
This commit is contained in:
Campbell Barton
2021-08-09 12:01:11 +10:00
parent 4c26bb0232
commit 3ea6cf7d41

View File

@@ -20,10 +20,8 @@ import bpy
from bpy.app.handlers import persistent
@persistent
def load_handler(_):
from bpy import context
screen = context.screen
def do_version_file_browser():
screen = bpy.data.screens["Video Editing"]
for area in screen.areas:
if area.type == 'FILE_BROWSER':
space = area.spaces.active
@@ -31,6 +29,11 @@ def load_handler(_):
params.use_filter_folder = True
@persistent
def load_handler(_):
do_version_file_browser()
def register():
bpy.app.handlers.load_factory_startup_post.append(load_handler)