fix [#30063] Weight Paint + Pose Mode: [m] key does not toggle Face Selection Masking
authorCampbell Barton <ideasman42@gmail.com>
Thu, 6 Sep 2012 23:10:01 +0000 (23:10 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 6 Sep 2012 23:10:01 +0000 (23:10 +0000)
disallow some pose operators when weight paint mode is enabled.

source/blender/editors/armature/poseobject.c
source/blender/editors/include/ED_screen.h
source/blender/editors/object/object_constraint.c
source/blender/editors/screen/screen_ops.c

index cd2ca16fec5710fd8651b011d4d24055cc6f3644..e4f1e6d3e8b6859fc6cd45427285812a29f3c65f 100644 (file)
@@ -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;
index 4faf82eec36f65e50acd0689b854aa9bf9e5926a..fc20bdfb9c5562c767fa0d675bf1db7b6b0847c1 100644 (file)
@@ -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);
 
index be25c79ba2547225ac4f7c8a86f42c5fab5462c4..08ba6a1e682c5ad2c6323cae42ed9399417d5e88 100644 (file)
@@ -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;
index 823037a79031615aded2d47fb7a437dccfd4aab0..9f9d0bab15c6a09c466cc540cf11728904b04cfe 100644 (file)
@@ -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);