diff options
author | Bastien Montagne <bastien@blender.org> | 2021-06-16 16:52:56 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-06-16 17:09:28 +0300 |
commit | 3953b82030ab75689ece389c02b8c7ca389311b4 (patch) | |
tree | e59c55714e41fe05e442398c8a8d6bf590f2973a /source/blender/editors/object/object_constraint.c | |
parent | 88aa056d1ac5155b8fa20fb36598c84837bccfc2 (diff) |
Tweaks to Constraints operators poll functions.
Mainly:
* Make `ED_operator_object_active_editable_ex` properly report poll
messages on failure.
* Add `ED_operator_object_active_local_editable_posemode_exclusive` for
bone constraints requiring pure local Object (non-override one).
* General cleanup and adding more poll messages on failures.
Diffstat (limited to 'source/blender/editors/object/object_constraint.c')
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 244124a6e0a..06d6f2b94f3 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -696,12 +696,11 @@ static bool edit_constraint_poll_generic(bContext *C, Object *ob = (ptr.owner_id) ? (Object *)ptr.owner_id : ED_object_active_context(C); bConstraint *con = ptr.data; - if (!ob) { - CTX_wm_operator_poll_msg_set(C, "Context missing active object"); + if (!ED_operator_object_active_editable_ex(C, ob)) { return false; } - if (ID_IS_LINKED(ob) || (ptr.owner_id && ID_IS_LINKED(ptr.owner_id))) { + if (ptr.owner_id != NULL && ID_IS_LINKED(ptr.owner_id)) { CTX_wm_operator_poll_msg_set(C, "Cannot edit library data"); return false; } @@ -1746,8 +1745,8 @@ void POSE_OT_constraints_clear(wmOperatorType *ot) /* callbacks */ ot->exec = pose_constraints_clear_exec; - ot->poll = ED_operator_posemode_exclusive; /* XXX - do we want to ensure there are selected - * bones too? */ + /* XXX - do we want to ensure there are selected bones too? */ + ot->poll = ED_operator_object_active_local_editable_posemode_exclusive; } static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) @@ -2480,7 +2479,7 @@ void POSE_OT_ik_clear(wmOperatorType *ot) /* api callbacks */ ot->exec = pose_ik_clear_exec; - ot->poll = ED_operator_posemode_exclusive; + ot->poll = ED_operator_object_active_local_editable_posemode_exclusive; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; |