diff options
Diffstat (limited to 'source')
5 files changed, 26 insertions, 20 deletions
diff --git a/source/blender/draw/engines/select/select_draw_utils.c b/source/blender/draw/engines/select/select_draw_utils.c index 241a05d0feb..745c55405de 100644 --- a/source/blender/draw/engines/select/select_draw_utils.c +++ b/source/blender/draw/engines/select/select_draw_utils.c @@ -40,6 +40,25 @@ /** \name Draw Utilities * \{ */ +short select_id_get_object_select_mode(Scene *scene, Object *ob) +{ + short r_select_mode = 0; + if (ob->mode & (OB_MODE_WEIGHT_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT)) { + Mesh *me_orig = DEG_get_original_object(ob)->data; + if (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL) { + r_select_mode = SCE_SELECT_FACE; + } + if (me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) { + r_select_mode |= SCE_SELECT_VERTEX; + } + } + else { + r_select_mode = scene->toolsettings->selectmode; + } + + return r_select_mode; +} + static bool check_ob_drawface_dot(short select_mode, const View3D *v3d, char dt) { if (select_mode & SCE_SELECT_FACE) { @@ -189,16 +208,6 @@ void select_id_draw_object(void *vedata, r_face_offset); } else { - if (ob->mode & (OB_MODE_WEIGHT_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT)) { - Mesh *me_orig = DEG_get_original_object(ob)->data; - select_mode = 0; - if (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL) { - select_mode = SCE_SELECT_FACE; - } - if (me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) { - select_mode |= SCE_SELECT_VERTEX; - } - } draw_select_id_mesh( stl, ob, select_mode, initial_offset, r_vert_offset, r_edge_offset, r_face_offset); } diff --git a/source/blender/draw/engines/select/select_engine.c b/source/blender/draw/engines/select/select_engine.c index 68b4a8084f0..20b04d0a659 100644 --- a/source/blender/draw/engines/select/select_engine.c +++ b/source/blender/draw/engines/select/select_engine.c @@ -191,8 +191,7 @@ static void select_cache_populate(void *vedata, Object *ob) short select_mode = e_data.context.select_mode; if (select_mode == -1) { - ToolSettings *ts = draw_ctx->scene->toolsettings; - select_mode = ts->selectmode; + select_mode = select_id_get_object_select_mode(draw_ctx->scene, ob); } struct BaseOffset *base_ofs = diff --git a/source/blender/draw/engines/select/select_private.h b/source/blender/draw/engines/select/select_private.h index 9b0addb0fb8..e2b5163c88a 100644 --- a/source/blender/draw/engines/select/select_private.h +++ b/source/blender/draw/engines/select/select_private.h @@ -79,6 +79,8 @@ struct BaseOffset { uint vert; }; +short select_id_get_object_select_mode(Scene *scene, Object *ob); + void select_id_draw_object(void *vedata, View3D *v3d, Object *ob, diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index 4c03995307a..3fdc17c571e 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -188,8 +188,7 @@ static void validate_object_select_id(struct Depsgraph *depsgraph, } if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE) != 0)) { - DRW_draw_select_id_object( - depsgraph, view_layer, ar, v3d, obact, scene->toolsettings->selectmode); + DRW_draw_select_id_object(depsgraph, view_layer, ar, v3d, obact, -1); } /* TODO: Create a flag in `DRW_manager` because the drawing is no longer diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 36eb07e9a2f..0fd76b2d6fd 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -220,12 +220,9 @@ static void editselect_buf_cache_init(struct EditSelectBuf_Cache *esel, ViewCont esel->bases_len = 0; } } - DRW_draw_select_id(vc->depsgraph, - vc->ar, - vc->v3d, - esel->bases, - esel->bases_len, - vc->scene->toolsettings->selectmode); + + DRW_draw_select_id(vc->depsgraph, vc->ar, vc->v3d, esel->bases, esel->bases_len, -1); + for (int i = 0; i < esel->bases_len; i++) { esel->bases[i]->object->runtime.select_id = i; } |