From c08fccae53326272304ed0a0fd4c30d9605495b0 Mon Sep 17 00:00:00 2001 From: Falk David Date: Tue, 30 Sep 2025 15:04:57 +0200 Subject: [PATCH] Fix #146155: VSE: Too agressive sequencer scene versioning The sequencer scene was set to the active scene in the window in all cases. This is not great because we really only expect the sequencer scene to be assigned when it was used. The fix changes the versioning code to ensure that 1) The window has any VSE open. 2) The active scene uses an `Editing` struct (e.g. the user created strips, or interacted in some way with the VSE). This also changes back the test that checks for the usages of IDs. Before this test had to include the workspace for the default scene. Now this scene is no longer used by the workspace, because the versioning that sets the sequencer scene is no longer run. Pull Request: https://projects.blender.org/blender/blender/pulls/147044 --- .../blenloader/intern/versioning_500.cc | 23 ++++++++++++++++--- tests/python/bl_blendfile_relationships.py | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/source/blender/blenloader/intern/versioning_500.cc b/source/blender/blenloader/intern/versioning_500.cc index 37af962d2b7..8c6e1fdea38 100644 --- a/source/blender/blenloader/intern/versioning_500.cc +++ b/source/blender/blenloader/intern/versioning_500.cc @@ -2448,6 +2448,19 @@ static void do_version_bokeh_blur_pixel_size(bNodeTree &node_tree, bNode &node) } } +static bool window_has_sequence_editor_open(const wmWindow *win) +{ + bScreen *screen = WM_window_get_active_screen(win); + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { + if (sl->spacetype == SPACE_SEQ) { + return true; + } + } + } + return false; +} + void do_versions_after_linking_500(FileData *fd, Main *bmain) { if (!MAIN_VERSION_FILE_ATLEAST(bmain, 500, 9)) { @@ -2539,9 +2552,13 @@ void do_versions_after_linking_500(FileData *fd, Main *bmain) if (!MAIN_VERSION_FILE_ATLEAST(bmain, 500, 63)) { LISTBASE_FOREACH (wmWindowManager *, wm, &bmain->wm) { LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { - Scene *scene = WM_window_get_active_scene(win); - WorkSpace *workspace = WM_window_get_active_workspace(win); - workspace->sequencer_scene = scene; + if (window_has_sequence_editor_open(win)) { + Scene *scene = WM_window_get_active_scene(win); + if (scene->ed != nullptr) { + WorkSpace *workspace = WM_window_get_active_workspace(win); + workspace->sequencer_scene = scene; + } + } } } } diff --git a/tests/python/bl_blendfile_relationships.py b/tests/python/bl_blendfile_relationships.py index c4859ec9660..5de8787ab3e 100644 --- a/tests/python/bl_blendfile_relationships.py +++ b/tests/python/bl_blendfile_relationships.py @@ -46,7 +46,7 @@ class TestBlendUserMap(TestBlendLibLinkHelper): expected_map = { bpy.data.images[0]: {bpy.data.materials[0]}, bpy.data.materials[0]: {bpy.data.meshes[0]}, - bpy.data.scenes[0]: {bpy.data.window_managers[0], bpy.data.workspaces['Layout']}, + bpy.data.scenes[0]: {bpy.data.window_managers[0]}, bpy.data.collections[0]: {bpy.data.scenes[0]}, bpy.data.libraries[0]: set(), bpy.data.meshes[0]: {bpy.data.objects[0]},