[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32602] trunk/blender/source/blender/ editors/space_view3d/drawmesh.c: [#24325] Texture painting using selected faces mask

Campbell Barton ideasman42 at gmail.com
Tue Oct 19 17:35:46 CEST 2010


Revision: 32602
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32602
Author:   campbellbarton
Date:     2010-10-19 17:35:46 +0200 (Tue, 19 Oct 2010)

Log Message:
-----------
[#24325] Texture painting using selected faces mask
draw a subtle grey over unselected faces rather then coloring selected faces which got in the way of seeing the colors while painting.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/drawmesh.c

Modified: trunk/blender/source/blender/editors/space_view3d/drawmesh.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawmesh.c	2010-10-19 14:11:46 UTC (rev 32601)
+++ trunk/blender/source/blender/editors/space_view3d/drawmesh.c	2010-10-19 15:35:46 UTC (rev 32602)
@@ -168,6 +168,7 @@
 	return flags & eEdge_Select;
 }
 
+#if 0
 static int draw_tfaces3D__setActiveOpts(void *userData, int index)
 {
 	struct { Mesh *me; EdgeHash *eh; } *data = userData;
@@ -191,9 +192,22 @@
 	else
 		return 0;
 }
+#endif
 
-static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
+/* draws unselected */
+static int draw_tfaces3D__drawFaceOptsInv(void *userData, int index)
 {
+	Mesh *me = (Mesh*)userData;
+
+	MFace *mface = &me->mface[index];
+	if (!(mface->flag&ME_HIDE) && !(mface->flag&ME_FACE_SEL))
+		return 2; /* Don't set color */
+	else
+		return 0;
+}
+
+static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, short draw_seams)
+{
 	struct { Mesh *me; EdgeHash *eh; } data;
 
 	data.me = me;
@@ -203,17 +217,17 @@
 	glDisable(GL_LIGHTING);
 	bglPolygonOffset(rv3d->dist, 1.0);
 
-		/* Draw (Hidden) Edges */
+	/* Draw (Hidden) Edges */
+	setlinestyle(1);
 	UI_ThemeColor(TH_EDGE_FACESEL);
 	dm->drawMappedEdges(dm, draw_tfaces3D__setHiddenOpts, &data);
+	setlinestyle(0);
 
-		/* Draw Seams */
-	if(me->drawflag & ME_DRAWSEAMS) {
+	/* Draw Seams */
+	if(draw_seams && me->drawflag & ME_DRAWSEAMS) {
 		UI_ThemeColor(TH_EDGE_SEAM);
 		glLineWidth(2);
-
 		dm->drawMappedEdges(dm, draw_tfaces3D__setSeamOpts, &data);
-
 		glLineWidth(1);
 	}
 
@@ -221,10 +235,16 @@
 	if(me->drawflag & ME_DRAWFACES) {
 		glEnable(GL_BLEND);
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+#if 0
 		UI_ThemeColor4(TH_FACE_SELECT);
 
 		dm->drawMappedFacesTex(dm, draw_tfaces3D__drawFaceOpts, (void*)me);
-
+#else
+		/* dull unselected faces so as not to get in the way of seeing color */
+		glColor4ub(96, 96, 96, 64);
+		dm->drawMappedFacesTex(dm, draw_tfaces3D__drawFaceOptsInv, (void*)me);
+#endif
+		
 		glDisable(GL_BLEND);
 	}
 	
@@ -236,8 +256,6 @@
 	dm->drawMappedEdges(dm, draw_tfaces3D__setSelectOpts, &data);
 	setlinestyle(0);
 
-	dm->drawMappedEdges(dm, draw_tfaces3D__setActiveOpts, &data);
-
 	bglPolygonOffset(rv3d->dist, 0.0);	// resets correctly now, even after calling accumulated offsets
 
 	BLI_edgehash_free(data.eh, NULL);
@@ -671,7 +689,7 @@
 	
 	/* draw edges and selected faces over textured mesh */
 	if(!(ob == scene->obedit) && faceselect)
-		draw_tfaces3D(rv3d, me, dm);
+		draw_tfaces3D(rv3d, me, dm, ob->mode & OB_MODE_WEIGHT_PAINT);
 
 	/* reset from negative scale correction */
 	glFrontFace(GL_CCW);





More information about the Bf-blender-cvs mailing list