[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26079] trunk/blender/source/blender: revert for last commit, this should fix the proplem properly.

Campbell Barton ideasman42 at gmail.com
Mon Jan 18 17:21:23 CET 2010


Revision: 26079
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26079
Author:   campbellbarton
Date:     2010-01-18 17:21:23 +0100 (Mon, 18 Jan 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/deform.c
    trunk/blender/source/blender/editors/object/object_vgroup.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c

Modified: trunk/blender/source/blender/blenkernel/intern/deform.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/deform.c	2010-01-18 15:33:43 UTC (rev 26078)
+++ trunk/blender/source/blender/blenkernel/intern/deform.c	2010-01-18 16:21:23 UTC (rev 26079)
@@ -166,6 +166,8 @@
 	 * (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;

Modified: trunk/blender/source/blender/editors/object/object_vgroup.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_vgroup.c	2010-01-18 15:33:43 UTC (rev 26078)
+++ trunk/blender/source/blender/editors/object/object_vgroup.c	2010-01-18 16:21:23 UTC (rev 26079)
@@ -464,7 +464,7 @@
 		}
 	}
 
-	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 *********************/

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2010-01-18 15:33:43 UTC (rev 26078)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2010-01-18 16:21:23 UTC (rev 26079)
@@ -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 @@
 	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");
 	





More information about the Bf-blender-cvs mailing list