Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-10-19 19:35:46 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-19 19:35:46 +0400
commit0a12a9bc7dd38979410156187472f25e5164e1f0 (patch)
tree92d7d18d3ba34db1bade15b4538597ae2a44cb52 /source
parent26249043e61376ad1ab997685684757bb77b9711 (diff)
[#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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 0df2888f4a0..f9af8bd5e79 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -168,6 +168,7 @@ static int draw_tfaces3D__setSelectOpts(void *userData, int index)
return flags & eEdge_Select;
}
+#if 0
static int draw_tfaces3D__setActiveOpts(void *userData, int index)
{
struct { Mesh *me; EdgeHash *eh; } *data = userData;
@@ -191,8 +192,21 @@ static int draw_tfaces3D__drawFaceOpts(void *userData, int index)
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;
@@ -203,17 +217,17 @@ static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
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 @@ static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
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 @@ static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
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 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
/* 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);