[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37029] branches/soc-2011-radish/source/ blender/editors/sculpt_paint/paint_vertex.c: paint_vertex.c

Jason Hays jason_hays22 at mymail.eku.edu
Tue May 31 02:52:03 CEST 2011


Revision: 37029
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37029
Author:   jason_hays22
Date:     2011-05-31 00:52:02 +0000 (Tue, 31 May 2011)
Log Message:
-----------
paint_vertex.c
Tweaked get_locked_flag() so 'i' wasn't initialized twice

Fixed a problem in do_weight_paint_vertex() that involved accidentally auto normalizing a locked group incorrectly if you painted an unlocked group.

Modified Paths:
--------------
    branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_vertex.c

Modified: branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_vertex.c	2011-05-30 18:57:28 UTC (rev 37028)
+++ branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_vertex.c	2011-05-31 00:52:02 UTC (rev 37029)
@@ -1077,13 +1077,28 @@
 /* Jason was here */
 static char get_locked_flag(Object *ob, int vgroup)
 {
-	int i = 0;
+	int i;
 	bDeformGroup *defgroup = ob->defbase.first;
 	for(i = 0; i < vgroup && defgroup; i++) {
 		defgroup = defgroup->next;
 	}
-	return defgroup->flag;
+	if(defgroup) {
+		return defgroup->flag;
+	}
+	return 0;
 }
+/* Jason was here */
+static int locked_group_exists(Object *ob)
+{
+	bDeformGroup *defgroup = ob->defbase.first;
+	while(defgroup) {
+		if(defgroup->flag){
+			return TRUE;
+		}
+		defgroup = defgroup->next;
+	}
+	return FALSE;
+}
 
 /*Jason was here
 not sure where these prototypes belong at them moment
@@ -1171,6 +1186,7 @@
 	
 	/* Jason was here */
 	char locked;
+	int lge = 0;
 	float oldw;
 
 	if(wp->flag & VP_ONLYVGROUP) {
@@ -1193,7 +1209,9 @@
 	if(locked) {
 		fix_weight_ratios(me, dw, oldw);
 		do_wp_auto_normalize_locked_groups(me, me->dvert, validmap);
-	}else {
+	} else if((lge = locked_group_exists(ob))) {
+		do_wp_auto_normalize_locked_groups(me, me->dvert, validmap);
+	} else {
 		do_weight_paint_auto_normalize(me->dvert+index, vgroup, validmap);
 	}
 	if(me->editflag & ME_EDIT_MIRROR_X) {	/* x mirror painting */
@@ -1212,6 +1230,8 @@
 			if(locked) {
 				fix_weight_ratios(me, uw, oldw);
 				do_wp_auto_normalize_locked_groups(me, me->dvert, validmap);
+			} else if(lge) {
+				do_wp_auto_normalize_locked_groups(me, me->dvert, validmap);
 			} else {
 				do_weight_paint_auto_normalize(me->dvert+j, vgroup, validmap);
 			}




More information about the Bf-blender-cvs mailing list