diff options
-rw-r--r-- | source/blender/editors/armature/poseobject.c | 8 | ||||
-rw-r--r-- | source/blender/editors/include/ED_screen.h | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 12 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 23 |
4 files changed, 34 insertions, 10 deletions
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index cd2ca16fec5..e4f1e6d3e8b 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -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; diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 4faf82eec36..fc20bdfb9c5 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -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); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index be25c79ba25..08ba6a1e682 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.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; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 823037a7903..9f9d0bab15c 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -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); |