Switch viewport shading for color tools in solid mode

This patch implements T97613, switching viewport shading when using Color Filter and Mask By Color

ALSO, this patch makes it so viewport shading color switches only when SOLID mode is chosen, to prevent color switching when using other shading modes, without user noticing it.
{F13049889}

Reviewed By: JulienKaspar, joeedh, jbakker

Maniphest Tasks: T97613

Differential Revision: https://developer.blender.org/D14765
This commit is contained in:
Ramil Roosileht 2022-05-06 12:29:51 +02:00 committed by Jeroen Bakker
parent 84756b68e6
commit 90042b7d79
Notes: blender-bot 2023-02-14 06:00:46 +01:00
Referenced by issue #97613, Mask by Color and Color Filter tools don't switch viewport shading
3 changed files with 9 additions and 1 deletions

View File

@ -5281,7 +5281,7 @@ static bool sculpt_stroke_test_start(bContext *C, struct wmOperator *op, const f
* canvas it is painting on. (ref. use_sculpt_texture_paint). */
if (brush && SCULPT_TOOL_NEEDS_COLOR(brush->sculpt_tool)) {
View3D *v3d = CTX_wm_view3d(C);
if (v3d) {
if (v3d->shading.type == OB_SOLID) {
v3d->shading.color_type = V3D_SHADING_VERTEX_COLOR;
}
}

View File

@ -328,8 +328,12 @@ static int sculpt_color_filter_invoke(bContext *C, wmOperator *op, const wmEvent
{
Object *ob = CTX_data_active_object(C);
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
View3D *v3d = CTX_wm_view3d(C);
SculptSession *ss = ob->sculpt;
PBVH *pbvh = ob->sculpt->pbvh;
if (v3d->shading.type == OB_SOLID) {
v3d->shading.color_type = V3D_SHADING_VERTEX_COLOR;
}
const bool use_automasking = SCULPT_is_automasking_enabled(sd, ss, NULL);
if (use_automasking) {

View File

@ -1043,6 +1043,10 @@ static int sculpt_mask_by_color_invoke(bContext *C, wmOperator *op, const wmEven
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
View3D *v3d = CTX_wm_view3d(C);
if (v3d->shading.type == OB_SOLID) {
v3d->shading.color_type = V3D_SHADING_VERTEX_COLOR;
}
BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false);