Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2017-11-25 05:37:48 +0300
committerJulian Eisel <eiseljulian@gmail.com>2017-11-25 05:42:49 +0300
commit974ffaa39d8dd9f0bdd7bbf74648183b1937d3be (patch)
treecb4398a5d42bc11ec1d8043c133317b91be98b1a /source/blender/blenkernel/intern
parent7cbc7dd90499f98e3f44f86fdacae5365e53cd77 (diff)
Get workspace mode from the workspace view-layer
While this probably isn't the final solution we'll go with, it's nicer as current one, which was basically broken. So consider this as temporary solution. It also allows testing how changing workspace changes mode & active object, but only by having the workspaces use different view-layers. Decided to remove WorkSpace.mode for now. If we need to bring it back, we'll have to version patch it anyway.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/workspace.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index 67639b4c7ab..785fd71df69 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -388,14 +388,23 @@ void BKE_workspace_active_screen_set(WorkSpaceInstanceHook *hook, WorkSpace *wor
#ifdef USE_WORKSPACE_MODE
eObjectMode BKE_workspace_object_mode_get(const WorkSpace *workspace)
{
- return workspace->object_mode;
+ Base *active_base = BKE_workspace_active_base_get(workspace);
+ return active_base ? active_base->object->mode : OB_MODE_OBJECT;
}
void BKE_workspace_object_mode_set(WorkSpace *workspace, const eObjectMode mode)
{
- workspace->object_mode = mode;
+ Base *active_base = BKE_workspace_active_base_get(workspace);
+ if (active_base) {
+ active_base->object->mode = mode;
+ }
}
#endif
+Base *BKE_workspace_active_base_get(const WorkSpace *workspace)
+{
+ return workspace->view_layer->basact;
+}
+
ListBase *BKE_workspace_transform_orientations_get(WorkSpace *workspace)
{
return &workspace->transform_orientations;