Fix combined pose + weight paint mode, was using wrong object
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 19 Sep 2009 15:48:47 +0000 (15:48 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 19 Sep 2009 15:48:47 +0000 (15:48 +0000)
in a few places, missing some checks.

source/blender/editors/armature/editarmature.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/transform/transform_conversions.c

index 394df8111d8918ef5f2a9d9fc8e98899f5ac69ee..80f8c2b07aa739542ad8c87035d0781abcb2ff61 100644 (file)
@@ -4333,7 +4333,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor
                }
                
                /* in weightpaint we select the associated vertex group too */
-               if (ob->mode & OB_MODE_WEIGHT_PAINT) {
+               if (OBACT && OBACT->mode & OB_MODE_WEIGHT_PAINT) {
                        if (nearBone->flag & BONE_ACTIVE) {
                                ED_vgroup_select_by_name(OBACT, nearBone->name);
                                DAG_id_flush_update(&OBACT->id, OB_RECALC_DATA);
index fa810677fe882e45eeefb2d24d24313547331f2f..497091f2660aee42d2b17b5425a1460c1c2214ab 100644 (file)
@@ -2513,7 +2513,11 @@ int draw_armature(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int
                        /* drawing posemode selection indices or colors only in these cases */
                        if(!(base->flag & OB_FROMDUPLI)) {
                                if(G.f & G_PICKSEL) {
-                                       if(ob->mode & OB_MODE_POSE) 
+                                       if(OBACT && (OBACT->mode & OB_MODE_WEIGHT_PAINT)) {
+                                               if(ob==modifiers_isDeformedByArmature(OBACT))
+                                                       arm->flag |= ARM_POSEMODE;
+                                       }
+                                       else if(ob->mode & OB_MODE_POSE) 
                                                arm->flag |= ARM_POSEMODE;
                                }
                                else if(ob->mode & OB_MODE_POSE) {
@@ -2530,8 +2534,8 @@ int draw_armature(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int
                                        if ((flag & DRAW_SCENESET)==0) {
                                                if(ob==OBACT) 
                                                        arm->flag |= ARM_POSEMODE;
-                                               else if(ob->mode & OB_MODE_WEIGHT_PAINT) {
-                                                       if(OBACT && ob==modifiers_isDeformedByArmature(OBACT))
+                                               else if(OBACT && (OBACT->mode & OB_MODE_WEIGHT_PAINT)) {
+                                                       if(ob==modifiers_isDeformedByArmature(OBACT))
                                                                arm->flag |= ARM_POSEMODE;
                                                }
                                                draw_pose_paths(scene, v3d, rv3d, ob);
index b1fec793b09156ea305c20a3eb45c6be30bf73bd..a37e916064c25389ff43857a60693b04e91c6064 100644 (file)
@@ -1148,7 +1148,7 @@ static void mouse_select(bContext *C, short *mval, short extend, short obcenter,
                                        WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, basact->object);
                                        
                                        /* in weightpaint, we use selected bone to select vertexgroup, so no switch to new active object */
-                                       if(basact->object->mode & OB_MODE_WEIGHT_PAINT) {
+                                       if(BASACT && BASACT->object->mode & OB_MODE_WEIGHT_PAINT) {
                                                /* prevent activating */
                                                basact= NULL;
                                        }
index 776f2e47d1e2c5ba0b082ce75caded2fdd1a1a86..e59ec3746e36071ee64075132845eeb27b903ac4 100644 (file)
@@ -5289,7 +5289,7 @@ void createTransData(bContext *C, TransInfo *t)
                {
                        if(ob_armature->type==OB_ARMATURE)
                        {
-                               if(ob_armature->mode & OB_MODE_POSE)
+                               if((ob_armature->mode & OB_MODE_POSE) && ob_armature == modifiers_isDeformedByArmature(ob))
                                {
                                        createTransPose(C, t, ob_armature);
                                        break;