fix from 2.5x r26079
authorCampbell Barton <ideasman42@gmail.com>
Mon, 18 Jan 2010 16:31:33 +0000 (16:31 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 18 Jan 2010 16:31:33 +0000 (16:31 +0000)
source/blender/src/vpaint.c

index 2b4c4b3..cb6a097 100644 (file)
@@ -1125,16 +1125,17 @@ void weight_paint(void)
        if(ob->actdef<=0) {
                Object *modob;
                if((modob = modifiers_isDeformedByArmature(ob))) {
+                       bArmature *arm= modob->data;
                        bPoseChannel *pchan;
                        for(pchan= modob->pose->chanbase.first; pchan; pchan= pchan->next)
-                               if(pchan->bone->flag & SELECT)
+                               if((pchan->bone->flag & SELECT) && (pchan->bone->layer & arm->layer))
                                        break;
                        if(pchan) {
                                bDeformGroup *dg= get_named_vertexgroup(ob, pchan->name);
                                if(dg==NULL)
                                        dg= add_defgroup_name(ob, pchan->name); /* sets actdef */
                                else
-                                       ob->actdef= get_defgroup_num(ob, dg);
+                                       ob->actdef= 1 + get_defgroup_num(ob, dg);
                                allqueue(REDRAWBUTSEDIT, 0);
                        }
                }