Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/workspace.c
| Show All 23 Lines | |||||
| /* allow accessing private members of DNA_workspace_types.h */ | /* allow accessing private members of DNA_workspace_types.h */ | ||||
| #define DNA_PRIVATE_WORKSPACE_ALLOW | #define DNA_PRIVATE_WORKSPACE_ALLOW | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "BLI_string_utf8.h" | |||||
| #include "BLI_string_utils.h" | #include "BLI_string_utils.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_scene.h" | |||||
| #include "BKE_screen.h" | #include "BKE_screen.h" | ||||
| #include "BKE_workspace.h" | #include "BKE_workspace.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_screen_types.h" | #include "DNA_screen_types.h" | ||||
| #include "DNA_workspace_types.h" | #include "DNA_workspace_types.h" | ||||
| ▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | |||||
| void BKE_workspace_remove(Main *bmain, WorkSpace *workspace) | void BKE_workspace_remove(Main *bmain, WorkSpace *workspace) | ||||
| { | { | ||||
| for (WorkSpaceLayout *layout = workspace->layouts.first, *layout_next; layout; layout = layout_next) { | for (WorkSpaceLayout *layout = workspace->layouts.first, *layout_next; layout; layout = layout_next) { | ||||
| layout_next = layout->next; | layout_next = layout->next; | ||||
| BKE_workspace_layout_remove(bmain, workspace, layout); | BKE_workspace_layout_remove(bmain, workspace, layout); | ||||
| } | } | ||||
| BKE_viewrender_free(&workspace->view_render); | |||||
| BKE_libblock_free(bmain, workspace); | BKE_libblock_free(bmain, workspace); | ||||
| } | } | ||||
| WorkSpaceInstanceHook *BKE_workspace_instance_hook_create(const Main *bmain) | WorkSpaceInstanceHook *BKE_workspace_instance_hook_create(const Main *bmain) | ||||
| { | { | ||||
| WorkSpaceInstanceHook *hook = MEM_callocN(sizeof(WorkSpaceInstanceHook), __func__); | WorkSpaceInstanceHook *hook = MEM_callocN(sizeof(WorkSpaceInstanceHook), __func__); | ||||
| /* set an active screen-layout for each possible window/workspace combination */ | /* set an active screen-layout for each possible window/workspace combination */ | ||||
| ▲ Show 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | WorkSpaceLayout *BKE_workspace_hook_layout_for_workspace_get( | ||||
| return workspace_relation_get_data_matching_parent(&workspace->hook_layout_relations, hook); | return workspace_relation_get_data_matching_parent(&workspace->hook_layout_relations, hook); | ||||
| } | } | ||||
| void BKE_workspace_hook_layout_for_workspace_set( | void BKE_workspace_hook_layout_for_workspace_set( | ||||
| WorkSpaceInstanceHook *hook, WorkSpace *workspace, WorkSpaceLayout *layout) | WorkSpaceInstanceHook *hook, WorkSpace *workspace, WorkSpaceLayout *layout) | ||||
| { | { | ||||
| hook->act_layout = layout; | hook->act_layout = layout; | ||||
| workspace_relation_ensure_updated(&workspace->hook_layout_relations, hook, layout); | workspace_relation_ensure_updated(&workspace->hook_layout_relations, hook, layout); | ||||
| } | } | ||||
| /** | |||||
| * Get the render engine of a workspace, to be used in the viewport. | |||||
| */ | |||||
| ViewRender *BKE_workspace_view_render_get(WorkSpace *workspace) | |||||
| { | |||||
| return &workspace->view_render; | |||||
| } | |||||
| /* Flags */ | |||||
| bool BKE_workspace_use_scene_settings_get(const WorkSpace *workspace) | |||||
| { | |||||
| return (workspace->flags & WORKSPACE_USE_SCENE_SETTINGS) != 0; | |||||
| } | |||||
| void BKE_workspace_use_scene_settings_set(WorkSpace *workspace, bool value) | |||||
| { | |||||
| if (value) { | |||||
| workspace->flags |= WORKSPACE_USE_SCENE_SETTINGS; | |||||
| } | |||||
| else { | |||||
| workspace->flags &= ~WORKSPACE_USE_SCENE_SETTINGS; | |||||
| } | |||||
| } | |||||