fix [#30063] Weight Paint + Pose Mode: [m] key does not toggle Face Selection Masking

disallow some pose operators when weight paint mode is enabled.
This commit is contained in:
Campbell Barton 2012-09-06 23:10:01 +00:00
parent 518c974b80
commit 774cc0ab16
4 changed files with 34 additions and 10 deletions

@ -274,7 +274,7 @@ void POSE_OT_paths_calculate(wmOperatorType *ot)
/* api callbacks */
ot->invoke = pose_calculate_paths_invoke;
ot->exec = pose_calculate_paths_exec;
ot->poll = ED_operator_posemode;
ot->poll = ED_operator_posemode_exclusive;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@ -319,7 +319,7 @@ void POSE_OT_paths_update(wmOperatorType *ot)
/* api callbakcs */
ot->exec = pose_update_paths_exec;
ot->poll = ED_operator_posemode; /* TODO: this should probably check for active bone and/or existing paths */
ot->poll = ED_operator_posemode_exclusive; /* TODO: this should probably check for active bone and/or existing paths */
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@ -380,7 +380,7 @@ void POSE_OT_paths_clear(wmOperatorType *ot)
/* api callbacks */
ot->exec = pose_clear_paths_exec;
ot->poll = ED_operator_posemode;
ot->poll = ED_operator_posemode_exclusive;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@ -2192,7 +2192,7 @@ void POSE_OT_bone_layers(wmOperatorType *ot)
/* callbacks */
ot->invoke = pose_bone_layers_invoke;
ot->exec = pose_bone_layers_exec;
ot->poll = ED_operator_posemode;
ot->poll = ED_operator_posemode_exclusive;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

@ -169,6 +169,7 @@ int ED_operator_editlattice(struct bContext *C);
int ED_operator_editmball(struct bContext *C);
int ED_operator_uvedit(struct bContext *C);
int ED_operator_uvmap(struct bContext *C);
int ED_operator_posemode_exclusive(struct bContext *C);
int ED_operator_posemode(struct bContext *C);
int ED_operator_mask(struct bContext *C);

@ -1185,7 +1185,7 @@ void POSE_OT_constraints_clear(wmOperatorType *ot)
/* callbacks */
ot->exec = pose_constraints_clear_exec;
ot->poll = ED_operator_posemode; // XXX - do we want to ensure there are selected bones too?
ot->poll = ED_operator_posemode_exclusive; // XXX - do we want to ensure there are selected bones too?
}
@ -1266,7 +1266,7 @@ void POSE_OT_constraints_copy(wmOperatorType *ot)
/* api callbacks */
ot->exec = pose_constraint_copy_exec;
ot->poll = ED_operator_posemode;
ot->poll = ED_operator_posemode_exclusive;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@ -1661,7 +1661,7 @@ void POSE_OT_constraint_add(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = pose_constraint_add_exec;
ot->poll = ED_operator_posemode;
ot->poll = ED_operator_posemode_exclusive;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@ -1680,7 +1680,7 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = pose_constraint_add_exec;
ot->poll = ED_operator_posemode;
ot->poll = ED_operator_posemode_exclusive;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@ -1766,7 +1766,7 @@ void POSE_OT_ik_add(wmOperatorType *ot)
/* api callbacks */
ot->invoke = pose_ik_add_invoke;
ot->exec = pose_ik_add_exec;
ot->poll = ED_operator_posemode;
ot->poll = ED_operator_posemode_exclusive;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@ -1816,7 +1816,7 @@ void POSE_OT_ik_clear(wmOperatorType *ot)
/* api callbacks */
ot->exec = pose_ik_clear_exec;
ot->poll = ED_operator_posemode;
ot->poll = ED_operator_posemode_exclusive;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

@ -349,6 +349,29 @@ int ED_operator_editarmature(bContext *C)
return 0;
}
/**
* \brief check for pose mode (no mixed modes)
*
* We wan't to enable most pose operations in weight paint mode,
* when it comes to transforming bones, but managing bomes layers/groups
* can be left for pose mode only. (not weight paint mode)
*/
int ED_operator_posemode_exclusive(bContext *C)
{
Object *obact = CTX_data_active_object(C);
if (obact && !(obact->mode & OB_MODE_EDIT)) {
Object *obpose;
if ((obpose = BKE_object_pose_armature_get(obact))) {
if (obact == obpose) {
return 1;
}
}
}
return 0;
}
int ED_operator_posemode(bContext *C)
{
Object *obact = CTX_data_active_object(C);