Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/workspace.c
| Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | void BKE_workspace_free(WorkSpace *workspace) | ||||
| for (WorkSpaceDataRelation *relation = workspace->hook_layout_relations.first, *relation_next; | for (WorkSpaceDataRelation *relation = workspace->hook_layout_relations.first, *relation_next; | ||||
| relation; | relation; | ||||
| relation = relation_next) | relation = relation_next) | ||||
| { | { | ||||
| relation_next = relation->next; | relation_next = relation->next; | ||||
| workspace_relation_remove(&workspace->hook_layout_relations, relation); | workspace_relation_remove(&workspace->hook_layout_relations, relation); | ||||
| } | } | ||||
| BLI_freelistN(&workspace->layouts); | BLI_freelistN(&workspace->layouts); | ||||
| BLI_freelistN(&workspace->transform_orientations); | |||||
| } | } | ||||
| void BKE_workspace_remove(Main *bmain, WorkSpace *workspace) | void BKE_workspace_remove(Main *bmain, WorkSpace *workspace) | ||||
| { | { | ||||
| BKE_WORKSPACE_LAYOUT_ITER_BEGIN (layout, workspace->layouts.first) { | BKE_WORKSPACE_LAYOUT_ITER_BEGIN (layout, workspace->layouts.first) { | ||||
| BKE_workspace_layout_remove(bmain, workspace, layout); | BKE_workspace_layout_remove(bmain, workspace, layout); | ||||
| } BKE_WORKSPACE_LAYOUT_ITER_END; | } BKE_WORKSPACE_LAYOUT_ITER_END; | ||||
| ▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| BKE_libblock_free(bmain, BKE_workspace_layout_screen_get(layout)); | BKE_libblock_free(bmain, BKE_workspace_layout_screen_get(layout)); | ||||
| BLI_freelinkN(&workspace->layouts, layout); | BLI_freelinkN(&workspace->layouts, layout); | ||||
| } | } | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /* General Utils */ | /* General Utils */ | ||||
| void BKE_workspaces_transform_orientation_remove( | void BKE_workspace_transform_orientation_remove( | ||||
| const ListBase *workspaces, const TransformOrientation *orientation) | WorkSpace *workspace, TransformOrientation *orientation) | ||||
| { | { | ||||
| BKE_WORKSPACE_ITER_BEGIN (workspace, workspaces->first) { | |||||
| BKE_WORKSPACE_LAYOUT_ITER_BEGIN (layout, workspace->layouts.first) { | BKE_WORKSPACE_LAYOUT_ITER_BEGIN (layout, workspace->layouts.first) { | ||||
| BKE_screen_transform_orientation_remove(BKE_workspace_layout_screen_get(layout), orientation); | BKE_screen_transform_orientation_remove(BKE_workspace_layout_screen_get(layout), orientation); | ||||
| } BKE_WORKSPACE_LAYOUT_ITER_END; | } BKE_WORKSPACE_LAYOUT_ITER_END; | ||||
| } BKE_WORKSPACE_ITER_END; | |||||
| BLI_freelinkN(&workspace->transform_orientations, orientation); | |||||
| } | } | ||||
| WorkSpaceLayout *BKE_workspace_layout_find( | WorkSpaceLayout *BKE_workspace_layout_find( | ||||
| const WorkSpace *workspace, const bScreen *screen) | const WorkSpace *workspace, const bScreen *screen) | ||||
| { | { | ||||
| WorkSpaceLayout *layout = workspace_layout_find_exec(workspace, screen); | WorkSpaceLayout *layout = workspace_layout_find_exec(workspace, screen); | ||||
| if (layout) { | if (layout) { | ||||
| return layout; | return layout; | ||||
| } | } | ||||
| printf("%s: Couldn't find layout in this workspace: '%s' screen: '%s'. " | printf("%s: Couldn't find layout in this workspace: '%s' screen: '%s'. " | ||||
| "This should not happen!\n", | "This should not happen!\n", | ||||
| __func__, workspace->id.name + 2, screen->id.name + 2); | __func__, workspace->id.name + 2, screen->id.name + 2); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| /** | /** | ||||
| * Find the layout for \a screen without knowing which workspace to look in. | * Find the layout for \a screen without knowing which workspace to look in. | ||||
| * Can also be used to find the workspace that contains \a screen. | |||||
| * | * | ||||
| * \param r_workspace: Optionally return the workspace that contains the looked up layout (if found). | * \param r_workspace: Optionally return the workspace that contains the looked up layout (if found). | ||||
| */ | */ | ||||
| WorkSpaceLayout *BKE_workspace_layout_find_global( | WorkSpaceLayout *BKE_workspace_layout_find_global( | ||||
| const Main *bmain, const bScreen *screen, | const Main *bmain, const bScreen *screen, | ||||
| WorkSpace **r_workspace) | WorkSpace **r_workspace) | ||||
| { | { | ||||
| WorkSpaceLayout *layout; | WorkSpaceLayout *layout; | ||||
| ▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | ObjectMode BKE_workspace_object_mode_get(const WorkSpace *workspace) | ||||
| return workspace->object_mode; | return workspace->object_mode; | ||||
| } | } | ||||
| void BKE_workspace_object_mode_set(WorkSpace *workspace, const ObjectMode mode) | void BKE_workspace_object_mode_set(WorkSpace *workspace, const ObjectMode mode) | ||||
| { | { | ||||
| workspace->object_mode = mode; | workspace->object_mode = mode; | ||||
| } | } | ||||
| #endif | #endif | ||||
| ListBase *BKE_workspace_transform_orientations_get(WorkSpace *workspace) | |||||
| { | |||||
| return &workspace->transform_orientations; | |||||
| } | |||||
| SceneLayer *BKE_workspace_render_layer_get(const WorkSpace *workspace) | SceneLayer *BKE_workspace_render_layer_get(const WorkSpace *workspace) | ||||
| { | { | ||||
| return workspace->render_layer; | return workspace->render_layer; | ||||
| } | } | ||||
| void BKE_workspace_render_layer_set(WorkSpace *workspace, SceneLayer *layer) | void BKE_workspace_render_layer_set(WorkSpace *workspace, SceneLayer *layer) | ||||
| { | { | ||||
| workspace->render_layer = layer; | workspace->render_layer = layer; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines | |||||