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
This commit is contained in:
Falk David
2025-09-30 15:04:57 +02:00
committed by Falk David
parent 8536cd794e
commit c08fccae53
2 changed files with 21 additions and 4 deletions

View File

@@ -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;
}
}
}
}
}

View File

@@ -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]},