[Bf-blender-cvs] [9afab70] master: Partial Fix T47221: Sculpt Hide fails w/ texture drawing

Campbell Barton noreply at git.blender.org
Tue Feb 2 07:37:02 CET 2016


Commit: 9afab7098519e5044664580dc1c3117918549383
Author: Campbell Barton
Date:   Tue Feb 2 16:06:45 2016 +1100
Branches: master
https://developer.blender.org/rB9afab7098519e5044664580dc1c3117918549383

Partial Fix T47221: Sculpt Hide fails w/ texture drawing

Support for skipping hidden faces in sculpt mode w/ texture drawing.

===================================================================

M	source/blender/blenkernel/intern/cdderivedmesh.c
M	source/blender/editors/space_view3d/drawmesh.c

===================================================================

diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 9026972..0d3848f 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -498,7 +498,8 @@ static void cdDM_drawFacesTex_common(
 	const  MLoopCol *mloopcol;
 	int i;
 	int colType, start_element, tot_drawn;
-	bool use_tface = (uvflag & DM_DRAW_USE_ACTIVE_UV) != 0;
+	const bool use_hide = (uvflag & DM_DRAW_SKIP_HIDDEN) != 0;
+	const bool use_tface = (uvflag & DM_DRAW_USE_ACTIVE_UV) != 0;
 	int totpoly;
 	int next_actualFace;
 	int mat_index;
@@ -570,7 +571,10 @@ static void cdDM_drawFacesTex_common(
 			if (i != totpoly - 1)
 				next_actualFace = bufmat->polys[i + 1];
 
-			if (drawParams) {
+			if (use_hide && (mpoly[actualFace].flag & ME_HIDE)) {
+				draw_option = DM_DRAW_OPTION_SKIP;
+			}
+			else if (drawParams) {
 				MTexPoly *tp = use_tface && mtexpoly ? &mtexpoly[actualFace] : NULL;
 				draw_option = drawParams(tp, (mloopcol != NULL), mpoly[actualFace].mat_nr);
 			}
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 11ba6fb..5ded3a9 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -942,7 +942,6 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d
                                    Object *ob, DerivedMesh *dm, const int draw_flags)
 {
 	Mesh *me = ob->data;
-	DMDrawFlag uvflag = DM_DRAW_USE_ACTIVE_UV;
 
 	/* correct for negative scale */
 	if (ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
@@ -953,10 +952,6 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d
 
 	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
 
-	if (ob->mode & OB_MODE_TEXTURE_PAINT) {
-		uvflag = DM_DRAW_USE_TEXPAINT_UV;
-	}
-
 	if (ob->mode & OB_MODE_EDIT) {
 		drawEMTFMapped_userData data;
 
@@ -969,34 +964,54 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d
 
 		dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, compareDrawOptionsEm, &data, 0);
 	}
-	else if (draw_flags & DRAW_FACE_SELECT) {
-		if (ob->mode & OB_MODE_WEIGHT_PAINT)
-			dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_facemask, GPU_object_material_bind, NULL, me,
-			                    DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH | DM_DRAW_SKIP_HIDDEN);
+	else if ((draw_flags & DRAW_FACE_SELECT) &&
+	         (ob->mode & OB_MODE_WEIGHT_PAINT))
+	{
+		dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_facemask, GPU_object_material_bind, NULL, me,
+		                    DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH | DM_DRAW_SKIP_HIDDEN);
+	}
+	else {
+		DMDrawFlag uvflag;
+		drawTFace_userData userData;
+
+		if (ob->mode & OB_MODE_TEXTURE_PAINT) {
+			uvflag = DM_DRAW_USE_TEXPAINT_UV;
+		}
 		else {
-			drawTFace_userData userData;
+			uvflag = DM_DRAW_USE_ACTIVE_UV;
+		}
 
-			userData.mpoly = DM_get_poly_data_layer(dm, CD_MPOLY);
-			userData.mtexpoly = DM_get_poly_data_layer(dm, CD_MTEXPOLY);
-			userData.me = me;
-			dm->drawMappedFacesTex(dm, me->mpoly ? draw_tface_mapped__set_draw : NULL, compareDrawOptions, &userData, uvflag);
+		if ((ob->mode & OB_MODE_SCULPT) && (ob == OBACT)) {
+			uvflag |= DM_DRAW_SKIP_HIDDEN;
 		}
-	}
-	else {		
-		drawTFace_userData userData;
-		
-		update_tface_color_layer(dm, !(ob->mode & OB_MODE_TEXTURE_PAINT));
-		
+
+
 		userData.mpoly = DM_get_poly_data_layer(dm, CD_MPOLY);
 		userData.mtexpoly = DM_get_poly_data_layer(dm, CD_MTEXPOLY);
-		userData.me = NULL;
-		
-		dm->drawFacesTex(dm, draw_tface__set_draw, compareDrawOptions, &userData, uvflag);
+
+		if (draw_flags & DRAW_FACE_SELECT) {
+			userData.me = me;
+
+			dm->drawMappedFacesTex(
+			        dm, me->mpoly ? draw_tface_mapped__set_draw : NULL, compareDrawOptions,
+			        &userData, uvflag);
+		}
+		else {
+			userData.me = NULL;
+
+			update_tface_color_layer(dm, !(ob->mode & OB_MODE_TEXTURE_PAINT));
+			dm->drawFacesTex(
+			        dm, draw_tface__set_draw, compareDrawOptions,
+			        &userData, uvflag);
+		}
 	}
 
 	/* draw game engine text hack */
-	if (BKE_bproperty_object_get(ob, "Text"))
-		draw_mesh_text(scene, ob, 0);
+	if (rv3d->rflag & RV3D_IS_GAME_ENGINE) {
+		if (BKE_bproperty_object_get(ob, "Text")) {
+			draw_mesh_text(scene, ob, 0);
+		}
+	}
 
 	draw_textured_end();




More information about the Bf-blender-cvs mailing list