diff options
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/engines/select/select_draw_utils.c | 18 | ||||
-rw-r--r-- | source/blender/draw/engines/select/select_engine.c | 7 |
2 files changed, 9 insertions, 16 deletions
diff --git a/source/blender/draw/engines/select/select_draw_utils.c b/source/blender/draw/engines/select/select_draw_utils.c index 6a51c28c242..927956dad19 100644 --- a/source/blender/draw/engines/select/select_draw_utils.c +++ b/source/blender/draw/engines/select/select_draw_utils.c @@ -62,18 +62,18 @@ void select_id_object_min_max(Object *obj, float r_min[3], float r_max[3]) 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)) { + if (ob->mode & (OB_MODE_WEIGHT_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT)) { + /* In order to sample flat colors for vertex weights / texturepaint / vertexpaint + * we need to be in SCE_SELECT_FACE mode so select_cache_init() correctly sets up + * a shgroup with select_id_flat. + * Note this is not working correctly for vertexpaint (yet), but has been discussed + * in T66645 and there is a solution by @mano-wii in P1032. + * So OB_MODE_VERTEX_PAINT is already included here [required for P1032 I guess]. */ Mesh *me_orig = DEG_get_original_object(ob)->data; - if (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL) { - r_select_mode = SCE_SELECT_FACE; - } - else if (me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) { + if (me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) { r_select_mode = SCE_SELECT_VERTEX; } - } - else if (ob->mode & OB_MODE_TEXTURE_PAINT) { - Mesh *me_orig = DEG_get_original_object(ob)->data; - if (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL) { + else { r_select_mode = SCE_SELECT_FACE; } } diff --git a/source/blender/draw/engines/select/select_engine.c b/source/blender/draw/engines/select/select_engine.c index c294bba2083..5dc20a589f0 100644 --- a/source/blender/draw/engines/select/select_engine.c +++ b/source/blender/draw/engines/select/select_engine.c @@ -163,13 +163,6 @@ static void select_cache_init(void *vedata) if (e_data.context.select_mode == -1) { e_data.context.select_mode = select_id_get_object_select_mode(draw_ctx->scene, draw_ctx->obact); - if (e_data.context.select_mode == 0) { - /* Need for sampling weights. */ - if (draw_ctx->object_mode & OB_MODE_WEIGHT_PAINT) { - e_data.context.select_mode = SCE_SELECT_FACE; - } - } - BLI_assert(e_data.context.select_mode != 0); } |