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:
authorCampbell Barton <ideasman42@gmail.com>2018-02-09 14:14:17 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-02-09 14:14:39 +0300
commit5db950e860b2f64078cfc8cf00cb4f430b8a1baf (patch)
treeb9a734351e0cfa849c3c136e4fc6f26276c7c5c0 /source/blender/editors/object/object_shapekey.c
parent25074be697cb5726328aa5d064a60788c1da6aeb (diff)
Cleanup: use workspace for object_mode when possible
Diffstat (limited to 'source/blender/editors/object/object_shapekey.c')
-rw-r--r--source/blender/editors/object/object_shapekey.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index 005ae64e413..bd3bd8fd0a5 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -49,6 +49,7 @@
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
+#include "DNA_workspace_types.h"
#include "BKE_context.h"
#include "BKE_key.h"
@@ -225,22 +226,20 @@ static bool object_shape_key_mirror(bContext *C, Object *ob,
static int shape_key_mode_poll(bContext *C)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
- return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data) && (eval_ctx.object_mode != OB_MODE_EDIT));
+ return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data) && (workspace->object_mode != OB_MODE_EDIT));
}
static int shape_key_mode_exists_poll(bContext *C)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
/* same as shape_key_mode_poll */
- return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data) && (eval_ctx.object_mode != OB_MODE_EDIT)) &&
+ return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data) && (workspace->object_mode != OB_MODE_EDIT)) &&
/* check a keyblock exists */
(BKE_keyblock_from_object(ob) != NULL);
}
@@ -248,14 +247,13 @@ static int shape_key_mode_exists_poll(bContext *C)
static int shape_key_move_poll(bContext *C)
{
/* Same as shape_key_mode_exists_poll above, but ensure we have at least two shapes! */
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
Key *key = BKE_key_from_object(ob);
return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data) &&
- (eval_ctx.object_mode != OB_MODE_EDIT) && key && key->totkey > 1);
+ (workspace->object_mode != OB_MODE_EDIT) && key && key->totkey > 1);
}
static int shape_key_poll(bContext *C)