DRW: Select Engine: Add a utility to detect `select_node`
This commit is contained in:
parent
65b6d4a34d
commit
53a0916636
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue