diff options
author | Bastien Montagne <bastien@blender.org> | 2020-06-30 18:51:41 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-06-30 18:52:36 +0300 |
commit | 6add0cc88a0d06e0a60f88b83c4894bd8701ecb5 (patch) | |
tree | 7b8a0c6fc98930c759f6cb3d1daaf7d44b6e1a47 /source/blender/editors/object/object_shapekey.c | |
parent | 438bd823714a24475962ab89ad38b0d7e36349fe (diff) |
LibOverride: Fix lots of poll functions for Object operators.
Prevent operators that should not perform on override data to be
callable in those cases.
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) |