diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-07-14 09:45:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-07-14 09:45:47 +0300 |
commit | 661f5a24d16191336b5067d554648ff0e58013f2 (patch) | |
tree | f1aa29414ed0fb5d7a57fcaf2490530c7f6caa8c /source/blender/draw/modes | |
parent | 25dba156bec73cf05c87a59bbf28b401049643bb (diff) |
DwM: Show face-mask overlay even with full-shading
Without this face selection would be used but invisible,
display this over fully shaded surface.
Diffstat (limited to 'source/blender/draw/modes')
-rw-r--r-- | source/blender/draw/modes/paint_texture_mode.c | 57 | ||||
-rw-r--r-- | source/blender/draw/modes/paint_vertex_mode.c | 9 | ||||
-rw-r--r-- | source/blender/draw/modes/paint_weight_mode.c | 9 |
3 files changed, 42 insertions, 33 deletions
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); |