diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-02-08 13:14:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-02-08 13:14:26 +0300 |
commit | 345c6298e995ea618c34282ba6d7ab5af032f191 (patch) | |
tree | f4fbc4798e17d0f19efc28b51a41425d0c552be8 /source/blender/blenkernel/intern/workspace.c | |
parent | 14a19fed788af0cf3695eb5def92510841056e08 (diff) |
Object Mode: move to workspace struct
- Read-only access can often use EvaluationContext.object_mode
- Write access to go to WorkSpace.object_mode.
- Some TODO's remain (marked as "TODO/OBMODE")
- Add-ons will need updating
(context.active_object.mode -> context.workspace.object_mode)
- There will be small/medium issues that still need resolving
this does work on a basic level though.
See D3037
Diffstat (limited to 'source/blender/blenkernel/intern/workspace.c')
-rw-r--r-- | source/blender/blenkernel/intern/workspace.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c index 4b6bd3ac35b..dcd4183210d 100644 --- a/source/blender/blenkernel/intern/workspace.c +++ b/source/blender/blenkernel/intern/workspace.c @@ -415,21 +415,6 @@ void BKE_workspace_active_screen_set(WorkSpaceInstanceHook *hook, WorkSpace *wor BKE_workspace_hook_layout_for_workspace_set(hook, workspace, layout); } -#ifdef USE_WORKSPACE_MODE -eObjectMode BKE_workspace_object_mode_get(const WorkSpace *workspace, const Scene *scene) -{ - Base *active_base = BKE_workspace_active_base_get(workspace, scene); - return active_base ? active_base->object->mode : OB_MODE_OBJECT; -} -void BKE_workspace_object_mode_set(WorkSpace *workspace, Scene *scene, const eObjectMode mode) -{ - Base *active_base = BKE_workspace_active_base_get(workspace, scene); - if (active_base) { - active_base->object->mode = mode; - } -} -#endif - Base *BKE_workspace_active_base_get(const WorkSpace *workspace, const Scene *scene) { ViewLayer *view_layer = BKE_workspace_view_layer_get(workspace, scene); @@ -526,14 +511,10 @@ void BKE_workspace_update_tagged(struct EvaluationContext *eval_ctx, void BKE_workspace_update_object_mode( struct EvaluationContext *eval_ctx, - WorkSpace *workspace, Scene *scene) + WorkSpace *workspace) { - ViewLayer *view_layer = BKE_workspace_view_layer_get(workspace, scene); - /* TODO(campbell): Investigate how this should work exactly, * for now without this 'bmain->eval_ctx' is never set. */ - { - Object *ob = view_layer->basact ? view_layer->basact->object : NULL; - eval_ctx->object_mode = ob ? (eObjectMode)ob->mode : OB_MODE_OBJECT; - } + + eval_ctx->object_mode = workspace->object_mode; }
\ No newline at end of file |