diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-01-18 19:21:23 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-01-18 19:21:23 +0300 |
commit | 13f28b6fa4dfe933231213d0a0920bf9fbd2e205 (patch) | |
tree | e6b808f0f108ab5c49a86062060a78e8e61f1441 /source | |
parent | 8cf6b390e3888c77265b9b34740fb52599a96d7f (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/deform.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 24 |
3 files changed, 16 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index c4d5f4952b6..38d4d722a46 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -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; diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index a9904ee7f1e..23411d2219f 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -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 *********************/ diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 52a71352768..470cda91b45 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -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"); |