diff options
author | Jonathan Williamson <jonathan@cgcookie.com> | 2013-10-15 01:03:18 +0400 |
---|---|---|
committer | Jonathan Williamson <jonathan@cgcookie.com> | 2013-10-15 01:03:18 +0400 |
commit | 34946e7f045344a43b263f78d001d2ed7ec3c26b (patch) | |
tree | 610ee9f504f0cd7dc1787d84d8717a69e5d2bda5 | |
parent | afce7e071a8658c4f1664532248edebc90534fe5 (diff) |
Added poll function to disable "Remove Shape key from object".
This disables the "-" button when no shape keys exist on the currently selected object. Thanks to Campbell for the help on my first real commit!
-rw-r--r-- | source/blender/editors/object/object_shapekey.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index ea96db514b2..6be4a2fed2c 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -290,6 +290,17 @@ static int shape_key_mode_poll(bContext *C) return (ob && !ob->id.lib && data && !data->lib && ob->mode != OB_MODE_EDIT); } +static int shape_key_mode_exists_poll(bContext *C) +{ + Object *ob = ED_object_context(C); + ID *data = (ob) ? ob->data : NULL; + + /* same as shape_key_mode_poll */ + return (ob && !ob->id.lib && data && !data->lib && ob->mode != OB_MODE_EDIT) && + /* check a keyblock exists */ + (BKE_keyblock_from_object(ob) != NULL); +} + static int shape_key_poll(bContext *C) { Object *ob = ED_object_context(C); @@ -359,6 +370,7 @@ void OBJECT_OT_shape_key_remove(wmOperatorType *ot) /* api callbacks */ ot->poll = shape_key_mode_poll; + ot->poll = shape_key_mode_exists_poll; ot->exec = shape_key_remove_exec; /* flags */ |