diff options
6 files changed, 189 insertions, 62 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_paint.c b/source/blender/draw/engines/overlay/overlay_paint.c index 71e43b99998..047659fbeee 100644 --- a/source/blender/draw/engines/overlay/overlay_paint.c +++ b/source/blender/draw/engines/overlay/overlay_paint.c @@ -159,23 +159,16 @@ void OVERLAY_paint_vertex_cache_populate(OVERLAY_Data *vedata, Object *ob) OVERLAY_PrivateData *pd = vedata->stl->pd; struct GPUBatch *geom = NULL; - const Mesh *me = ob->data; const Mesh *me_orig = DEG_get_original_object(ob)->data; const bool use_wire = (pd->overlay.paint_flag & V3D_OVERLAY_PAINT_WIRE) != 0; const bool use_face_sel = (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL) != 0; const bool use_vert_sel = (me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) != 0; if (pd->paint_surf_grp) { - if (ob->mode == OB_MODE_VERTEX_PAINT) { - if (me->mloopcol == NULL) { - return; - } - geom = DRW_cache_mesh_surface_vertpaint_get(ob); - } - else { + if (ob->mode == OB_MODE_WEIGHT_PAINT) { geom = DRW_cache_mesh_surface_weights_get(ob); + DRW_shgroup_call(pd->paint_surf_grp, geom, ob); } - DRW_shgroup_call(pd->paint_surf_grp, geom, ob); } if (use_face_sel || use_wire) { diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index a536132a1cf..02a3af7fa73 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -214,16 +214,16 @@ static GPUShader *workbench_cavity_shader_get(bool cavity, bool curvature) static GPUShader *ensure_deferred_prepass_shader(WORKBENCH_PrivateData *wpd, bool is_uniform_color, bool is_hair, - bool is_texture_painting, + const WORKBENCH_ColorOverride color_override, eGPUShaderConfig sh_cfg) { WORKBENCH_DEFERRED_Shaders *sh_data = &e_data.sh_data[sh_cfg]; int index = workbench_material_get_prepass_shader_index( - wpd, is_uniform_color, is_hair, is_texture_painting); + wpd, is_uniform_color, is_hair, color_override); if (sh_data->prepass_sh_cache[index] == NULL) { const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[sh_cfg]; char *defines = workbench_material_build_defines( - wpd, is_uniform_color, is_hair, is_texture_painting); + wpd, is_uniform_color, is_hair, color_override); char *prepass_vert = workbench_build_prepass_vert(is_hair); char *prepass_frag = workbench_build_prepass_frag(); sh_data->prepass_sh_cache[index] = GPU_shader_create_from_arrays({ @@ -242,7 +242,8 @@ static GPUShader *ensure_deferred_composite_shader(WORKBENCH_PrivateData *wpd) { int index = workbench_material_get_composite_shader_index(wpd); if (e_data.composite_sh_cache[index] == NULL) { - char *defines = workbench_material_build_defines(wpd, false, false, false); + char *defines = workbench_material_build_defines( + wpd, false, false, WORKBENCH_COLOR_OVERRIDE_OFF); char *composite_frag = workbench_build_composite_frag(wpd); e_data.composite_sh_cache[index] = DRW_shader_create_fullscreen(composite_frag, defines); MEM_freeN(composite_frag); @@ -269,11 +270,18 @@ static GPUShader *ensure_background_shader(WORKBENCH_PrivateData *wpd) static void select_deferred_shaders(WORKBENCH_PrivateData *wpd, eGPUShaderConfig sh_cfg) { - wpd->prepass_sh = ensure_deferred_prepass_shader(wpd, false, false, false, sh_cfg); - wpd->prepass_hair_sh = ensure_deferred_prepass_shader(wpd, false, true, false, sh_cfg); - wpd->prepass_uniform_sh = ensure_deferred_prepass_shader(wpd, true, false, false, sh_cfg); - wpd->prepass_uniform_hair_sh = ensure_deferred_prepass_shader(wpd, true, true, false, sh_cfg); - wpd->prepass_textured_sh = ensure_deferred_prepass_shader(wpd, false, false, true, sh_cfg); + wpd->prepass_sh = ensure_deferred_prepass_shader( + wpd, false, false, WORKBENCH_COLOR_OVERRIDE_OFF, sh_cfg); + wpd->prepass_hair_sh = ensure_deferred_prepass_shader( + wpd, false, true, WORKBENCH_COLOR_OVERRIDE_OFF, sh_cfg); + wpd->prepass_uniform_sh = ensure_deferred_prepass_shader( + wpd, true, false, WORKBENCH_COLOR_OVERRIDE_OFF, sh_cfg); + wpd->prepass_uniform_hair_sh = ensure_deferred_prepass_shader( + wpd, true, true, WORKBENCH_COLOR_OVERRIDE_OFF, sh_cfg); + wpd->prepass_textured_sh = ensure_deferred_prepass_shader( + wpd, false, false, WORKBENCH_COLOR_OVERRIDE_TEXTURE, sh_cfg); + wpd->prepass_vertex_sh = ensure_deferred_prepass_shader( + wpd, false, false, WORKBENCH_COLOR_OVERRIDE_VERTEX, sh_cfg); wpd->composite_sh = ensure_deferred_composite_shader(wpd); wpd->background_sh = ensure_background_shader(wpd); } @@ -868,6 +876,9 @@ static WORKBENCH_MaterialData *get_or_create_material_data(WORKBENCH_Data *vedat if (color_type == V3D_SHADING_TEXTURE_COLOR) { shader = wpd->prepass_textured_sh; } + if (color_type == V3D_SHADING_VERTEX_COLOR) { + shader = wpd->prepass_vertex_sh; + } material->shgrp = DRW_shgroup_create( shader, (ob->dtx & OB_DRAWXRAY) ? psl->ghost_prepass_pass : psl->prepass_pass); workbench_material_copy(material, &material_template); @@ -964,6 +975,22 @@ static void workbench_cache_populate_texture_paint_mode(WORKBENCH_Data *vedata, } } +static void workbench_cache_populate_vertex_paint_mode(WORKBENCH_Data *vedata, Object *ob) +{ + WORKBENCH_StorageList *stl = vedata->stl; + WORKBENCH_PrivateData *wpd = stl->g_data; + const DRWContextState *draw_ctx = DRW_context_state_get(); + + const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) && + !DRW_state_is_image_render(); + WORKBENCH_MaterialData *material; + + int color_type = workbench_material_determine_color_type(wpd, NULL, ob, use_sculpt_pbvh); + struct GPUBatch *geom = DRW_cache_mesh_surface_vertpaint_get(ob); + material = get_or_create_material_data(vedata, ob, NULL, NULL, NULL, color_type, false); + DRW_shgroup_call(material->shgrp, geom, ob); +} + void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob) { WORKBENCH_StorageList *stl = vedata->stl; @@ -1005,14 +1032,22 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob) const int materials_len = MAX2(1, ob->totcol); const Mesh *me = (ob->type == OB_MESH) ? ob->data : NULL; bool has_transp_mat = false; + const WORKBENCH_ColorOverride color_override = workbench_object_color_override_get(ob); const bool use_texture_paint_drawing = !(DRW_state_is_image_render() && draw_ctx->v3d == NULL) && - workbench_is_object_in_texture_paint_mode(ob) && me && - me->mloopuv; + (color_override == WORKBENCH_COLOR_OVERRIDE_TEXTURE) && + me && me->mloopuv; + const bool use_vertex_paint_drawing = !(DRW_state_is_image_render() && + draw_ctx->v3d == NULL) && + (color_override == WORKBENCH_COLOR_OVERRIDE_VERTEX) && + me && me->mloopcol; if (use_texture_paint_drawing) { workbench_cache_populate_texture_paint_mode(vedata, ob); } + else if (use_vertex_paint_drawing) { + workbench_cache_populate_vertex_paint_mode(vedata, ob); + } else if (!use_sculpt_pbvh && TEXTURE_DRAWING_ENABLED(wpd) && me && me->mloopuv) { /* Draw textured */ struct GPUBatch **geom_array = DRW_cache_mesh_surface_texpaint_get(ob); diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c index 90f5d24fabd..44f43fc7d09 100644 --- a/source/blender/draw/engines/workbench/workbench_forward.c +++ b/source/blender/draw/engines/workbench/workbench_forward.c @@ -226,16 +226,16 @@ WORKBENCH_MaterialData *workbench_forward_get_or_create_material_data(WORKBENCH_ static GPUShader *ensure_forward_accum_shaders(WORKBENCH_PrivateData *wpd, bool is_uniform_color, bool is_hair, - bool is_texture_painting, + const WORKBENCH_ColorOverride color_override, eGPUShaderConfig sh_cfg) { WORKBENCH_FORWARD_Shaders *sh_data = &e_data.sh_data[sh_cfg]; int index = workbench_material_get_accum_shader_index( - wpd, is_uniform_color, is_hair, is_texture_painting); + wpd, is_uniform_color, is_hair, color_override); if (sh_data->transparent_accum_sh_cache[index] == NULL) { const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[sh_cfg]; char *defines = workbench_material_build_defines( - wpd, is_uniform_color, is_hair, is_texture_painting); + wpd, is_uniform_color, is_hair, color_override); char *transparent_accum_vert = workbench_build_forward_vert(is_hair); char *transparent_accum_frag = workbench_build_forward_transparent_accum_frag(); sh_data->transparent_accum_sh_cache[index] = GPU_shader_create_from_arrays({ @@ -254,7 +254,8 @@ static GPUShader *ensure_forward_composite_shaders(WORKBENCH_PrivateData *wpd) { int index = OBJECT_OUTLINE_ENABLED(wpd) ? 1 : 0; if (e_data.composite_sh_cache[index] == NULL) { - char *defines = workbench_material_build_defines(wpd, false, false, false); + char *defines = workbench_material_build_defines( + wpd, false, false, WORKBENCH_COLOR_OVERRIDE_OFF); char *composite_frag = workbench_build_forward_composite_frag(); e_data.composite_sh_cache[index] = DRW_shader_create_fullscreen(composite_frag, defines); MEM_freeN(composite_frag); @@ -266,14 +267,18 @@ static GPUShader *ensure_forward_composite_shaders(WORKBENCH_PrivateData *wpd) void workbench_forward_choose_shaders(WORKBENCH_PrivateData *wpd, eGPUShaderConfig sh_cfg) { wpd->composite_sh = ensure_forward_composite_shaders(wpd); - wpd->transparent_accum_sh = ensure_forward_accum_shaders(wpd, false, false, false, sh_cfg); - wpd->transparent_accum_hair_sh = ensure_forward_accum_shaders(wpd, false, true, false, sh_cfg); + wpd->transparent_accum_sh = ensure_forward_accum_shaders( + wpd, false, false, WORKBENCH_COLOR_OVERRIDE_OFF, sh_cfg); + wpd->transparent_accum_hair_sh = ensure_forward_accum_shaders( + wpd, false, true, WORKBENCH_COLOR_OVERRIDE_OFF, sh_cfg); wpd->transparent_accum_uniform_sh = ensure_forward_accum_shaders( - wpd, true, false, false, sh_cfg); + wpd, true, false, WORKBENCH_COLOR_OVERRIDE_OFF, sh_cfg); wpd->transparent_accum_uniform_hair_sh = ensure_forward_accum_shaders( - wpd, true, true, false, sh_cfg); + wpd, true, true, WORKBENCH_COLOR_OVERRIDE_OFF, sh_cfg); wpd->transparent_accum_textured_sh = ensure_forward_accum_shaders( - wpd, false, false, true, sh_cfg); + wpd, false, false, WORKBENCH_COLOR_OVERRIDE_TEXTURE, sh_cfg); + wpd->transparent_accum_vertex_sh = ensure_forward_accum_shaders( + wpd, false, false, WORKBENCH_COLOR_OVERRIDE_VERTEX, sh_cfg); } void workbench_forward_outline_shaders_ensure(WORKBENCH_PrivateData *wpd, eGPUShaderConfig sh_cfg) @@ -282,9 +287,12 @@ void workbench_forward_outline_shaders_ensure(WORKBENCH_PrivateData *wpd, eGPUSh if (sh_data->object_outline_sh == NULL) { const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[sh_cfg]; - char *defines = workbench_material_build_defines(wpd, false, false, false); - char *defines_texture = workbench_material_build_defines(wpd, true, false, false); - char *defines_hair = workbench_material_build_defines(wpd, false, true, false); + char *defines = workbench_material_build_defines( + wpd, false, false, WORKBENCH_COLOR_OVERRIDE_OFF); + char *defines_texture = workbench_material_build_defines( + wpd, true, false, WORKBENCH_COLOR_OVERRIDE_OFF); + char *defines_hair = workbench_material_build_defines( + wpd, false, true, WORKBENCH_COLOR_OVERRIDE_OFF); char *forward_vert = workbench_build_forward_vert(false); char *forward_frag = workbench_build_forward_outline_frag(); char *forward_hair_vert = workbench_build_forward_vert(true); @@ -600,6 +608,23 @@ static void workbench_forward_cache_populate_texture_paint_mode(WORKBENCH_Data * } } } +static void workbench_forward_cache_populate_vertex_paint_mode(WORKBENCH_Data *vedata, Object *ob) +{ + WORKBENCH_StorageList *stl = vedata->stl; + WORKBENCH_PrivateData *wpd = stl->g_data; + const DRWContextState *draw_ctx = DRW_context_state_get(); + + const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) && + !DRW_state_is_image_render(); + WORKBENCH_MaterialData *material; + + int color_type = workbench_material_determine_color_type(wpd, NULL, ob, use_sculpt_pbvh); + struct GPUBatch *geom = DRW_cache_mesh_surface_vertpaint_get(ob); + material = workbench_forward_get_or_create_material_data( + vedata, ob, NULL, NULL, NULL, color_type, false); + DRW_shgroup_call(material->shgrp, geom, ob); + DRW_shgroup_call(material->shgrp_object_outline, geom, ob); +} void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob) { @@ -640,14 +665,22 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob) !DRW_state_is_image_render(); const int materials_len = MAX2(1, ob->totcol); const Mesh *me = (ob->type == OB_MESH) ? ob->data : NULL; + const WORKBENCH_ColorOverride color_override = workbench_object_color_override_get(ob); const bool use_texture_paint_drawing = !(DRW_state_is_image_render() && draw_ctx->v3d == NULL) && - workbench_is_object_in_texture_paint_mode(ob) && me && - me->mloopuv; + (color_override == WORKBENCH_COLOR_OVERRIDE_TEXTURE) && + me && me->mloopuv; + const bool use_vertex_paint_drawing = !(DRW_state_is_image_render() && + draw_ctx->v3d == NULL) && + (color_override == WORKBENCH_COLOR_OVERRIDE_VERTEX) && + me && me->mloopcol; if (use_texture_paint_drawing) { workbench_forward_cache_populate_texture_paint_mode(vedata, ob); } + else if (use_vertex_paint_drawing) { + workbench_forward_cache_populate_vertex_paint_mode(vedata, ob); + } else if (!use_sculpt_pbvh && TEXTURE_DRAWING_ENABLED(wpd) && me && me->mloopuv) { struct GPUBatch **geom_array = DRW_cache_mesh_surface_texpaint_get(ob); for (int i = 0; i < materials_len; i++) { diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c index 28abed96b48..16fcda54253 100644 --- a/source/blender/draw/engines/workbench/workbench_materials.c +++ b/source/blender/draw/engines/workbench/workbench_materials.c @@ -85,16 +85,26 @@ void workbench_material_update_data(WORKBENCH_PrivateData *wpd, char *workbench_material_build_defines(WORKBENCH_PrivateData *wpd, bool is_uniform_color, bool is_hair, - bool is_texture_painting) + const WORKBENCH_ColorOverride color_override) { char *str = NULL; bool use_textures = (wpd->shading.color_type == V3D_SHADING_TEXTURE_COLOR) && !is_uniform_color; bool use_vertex_colors = (wpd->shading.color_type == V3D_SHADING_VERTEX_COLOR) && !is_uniform_color; - if (is_texture_painting) { - use_textures = true; - use_vertex_colors = false; + switch (color_override) { + case WORKBENCH_COLOR_OVERRIDE_TEXTURE: + use_textures = true; + use_vertex_colors = false; + is_hair = false; + break; + case WORKBENCH_COLOR_OVERRIDE_VERTEX: + use_textures = false; + use_vertex_colors = true; + is_hair = false; + break; + case WORKBENCH_COLOR_OVERRIDE_OFF: + break; } DynStr *ds = BLI_dynstr_new(); @@ -201,15 +211,25 @@ int workbench_material_get_composite_shader_index(WORKBENCH_PrivateData *wpd) int workbench_material_get_prepass_shader_index(WORKBENCH_PrivateData *wpd, bool is_uniform_color, bool is_hair, - bool is_texture_painting) + const WORKBENCH_ColorOverride color_override) { bool use_textures = (wpd->shading.color_type == V3D_SHADING_TEXTURE_COLOR) && !is_uniform_color; bool use_vertex_colors = (wpd->shading.color_type == V3D_SHADING_VERTEX_COLOR) && !is_uniform_color; - if (is_texture_painting) { - use_textures = true; - use_vertex_colors = false; + + switch (color_override) { + case WORKBENCH_COLOR_OVERRIDE_TEXTURE: + use_textures = true; + use_vertex_colors = false; + break; + case WORKBENCH_COLOR_OVERRIDE_VERTEX: + use_textures = false; + use_vertex_colors = true; + break; + case WORKBENCH_COLOR_OVERRIDE_OFF: + break; } + /* NOTE: change MAX_PREPASS_SHADERS accordingly when modifying this function. */ int index = 0; SET_FLAG_FROM_TEST(index, is_hair, 1 << 0); @@ -226,15 +246,25 @@ int workbench_material_get_prepass_shader_index(WORKBENCH_PrivateData *wpd, int workbench_material_get_accum_shader_index(WORKBENCH_PrivateData *wpd, bool is_uniform_color, bool is_hair, - bool is_texture_painting) + const WORKBENCH_ColorOverride color_override) { bool use_textures = (wpd->shading.color_type == V3D_SHADING_TEXTURE_COLOR) && !is_uniform_color; bool use_vertex_colors = (wpd->shading.color_type == V3D_SHADING_VERTEX_COLOR) && !is_uniform_color; - if (is_texture_painting) { - use_textures = true; - use_vertex_colors = false; - is_hair = false; + + switch (color_override) { + case WORKBENCH_COLOR_OVERRIDE_TEXTURE: + use_textures = true; + use_vertex_colors = false; + is_hair = false; + break; + case WORKBENCH_COLOR_OVERRIDE_VERTEX: + use_textures = false; + use_vertex_colors = true; + is_hair = false; + break; + case WORKBENCH_COLOR_OVERRIDE_OFF: + break; } /* NOTE: change MAX_ACCUM_SHADERS accordingly when modifying this function. */ @@ -267,12 +297,25 @@ int workbench_material_determine_color_type(WORKBENCH_PrivateData *wpd, color_type = V3D_SHADING_OBJECT_COLOR; } - /* Force V3D_SHADING_TEXTURE_COLOR for active object when in texture painting - * no matter the shading color that the user has chosen, when there is no - * texture we will render the object with the error color */ - if (workbench_is_object_in_texture_paint_mode(ob)) { - color_type = ima ? V3D_SHADING_TEXTURE_COLOR : V3D_SHADING_ERROR_COLOR; + switch (workbench_object_color_override_get(ob)) { + /* Force V3D_SHADING_TEXTURE_COLOR for active object when in texture painting + * no matter the shading color that the user has chosen, when there is no + * texture we will render the object with the error color */ + case WORKBENCH_COLOR_OVERRIDE_TEXTURE: + color_type = ima ? V3D_SHADING_TEXTURE_COLOR : V3D_SHADING_ERROR_COLOR; + break; + + /* Force V3D_SHADING_VERTEX_COLOR for active object when in vertex painting + * no matter the shading color that the user has chosen, when there is no + * vertex color we will render the object with the error color */ + case WORKBENCH_COLOR_OVERRIDE_VERTEX: + color_type = V3D_SHADING_VERTEX_COLOR; + break; + + case WORKBENCH_COLOR_OVERRIDE_OFF: + break; } + return color_type; } diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h index 9fcd9651f94..7c774ca7490 100644 --- a/source/blender/draw/engines/workbench/workbench_private.h +++ b/source/blender/draw/engines/workbench/workbench_private.h @@ -207,6 +207,7 @@ typedef struct WORKBENCH_PrivateData { struct GPUShader *prepass_uniform_sh; struct GPUShader *prepass_uniform_hair_sh; struct GPUShader *prepass_textured_sh; + struct GPUShader *prepass_vertex_sh; struct GPUShader *composite_sh; struct GPUShader *background_sh; struct GPUShader *transparent_accum_sh; @@ -214,6 +215,7 @@ typedef struct WORKBENCH_PrivateData { struct GPUShader *transparent_accum_uniform_sh; struct GPUShader *transparent_accum_uniform_hair_sh; struct GPUShader *transparent_accum_textured_sh; + struct GPUShader *transparent_accum_vertex_sh; View3DShading shading; StudioLight *studio_light; const UserDef *preferences; @@ -318,6 +320,15 @@ typedef struct WORKBENCH_WorldData { struct GPUUniformBuffer *world_ubo; } WORKBENCH_WorldData; +/* Enumeration containing override options for base color rendering. + * This is used to during painting to force the base color to show what you are + * painting using the selected lighting model. */ +typedef enum WORKBENCH_ColorOverride { + WORKBENCH_COLOR_OVERRIDE_OFF = 0, + WORKBENCH_COLOR_OVERRIDE_TEXTURE = CTX_MODE_PAINT_TEXTURE, + WORKBENCH_COLOR_OVERRIDE_VERTEX = CTX_MODE_PAINT_VERTEX, +} WORKBENCH_ColorOverride; + /* inline helper functions */ BLI_INLINE bool workbench_is_specular_highlight_enabled(WORKBENCH_PrivateData *wpd) { @@ -375,23 +386,35 @@ BLI_INLINE bool workbench_is_in_texture_paint_mode(void) return draw_ctx->object_mode == OB_MODE_TEXTURE_PAINT; } -/** Is texture paint mode active for the given object */ -BLI_INLINE bool workbench_is_object_in_texture_paint_mode(Object *ob) +/** Is vertex paint mode enabled (globally) */ +BLI_INLINE bool workbench_is_in_vertex_paint_mode(void) +{ + const DRWContextState *draw_ctx = DRW_context_state_get(); + return draw_ctx->object_mode == OB_MODE_VERTEX_PAINT; +} + +/* Must the `View3DShading.color_type` be overriden for the given object. */ +BLI_INLINE WORKBENCH_ColorOverride workbench_object_color_override_get(Object *ob) { const DRWContextState *draw_ctx = DRW_context_state_get(); if (ob->type == OB_MESH && (draw_ctx->obact == ob)) { const enum eContextObjectMode mode = CTX_data_mode_enum_ex( draw_ctx->object_edit, draw_ctx->obact, draw_ctx->object_mode); - return (mode == CTX_MODE_PAINT_TEXTURE); + if (mode == CTX_MODE_PAINT_TEXTURE) { + return WORKBENCH_COLOR_OVERRIDE_TEXTURE; + } + else if (mode == CTX_MODE_PAINT_VERTEX) { + return WORKBENCH_COLOR_OVERRIDE_VERTEX; + } } - return false; + return WORKBENCH_COLOR_OVERRIDE_OFF; } BLI_INLINE bool workbench_is_matdata_pass_enabled(WORKBENCH_PrivateData *wpd) { return (wpd->shading.color_type != V3D_SHADING_SINGLE_COLOR || MATCAP_ENABLED(wpd)) || - workbench_is_in_texture_paint_mode(); + workbench_is_in_texture_paint_mode() || workbench_is_in_vertex_paint_mode(); } /** @@ -409,7 +432,7 @@ BLI_INLINE eGPUTextureFormat workbench_color_texture_format(const WORKBENCH_Priv TEXTURE_DRAWING_ENABLED(wpd)) { result = GPU_RGBA16F; } - else if (VERTEX_COLORS_ENABLED(wpd)) { + else if (workbench_is_in_vertex_paint_mode() || VERTEX_COLORS_ENABLED(wpd)) { result = GPU_RGBA16; } else { @@ -493,7 +516,7 @@ void workbench_material_get_image_and_mat( char *workbench_material_build_defines(WORKBENCH_PrivateData *wpd, bool is_uniform_color, bool is_hair, - bool is_texture_painting); + const WORKBENCH_ColorOverride color_override); void workbench_material_update_data(WORKBENCH_PrivateData *wpd, Object *ob, Material *mat, @@ -504,11 +527,11 @@ int workbench_material_get_composite_shader_index(WORKBENCH_PrivateData *wpd); int workbench_material_get_prepass_shader_index(WORKBENCH_PrivateData *wpd, bool is_uniform_color, bool is_hair, - bool is_texture_painting); + const WORKBENCH_ColorOverride color_override); int workbench_material_get_accum_shader_index(WORKBENCH_PrivateData *wpd, bool is_uniform_color, bool is_hair, - bool is_texture_painting); + const WORKBENCH_ColorOverride color_override); void workbench_material_shgroup_uniform(WORKBENCH_PrivateData *wpd, DRWShadingGroup *grp, WORKBENCH_MaterialData *material, diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 4da6b8214fa..3ed9d71e287 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -3660,7 +3660,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna) prop = RNA_def_property(srna, "vertex_paint_mode_opacity", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "overlay.vertex_paint_mode_opacity"); RNA_def_property_ui_text( - prop, "Vertex Paint Opacity", "Opacity of the vertex paint mode overlay"); + prop, "Stencil Opacity", "Opacity of the texture paint mode stencil mask overlay"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); |