diff options
Diffstat (limited to 'source/blender/editors/object/object_shapekey.c')
-rw-r--r-- | source/blender/editors/object/object_shapekey.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 26d33bbc375..71778f92349 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -216,40 +216,38 @@ static bool object_shape_key_mirror( /********************** shape key operators *********************/ -static bool shape_key_mode_poll(bContext *C) +static bool shape_key_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; - return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data) && ob->mode != OB_MODE_EDIT); + + return (ob != NULL && !ID_IS_LINKED(ob) && !ID_IS_OVERRIDE_LIBRARY(ob) && data != NULL && + !ID_IS_LINKED(data) && !ID_IS_OVERRIDE_LIBRARY(data)); } -static bool shape_key_mode_exists_poll(bContext *C) +static bool shape_key_mode_poll(bContext *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) && ob->mode != OB_MODE_EDIT) && - /* check a keyblock exists */ - (BKE_keyblock_from_object(ob) != NULL); + return (shape_key_poll(C) && ob->mode != OB_MODE_EDIT); } -static bool shape_key_move_poll(bContext *C) +static bool shape_key_mode_exists_poll(bContext *C) { - /* Same as shape_key_mode_exists_poll above, but ensure we have at least two shapes! */ 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) && ob->mode != OB_MODE_EDIT && - key && key->totkey > 1); + return (shape_key_mode_poll(C) && + /* check a keyblock exists */ + (BKE_keyblock_from_object(ob) != NULL)); } -static bool shape_key_poll(bContext *C) +static bool shape_key_move_poll(bContext *C) { + /* Same as shape_key_mode_exists_poll above, but ensure we have at least two shapes! */ Object *ob = ED_object_context(C); - ID *data = (ob) ? ob->data : NULL; - return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data)); + Key *key = BKE_key_from_object(ob); + + return (shape_key_mode_poll(C) && key != NULL && key->totkey > 1); } static int shape_key_add_exec(bContext *C, wmOperator *op) |