diff options
-rw-r--r-- | source/blender/draw/modes/paint_vertex_mode.c | 9 | ||||
-rw-r--r-- | source/blender/draw/modes/paint_weight_mode.c | 12 |
2 files changed, 12 insertions, 9 deletions
diff --git a/source/blender/draw/modes/paint_vertex_mode.c b/source/blender/draw/modes/paint_vertex_mode.c index 1853ff4c877..f65db8686c0 100644 --- a/source/blender/draw/modes/paint_vertex_mode.c +++ b/source/blender/draw/modes/paint_vertex_mode.c @@ -145,7 +145,8 @@ 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"); - char flag = ((Mesh *)ob->data)->editflag; + const Mesh *me = ob->data; + const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0; struct Batch *geom; world_light = BKE_collection_engine_property_value_get_bool(ces_mode_pw, "use_shading") ? 0.5f : 1.0f; @@ -153,12 +154,12 @@ static void PAINT_VERTEX_cache_populate(void *vedata, Object *ob) geom = DRW_cache_mesh_surface_vert_colors_get(ob); DRW_shgroup_call_add(stl->g_data->fvcolor_shgrp, geom, ob->obmat); - if (flag & ME_EDIT_PAINT_FACE_SEL || use_wire) { - geom = DRW_cache_mesh_edges_paint_overlay_get(ob, use_wire, flag & ME_EDIT_PAINT_FACE_SEL); + if (use_face_sel || use_wire) { + geom = DRW_cache_mesh_edges_paint_overlay_get(ob, use_wire, use_face_sel); DRW_shgroup_call_add(stl->g_data->lwire_shgrp, geom, ob->obmat); } - if (flag & ME_EDIT_PAINT_FACE_SEL) { + if (use_face_sel) { geom = DRW_cache_mesh_faces_weight_overlay_get(ob); DRW_shgroup_call_add(stl->g_data->face_shgrp, geom, ob->obmat); } diff --git a/source/blender/draw/modes/paint_weight_mode.c b/source/blender/draw/modes/paint_weight_mode.c index 7bf61b0a133..7139d634686 100644 --- a/source/blender/draw/modes/paint_weight_mode.c +++ b/source/blender/draw/modes/paint_weight_mode.c @@ -173,7 +173,9 @@ 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"); - char flag = ((Mesh *)ob->data)->editflag; + const Mesh *me = ob->data; + 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 Batch *geom; world_light = BKE_collection_engine_property_value_get_bool(ces_mode_pw, "use_shading") ? 0.5f : 1.0f; @@ -181,17 +183,17 @@ static void PAINT_WEIGHT_cache_populate(void *vedata, Object *ob) geom = DRW_cache_mesh_surface_weights_get(ob); DRW_shgroup_call_add(stl->g_data->fweights_shgrp, geom, ob->obmat); - if (flag & ME_EDIT_PAINT_FACE_SEL || use_wire) { - geom = DRW_cache_mesh_edges_paint_overlay_get(ob, use_wire, flag & ME_EDIT_PAINT_FACE_SEL); + if (use_face_sel || use_wire) { + geom = DRW_cache_mesh_edges_paint_overlay_get(ob, use_wire, use_face_sel); DRW_shgroup_call_add(stl->g_data->lwire_shgrp, geom, ob->obmat); } - if (flag & ME_EDIT_PAINT_FACE_SEL) { + if (use_face_sel) { geom = DRW_cache_mesh_faces_weight_overlay_get(ob); DRW_shgroup_call_add(stl->g_data->face_shgrp, geom, ob->obmat); } - if (flag & ME_EDIT_PAINT_VERT_SEL) { + if (use_vert_sel) { geom = DRW_cache_mesh_verts_weight_overlay_get(ob); DRW_shgroup_call_add(stl->g_data->vert_shgrp, geom, ob->obmat); } |