diff options
author | Julian Eisel <julian@blender.org> | 2022-07-07 18:51:18 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-07-07 19:08:18 +0300 |
commit | e0cc86978c0f72f57240214ccb6bc7fe71428827 (patch) | |
tree | 83e4dd74cc92adff699e2588fb28118212ec0dfd /source/blender/blenkernel/intern/workspace.c | |
parent | f9a805164a944c3b5762f07e535536b9f425651f (diff) |
Workspaces: Option to pin scene to a workspace
Adds a "Pin Scene" option to the workspace. When activated, the workspace will
remember the scene that was last activated in it, so that when switching back
to this workspace, the same scene will be reactivated. This is important for a
VSE workflow, so that users can switch between different workspaces displaying
a scene and thus a timeline for a specific task.
The option can be found in the Properties, Workspace tab. D11890 additionally
adds an icon for this to the scene switcher in the topbar.
The workspace data contains a pointer to the scene which is a UI to scene data
relation. When appending a workspace, the pointer is cleared.
Differential Revision: https://developer.blender.org/D9140
Reviewed by: Brecht Van Lommel, Bastien Montagne (no final accept, but was fine
with the general design earlier)
Diffstat (limited to 'source/blender/blenkernel/intern/workspace.c')
-rw-r--r-- | source/blender/blenkernel/intern/workspace.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c index ef0a3069815..0265dd037b1 100644 --- a/source/blender/blenkernel/intern/workspace.c +++ b/source/blender/blenkernel/intern/workspace.c @@ -67,6 +67,8 @@ static void workspace_foreach_id(ID *id, LibraryForeachIDData *data) { WorkSpace *workspace = (WorkSpace *)id; + BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, workspace->pin_scene, IDWALK_CB_NOP); + LISTBASE_FOREACH (WorkSpaceLayout *, layout, &workspace->layouts) { BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, layout->screen, IDWALK_CB_USER); } @@ -120,6 +122,15 @@ static void workspace_blend_read_lib(BlendLibReader *reader, ID *id) WorkSpace *workspace = (WorkSpace *)id; Main *bmain = BLO_read_lib_get_main(reader); + /* Do not keep the scene reference when appending a workspace. Setting a scene for a workspace is + * a convenience feature, but the workspace should never truly depend on scene data. */ + if (ID_IS_LINKED(id)) { + workspace->pin_scene = NULL; + } + else { + BLO_read_id_address(reader, NULL, &workspace->pin_scene); + } + /* Restore proper 'parent' pointers to relevant data, and clean up unused/invalid entries. */ LISTBASE_FOREACH_MUTABLE (WorkSpaceDataRelation *, relation, &workspace->hook_layout_relations) { relation->parent = NULL; |