[Bf-blender-cvs] [661f5a24d16] blender2.8: DwM: Show face-mask overlay even with full-shading

Campbell Barton noreply at git.blender.org
Fri Jul 14 08:46:44 CEST 2017


Commit: 661f5a24d16191336b5067d554648ff0e58013f2
Author: Campbell Barton
Date:   Fri Jul 14 16:45:47 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB661f5a24d16191336b5067d554648ff0e58013f2

DwM: Show face-mask overlay even with full-shading

Without this face selection would be used but invisible,
display this over fully shaded surface.

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

M	source/blender/draw/intern/draw_manager.c
M	source/blender/draw/modes/paint_texture_mode.c
M	source/blender/draw/modes/paint_vertex_mode.c
M	source/blender/draw/modes/paint_weight_mode.c

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

diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 32dc1434715..8f1a2bd888d 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2836,9 +2836,7 @@ static void DRW_engines_enable(const Scene *scene, SceneLayer *sl)
 
 	if (DRW_state_draw_support()) {
 		DRW_engines_enable_from_object_mode();
-		if ((obact == NULL) || (DRW_object_is_mode_shade(obact) != false)) {
-			DRW_engines_enable_from_mode(mode);
-		}
+		DRW_engines_enable_from_mode(mode);
 	}
 }
 
