revert for last commit, this should fix the proplem properly.
- selected bones on hidden layers would be selected for weight painting (confusing to the user). use the 'active' bone instead. - when no weight group was set, the index used for the bone group was off by 1.
This commit is contained in:
@@ -166,6 +166,8 @@ int get_defgroup_num (Object *ob, bDeformGroup *dg)
|
||||
* (this number is stored in the deform
|
||||
* weights of the deform verts to link them
|
||||
* to this deform group).
|
||||
*
|
||||
* note: this is zero based, ob->actdef starts at 1.
|
||||
*/
|
||||
|
||||
bDeformGroup *eg;
|
||||
|
||||
@@ -464,7 +464,7 @@ void ED_vgroup_select_by_name(Object *ob, char *name)
|
||||
}
|
||||
}
|
||||
|
||||
ob->actdef= 1; // this signals on painting to create a new one, if a bone in posemode is selected */
|
||||
ob->actdef= 0; // this signals on painting to create a new one, if a bone in posemode is selected */
|
||||
}
|
||||
|
||||
/********************** Operator Implementations *********************/
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
#include "RNA_define.h"
|
||||
|
||||
#include "BKE_armature.h"
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_brush.h"
|
||||
#include "BKE_DerivedMesh.h"
|
||||
#include "BKE_cloth.h"
|
||||
@@ -1380,22 +1381,23 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *event)
|
||||
if(ob->actdef<=0) {
|
||||
Object *modob;
|
||||
if((modob = modifiers_isDeformedByArmature(ob))) {
|
||||
bPoseChannel *pchan;
|
||||
for(pchan= modob->pose->chanbase.first; pchan; pchan= pchan->next)
|
||||
if(pchan->bone->flag & SELECT)
|
||||
break;
|
||||
if(pchan) {
|
||||
bDeformGroup *dg= get_named_vertexgroup(ob, pchan->name);
|
||||
if(dg==NULL)
|
||||
dg= ED_vgroup_add_name(ob, pchan->name); /* sets actdef */
|
||||
else
|
||||
ob->actdef= get_defgroup_num(ob, dg);
|
||||
Bone *actbone= ((bArmature *)modob->data)->act_bone;
|
||||
if(actbone) {
|
||||
bPoseChannel *pchan= get_pose_channel(modob->pose, actbone->name);
|
||||
|
||||
if(pchan) {
|
||||
bDeformGroup *dg= get_named_vertexgroup(ob, pchan->name);
|
||||
if(dg==NULL)
|
||||
dg= ED_vgroup_add_name(ob, pchan->name); /* sets actdef */
|
||||
else
|
||||
ob->actdef= 1 + get_defgroup_num(ob, dg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ob->defbase.first==NULL) {
|
||||
ED_vgroup_add(ob);
|
||||
}
|
||||
}
|
||||
|
||||
// if(ob->lay & v3d->lay); else error("Active object is not in this layer");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user