diff --git a/source/blender/draw/engines/overlay/overlay_edit_uv.cc b/source/blender/draw/engines/overlay/overlay_edit_uv.cc index 90c83357477..253fc8f34d7 100644 --- a/source/blender/draw/engines/overlay/overlay_edit_uv.cc +++ b/source/blender/draw/engines/overlay/overlay_edit_uv.cc @@ -117,10 +117,10 @@ void OVERLAY_edit_uv_init(OVERLAY_Data *vedata) const bool show_modified_uvs = sima->flag & SI_DRAWSHADOW; const bool is_tiled_image = image && (image->source == IMA_SRC_TILED); const bool do_edges_only = (ts->uv_flag & UV_SYNC_SELECTION) ? - /* NOTE: Ignore #SCE_SELECT_EDGE because a single selected edge - * on the mesh may cause single UV vertices to be selected. */ - false : - (ts->uv_selectmode == UV_SELECT_EDGE); + /* NOTE: Ignore #SCE_SELECT_EDGE because a single selected edge + * on the mesh may cause single UV vertices to be selected. */ + false : + (ts->uv_selectmode == UV_SELECT_EDGE); const bool do_faces = ((sima->flag & SI_NO_DRAWFACES) == 0); const bool do_face_dots = (ts->uv_flag & UV_SYNC_SELECTION) ? (ts->selectmode & SCE_SELECT_FACE) != 0 : @@ -441,7 +441,7 @@ static void overlay_edit_uv_cache_populate(OVERLAY_Data *vedata, Object *ob) GPUBatch *geom; const DRWContextState *draw_ctx = DRW_context_state_get(); - const bool is_edit_object = DRW_object_is_in_edit_mode(ob); + const bool is_edit_object = DRW_object_should_not_occlude(ob); Mesh *me = (Mesh *)ob->data; const bool has_active_object_uvmap = CustomData_get_active_layer(&me->ldata, CD_PROP_FLOAT2) != -1; diff --git a/source/blender/draw/engines/overlay/overlay_engine.cc b/source/blender/draw/engines/overlay/overlay_engine.cc index 0fcfc76e5ca..b1e495d82c5 100644 --- a/source/blender/draw/engines/overlay/overlay_engine.cc +++ b/source/blender/draw/engines/overlay/overlay_engine.cc @@ -247,7 +247,7 @@ BLI_INLINE OVERLAY_DupliData *OVERLAY_duplidata_get(Object *ob, void *vedata, bo static bool overlay_object_is_edit_mode(const OVERLAY_PrivateData *pd, const Object *ob) { - if (DRW_object_is_in_edit_mode(ob)) { + if (DRW_object_should_not_occlude(ob)) { /* Also check for context mode as the object mode is not 100% reliable. (see #72490) */ switch (ob->type) { case OB_MESH: diff --git a/source/blender/draw/engines/overlay/overlay_wireframe.cc b/source/blender/draw/engines/overlay/overlay_wireframe.cc index 67f80e5844b..d278e98aecd 100644 --- a/source/blender/draw/engines/overlay/overlay_wireframe.cc +++ b/source/blender/draw/engines/overlay/overlay_wireframe.cc @@ -171,7 +171,7 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata, const bool all_wires = (ob->dtx & OB_DRAW_ALL_EDGES) != 0; const bool is_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0; const bool is_mesh = ob->type == OB_MESH; - const bool is_edit_mode = DRW_object_is_in_edit_mode(ob); + const bool is_edit_mode = DRW_object_should_not_occlude(ob); bool has_edit_mesh_cage = false; bool is_mesh_verts_only = false; if (is_mesh) { @@ -289,7 +289,7 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata, const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d) && !DRW_state_is_image_render(); const bool is_instance = (ob->base_flag & BASE_FROM_DUPLI); - const bool instance_parent_in_edit_mode = is_instance ? DRW_object_is_in_edit_mode( + const bool instance_parent_in_edit_mode = is_instance ? DRW_object_should_not_occlude( DRW_object_get_dupli_parent(ob)) : false; const bool use_coloring = (use_wire && !is_edit_mode && !is_sculpt_mode && diff --git a/source/blender/draw/engines/select/select_engine.c b/source/blender/draw/engines/select/select_engine.c index 1cf5586c146..79621f4be87 100644 --- a/source/blender/draw/engines/select/select_engine.c +++ b/source/blender/draw/engines/select/select_engine.c @@ -217,7 +217,7 @@ static void select_cache_populate(void *vedata, Object *ob) const bool retopology_occlusion = RETOPOLOGY_ENABLED(draw_ctx->v3d) && !XRAY_ENABLED(draw_ctx->v3d); - if (retopology_occlusion && !DRW_object_is_in_edit_mode(ob)) { + if (retopology_occlusion && !DRW_object_should_not_occlude(ob)) { if (ob->dt >= OB_SOLID) { struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_surface(ob->data); DRW_shgroup_call_obmat(stl->g_data->shgrp_occlude, geom_faces, ob->object_to_world); diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index f4406dbdca0..64439da3357 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -876,7 +876,7 @@ bool DRW_object_is_renderable(const struct Object *ob); * it is in edit mode, when another object with the same mesh is in edit mode. * This will not be the case when one of the objects are influenced by modifiers. */ -bool DRW_object_is_in_edit_mode(const struct Object *ob); +bool DRW_object_should_not_occlude(const struct Object *ob); /** * Return whether this object is visible depending if * we are rendering or drawing in the viewport. diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 4240126e35f..4d7e2dbd7f7 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -3315,7 +3315,7 @@ void drw_batch_cache_generate_requested(Object *ob) const bool use_hide = ((ob->type == OB_MESH) && ((is_paint_mode && (ob == draw_ctx->obact) && DRW_object_use_hide_faces(ob)) || - ((mode == CTX_MODE_EDIT_MESH) && DRW_object_is_in_edit_mode(ob)))); + ((mode == CTX_MODE_EDIT_MESH) && DRW_object_should_not_occlude(ob)))); switch (ob->type) { case OB_MESH: @@ -3353,7 +3353,7 @@ void drw_batch_cache_generate_requested_evaluated_mesh_or_curve(Object *ob) const bool use_hide = ((ob->type == OB_MESH) && ((is_paint_mode && (ob == draw_ctx->obact) && DRW_object_use_hide_faces(ob)) || - ((mode == CTX_MODE_EDIT_MESH) && DRW_object_is_in_edit_mode(ob)))); + ((mode == CTX_MODE_EDIT_MESH) && DRW_object_should_not_occlude(ob)))); Mesh *mesh = BKE_object_get_evaluated_mesh_no_subsurf(ob); /* Try getting the mesh first and if that fails, try getting the curve data. diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.cc b/source/blender/draw/intern/draw_cache_impl_mesh.cc index 10ab77e2dab..bba6e2af3d8 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.cc +++ b/source/blender/draw/intern/draw_cache_impl_mesh.cc @@ -1383,10 +1383,10 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, const bool is_editmode = (me->edit_mesh != nullptr) && (BKE_object_get_editmesh_eval_final(ob) != nullptr) && - DRW_object_is_in_edit_mode(ob); + DRW_object_should_not_occlude(ob); /* This could be set for paint mode too, currently it's only used for edit-mode. */ - const bool is_mode_active = is_editmode && DRW_object_is_in_edit_mode(ob); + const bool is_mode_active = is_editmode && DRW_object_should_not_occlude(ob); DRWBatchFlag batch_requested = cache->batch_requested; cache->batch_requested = (DRWBatchFlag)0; diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index ae874e44414..f7187bc1171 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -186,7 +186,7 @@ bool DRW_object_is_renderable(const Object *ob) BLI_assert((ob->base_flag & BASE_ENABLED_AND_MAYBE_VISIBLE_IN_VIEWPORT) != 0); if (ob->type == OB_MESH) { - if ((ob == DST.draw_ctx.object_edit) || DRW_object_is_in_edit_mode(ob)) { + if ((ob == DST.draw_ctx.object_edit) || DRW_object_should_not_occlude(ob)) { View3D *v3d = DST.draw_ctx.v3d; if (v3d && RETOPOLOGY_ENABLED(v3d)) { return false; @@ -197,7 +197,7 @@ bool DRW_object_is_renderable(const Object *ob) return true; } -bool DRW_object_is_in_edit_mode(const Object *ob) +bool DRW_object_should_not_occlude(const Object *ob) { if (BKE_object_is_in_editmode(ob)) { if (ELEM(ob->type, OB_MESH, OB_CURVES)) { @@ -207,6 +207,12 @@ bool DRW_object_is_in_edit_mode(const Object *ob) } return true; } + if ((ob->mode & OB_MODE_VERTEX_PAINT) || (ob->mode & OB_MODE_WEIGHT_PAINT)) { + Mesh *me = ob->data; + if ((ME_EDIT_PAINT_SEL_MODE(me))) { + return true; + } + } return false; } @@ -2788,7 +2794,7 @@ void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d, cons * It also has non-mesh objects however, which are not supported here. */ continue; } - if (DRW_object_is_in_edit_mode(ob)) { + if (DRW_object_should_not_occlude(ob)) { /* Only background (non-edit) objects are used for occlusion. */ continue; }