diff --git a/source/blender/draw/modes/paint_texture_mode.c b/source/blender/draw/modes/paint_texture_mode.c
index ae6ee12ee7d..65ab9fd9286 100644
--- a/source/blender/draw/modes/paint_texture_mode.c
+++ b/source/blender/draw/modes/paint_texture_mode.c
@@ -211,7 +211,7 @@ static void PAINT_TEXTURE_cache_init(void *vedata)
 		Object *ob = draw_ctx->obact;
 		if (ob && ob->type == OB_MESH) {
 			Scene *scene = draw_ctx->scene;
-			bool use_material_slots = (scene->toolsettings->imapaint.mode == IMAGEPAINT_MODE_MATERIAL);
+			const bool use_material_slots = (scene->toolsettings->imapaint.mode == IMAGEPAINT_MODE_MATERIAL);
 			const Mesh *me = ob->data;
 
 			stl->g_data->shgroup_image_array = MEM_mallocN(
@@ -285,41 +285,44 @@ static void PAINT_TEXTURE_cache_populate(void *vedata, Object *ob)
 		/* Get geometry cache */
 		const Mesh *me = ob->data;
 		Scene *scene = draw_ctx->scene;
-		bool use_material_slots = (scene->toolsettings->imapaint.mode == IMAGEPAINT_MODE_MATERIAL);
+		const bool use_surface = DRW_object_is_mode_shade(ob) == true;
+		const bool use_material_slots = (scene->toolsettings->imapaint.mode == IMAGEPAINT_MODE_MATERIAL);
 		bool ok = false;
 
-		if (me->mloopuv != NULL) {
-			if (use_material_slots) {
-				struct Gwn_Batch **geom_array = me->totcol ? DRW_cache_mesh_surface_texpaint_get(ob) : NULL;
-				if ((me->totcol == 0) || (geom_array == NULL)) {
-					struct Gwn_Batch *geom = DRW_cache_mesh_surface_get(ob);
-					DRW_shgroup_call_add(stl->g_data->shgroup_fallback, geom, ob->obmat);
-					ok = true;
+		if (use_surface) {
+			if (me->mloopuv != NULL) {
+				if (use_material_slots) {
+					struct Gwn_Batch **geom_array = me->totcol ? DRW_cache_mesh_surface_texpaint_get(ob) : NULL;
+					if ((me->totcol == 0) || (geom_array == NULL)) {
+						struct Gwn_Batch *geom = DRW_cache_mesh_surface_get(ob);
+						DRW_shgroup_call_add(stl->g_data->shgroup_fallback, geom, ob->obmat);
+						ok = true;
+					}
+					else {
+						for (int i = 0; i < me->totcol; i++) {
+							if (stl->g_data->shgroup_image_array[i]) {
+								DRW_shgroup_call_add(stl->g_data->shgroup_image_array[i], geom_array[i], ob->obmat);
+							}
+							else {
+								DRW_shgroup_call_add(stl->g_data->shgroup_fallback, geom_array[i], ob->obmat);
+							}
+							ok = true;
+						}
+					}
 				}
 				else {
-					for (int i = 0; i < me->totcol; i++) {
-						if (stl->g_data->shgroup_image_array[i]) {
-							DRW_shgroup_call_add(stl->g_data->shgroup_image_array[i], geom_array[i], ob->obmat);
-						}
-						else {
-							DRW_shgroup_call_add(stl->g_data->shgroup_fallback, geom_array[i], ob->obmat);
-						}
+					struct Gwn_Batch *geom = DRW_cache_mesh_surface_texpaint_single_get(ob);
+					if (geom && stl->g_data->shgroup_image_array[0]) {
+						DRW_shgroup_call_add(stl->g_data->shgroup_image_array[0], geom, ob->obmat);
 						ok = true;
 					}
 				}
 			}
-			else {
-				struct Gwn_Batch *geom = DRW_cache_mesh_surface_texpaint_single_get(ob);
-				if (geom && stl->g_data->shgroup_image_array[0]) {
-					DRW_shgroup_call_add(stl->g_data->shgroup_image_array[0], geom, ob->obmat);
-					ok = true;
-				}
-			}
-		}
 
-		if (!ok) {
-			struct Gwn_Batch *geom = DRW_cache_mesh_surface_get(ob);
-			DRW_shgroup_call_add(stl->g_data->shgroup_fallback, geom, ob->obmat);
+			if (!ok) {
+				struct Gwn_Batch *geom = DRW_cache_mesh_surface_get(ob);
+				DRW_shgroup_call_add(stl->g_data->shgroup_fallback, geom, ob->obmat);
+			}
 		}
 
 		/* Face Mask */
diff --git a/source/blender/draw/modes/paint_vertex_mode.c b/source/blender/draw/modes/paint_vertex_mode.c
index ac3b82e9418..3d75068c4f2 100644
--- a/source/blender/draw/modes/paint_vertex_mode.c
+++ b/source/blender/draw/modes/paint_vertex_mode.c
@@ -144,15 +144,18 @@ static void PAINT_VERTEX_cache_populate(void *vedata, Object *ob)
 
 	if ((ob->type == OB_MESH) && (ob == draw_ctx->obact)) {
 		IDProperty *ces_mode_pw = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_PAINT_VERTEX, "");
-		bool use_wire = BKE_collection_engine_property_value_get_bool(ces_mode_pw, "use_wire");
 		const Mesh *me = ob->data;
+		const bool use_wire = BKE_collection_engine_property_value_get_bool(ces_mode_pw, "use_wire");
+		const bool use_surface = DRW_object_is_mode_shade(ob) == true;
 		const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
 		struct Gwn_Batch *geom;
 
 		world_light = BKE_collection_engine_property_value_get_bool(ces_mode_pw, "use_shading") ? 0.5f : 1.0f;
 
-		geom = DRW_cache_mesh_surface_vert_colors_get(ob);
-		DRW_shgroup_call_add(stl->g_data->fvcolor_shgrp, geom, ob->obmat);
+		if (use_surface) {
+			geom = DRW_cache_mesh_surface_vert_colors_get(ob);
+			DRW_shgroup_call_add(stl->g_data->fvcolor_shgrp, geom, ob->obmat);
+		}
 
 		if (use_face_sel || use_wire) {
 			geom = DRW_cache_mesh_edges_paint_overlay_get(ob, use_wire, use_face_sel);
diff --git a/source/blender/draw/modes/paint_weight_mode.c b/source/blender/draw/modes/paint_weight_mode.c
index 6a46acd869b..809be5ef8b1 100644
--- a/source/blender/draw/modes/paint_weight_mode.c
+++ b/source/blender/draw/modes/paint_weight_mode.c
@@ -180,16 +180,19 @@ static void PAINT_WEIGHT_cache_populate(void *vedata, Object *ob)
 
 	if ((ob->type == OB_MESH) && (ob == draw_ctx->obact)) {
 		IDProperty *ces_mode_pw = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_PAINT_WEIGHT, "");
-		bool use_wire = BKE_collection_engine_property_value_get_bool(ces_mode_pw, "use_wire");
 		const Mesh *me = ob->data;
+		const bool use_wire = BKE_collection_engine_property_value_get_bool(ces_mode_pw, "use_wire");
+		const bool use_surface = DRW_object_is_mode_shade(ob) == true;
 		const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
 		const bool use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0;
 		struct Gwn_Batch *geom;
 
 		world_light = BKE_collection_engine_property_value_get_bool(ces_mode_pw, "use_shading") ? 0.5f : 1.0f;
 
-		geom = DRW_cache_mesh_surface_weights_get(ob);
-		DRW_shgroup_call_add(stl->g_data->fweights_shgrp, geom, ob->obmat);
+		if (use_surface) {
+			geom = DRW_cache_mesh_surface_weights_get(ob);
+			DRW_shgroup_call_add(stl->g_data->fweights_shgrp, geom, ob->obmat);
+		}
 
 		if (use_face_sel || use_wire) {
 			geom = DRW_cache_mesh_edges_paint_overlay_get(ob, use_wire, use_face_sel);




More information about the Bf-blender-cvs mailing list