Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/workspace_edit.c
| Show First 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | if (screen_new) { | ||||
| /* update screen *after* changing workspace - which also causes the | /* update screen *after* changing workspace - which also causes the | ||||
| * actual screen change and updates context (including CTX_wm_workspace) */ | * actual screen change and updates context (including CTX_wm_workspace) */ | ||||
| screen_change_update(C, win, screen_new); | screen_change_update(C, win, screen_new); | ||||
| workspace_change_update(workspace_new, workspace_old, C, wm); | workspace_change_update(workspace_new, workspace_old, C, wm); | ||||
| BLI_assert(BKE_workspace_view_layer_get(workspace_new, CTX_data_scene(C)) != NULL); | BLI_assert(BKE_workspace_view_layer_get(workspace_new, CTX_data_scene(C)) != NULL); | ||||
| BLI_assert(CTX_wm_workspace(C) == workspace_new); | BLI_assert(CTX_wm_workspace(C) == workspace_new); | ||||
| WM_toolsystem_unlink(C, workspace_old); | WM_toolsystem_unlink_all(C, workspace_old); | ||||
| WM_toolsystem_link(C, workspace_new); | WM_toolsystem_link_all(C, workspace_new); | ||||
| return true; | return true; | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| /** | /** | ||||
| * Duplicate a workspace including its layouts. Does not activate the workspace, but | * Duplicate a workspace including its layouts. Does not activate the workspace, but | ||||
| * it stores the screen-layout to be activated (BKE_workspace_temp_layout_store) | * it stores the screen-layout to be activated (BKE_workspace_temp_layout_store) | ||||
| */ | */ | ||||
| WorkSpace *ED_workspace_duplicate( | WorkSpace *ED_workspace_duplicate( | ||||
| WorkSpace *workspace_old, Main *bmain, wmWindow *win) | WorkSpace *workspace_old, Main *bmain, wmWindow *win) | ||||
| { | { | ||||
| WorkSpaceLayout *layout_active_old = BKE_workspace_active_layout_get(win->workspace_hook); | WorkSpaceLayout *layout_active_old = BKE_workspace_active_layout_get(win->workspace_hook); | ||||
| ListBase *layouts_old = BKE_workspace_layouts_get(workspace_old); | ListBase *layouts_old = BKE_workspace_layouts_get(workspace_old); | ||||
| Scene *scene = WM_window_get_active_scene(win); | Scene *scene = WM_window_get_active_scene(win); | ||||
| WorkSpace *workspace_new = ED_workspace_add( | WorkSpace *workspace_new = ED_workspace_add( | ||||
| bmain, workspace_old->id.name + 2, scene, | bmain, workspace_old->id.name + 2, scene, | ||||
| BKE_workspace_view_layer_get(workspace_old, scene)); | BKE_workspace_view_layer_get(workspace_old, scene)); | ||||
| workspace_new->tool = workspace_old->tool; | /* TODO(campbell): tool_refs */ | ||||
| for (WorkSpaceLayout *layout_old = layouts_old->first; layout_old; layout_old = layout_old->next) { | for (WorkSpaceLayout *layout_old = layouts_old->first; layout_old; layout_old = layout_old->next) { | ||||
| WorkSpaceLayout *layout_new = ED_workspace_layout_duplicate(workspace_new, layout_old, win); | WorkSpaceLayout *layout_new = ED_workspace_layout_duplicate(workspace_new, layout_old, win); | ||||
| if (layout_active_old == layout_old) { | if (layout_active_old == layout_old) { | ||||
| win->workspace_hook->temp_layout_store = layout_new; | win->workspace_hook->temp_layout_store = layout_new; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 272 Lines • Show Last 20 Lines | |||||