[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53481] trunk/blender/source/blender/ editors/sculpt_paint/paint_vertex.c: make wight-paint-through feature work in face select mode.

Campbell Barton ideasman42 at gmail.com
Tue Jan 1 13:51:09 CET 2013


Revision: 53481
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53481
Author:   campbellbarton
Date:     2013-01-01 12:51:08 +0000 (Tue, 01 Jan 2013)
Log Message:
-----------
make wight-paint-through feature work in face select mode. (still WIP, relies on selection flushing which currently ensured).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2013-01-01 12:47:58 UTC (rev 53480)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2013-01-01 12:51:08 UTC (rev 53481)
@@ -2193,8 +2193,9 @@
 	unsigned int index, totindex;
 	float alpha;
 	float mval[2];
-	int use_vert_sel;
-	int use_depth;
+	bool use_vert_sel;
+	bool use_face_sel;
+	bool use_depth;
 
 	MDeformWeight *(*dw_func)(MDeformVert *, const int) =
 	        (brush->vertexpaint_tool == PAINT_BLEND_BLUR) ?
@@ -2258,6 +2259,7 @@
 	swap_m4m4(wpd->vc.rv3d->persmat, mat);
 
 	use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0;
+	use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
 	use_depth = (vc->v3d->flag & V3D_ZBUF_SELECT);
 
 	/* which faces are involved */
@@ -2274,7 +2276,7 @@
 			else totindex = 0;
 		}
 
-		if ((me->editflag & ME_EDIT_PAINT_FACE_SEL) && me->mpoly) {
+		if (use_face_sel && me->mpoly) {
 			for (index = 0; index < totindex; index++) {
 				if (indexar[index] && indexar[index] <= me->totpoly) {
 					MPoly *mpoly = ((MPoly *)me->mpoly) + (indexar[index] - 1);
@@ -2341,9 +2343,17 @@
 		const unsigned int totvert = me->totvert;
 		unsigned int       i;
 
-		for (i = 0; i < totvert; i++) {
-			me->dvert[i].flag = use_vert_sel ? (me->mvert[i].flag & SELECT) : SELECT;
+		/* in the case of face selection we need to flush */
+		if (use_vert_sel || use_face_sel) {
+			for (i = 0; i < totvert; i++) {
+				me->dvert[i].flag = me->mvert[i].flag & SELECT;
+			}
 		}
+		else {
+			for (i = 0; i < totvert; i++) {
+				me->dvert[i].flag = SELECT;
+			}
+		}
 
 		if (brush->vertexpaint_tool == PAINT_BLEND_BLUR) {
 			for (i = 0; i < totvert; i++) {




More information about the Bf-blender-cvs mailing list