Fix T78323: Enable Unified and Secondary colors for Scultp Vertex Colors
The report does not include any file, but probably that file is using the settings for unified colors, which are currently not available in the UI, so it always paints black. This enables unified colors and secondary colors for sculpt vertex colors, so it should solve that issue. Unified color does not make much sense now as the Paint tool is the only one that has paint capabilities, but it will do in the future when sculpt and paint at the same time is enabled and the paint capability is added to more tools. Reviewed By: sergey Maniphest Tasks: T78323 Differential Revision: https://developer.blender.org/D8136
This commit is contained in:
parent
3118636f81
commit
bf87df3485
Notes:
blender-bot
2023-02-14 06:17:17 +01:00
Referenced by issue #78323, Sculpt vertex paint doesnt change the right color
|
@ -608,7 +608,13 @@ def brush_settings(layout, context, brush, popover=False):
|
|||
layout.separator()
|
||||
|
||||
if capabilities.has_color:
|
||||
UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="Paint Color")
|
||||
ups = context.scene.tool_settings.unified_paint_settings
|
||||
row = layout.row(align=True)
|
||||
UnifiedPaintPanel.prop_unified_color(row, context, brush, "color", text="")
|
||||
UnifiedPaintPanel.prop_unified_color(row, context, brush, "secondary_color", text="")
|
||||
row.separator()
|
||||
row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="", emboss=False)
|
||||
row.prop(ups, "use_unified_color", text="", icon='BRUSHES_ALL')
|
||||
layout.prop(brush, "blend", text="Blend Mode")
|
||||
|
||||
if brush.sculpt_tool == 'CLAY_STRIPS':
|
||||
|
|
|
@ -366,6 +366,7 @@ typedef struct SculptSession {
|
|||
/* TODO(jbakker): Replace rv3d adn v3d with ViewContext */
|
||||
struct RegionView3D *rv3d;
|
||||
struct View3D *v3d;
|
||||
struct Scene *scene;
|
||||
|
||||
/* Dynamic mesh preview */
|
||||
int *preview_vert_index_list;
|
||||
|
|
|
@ -1494,6 +1494,8 @@ static void sculpt_update_object(Depsgraph *depsgraph,
|
|||
|
||||
ss->building_vp_handle = false;
|
||||
|
||||
ss->scene = scene;
|
||||
|
||||
if (need_mask) {
|
||||
if (mmd == NULL) {
|
||||
if (!CustomData_has_layer(&me->vdata, CD_PAINT_MASK)) {
|
||||
|
|
|
@ -1301,7 +1301,7 @@ static bool brush_colors_flip_poll(bContext *C)
|
|||
else {
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
if (ob != NULL) {
|
||||
if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT)) {
|
||||
if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT | OB_MODE_SCULPT)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8108,6 +8108,7 @@ static int sculpt_sample_color_invoke(bContext *C,
|
|||
const wmEvent *UNUSED(e))
|
||||
{
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
|
@ -8116,10 +8117,9 @@ static int sculpt_sample_color_invoke(bContext *C,
|
|||
if (!active_vertex_color) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
brush->rgb[0] = active_vertex_color[0];
|
||||
brush->rgb[1] = active_vertex_color[1];
|
||||
brush->rgb[2] = active_vertex_color[2];
|
||||
brush->alpha = active_vertex_color[3];
|
||||
|
||||
BKE_brush_color_set(scene, brush, active_vertex_color);
|
||||
BKE_brush_alpha_set(scene, brush, active_vertex_color[3]);
|
||||
|
||||
WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, brush);
|
||||
|
||||
|
|
|
@ -130,6 +130,9 @@ static void do_paint_brush_task_cb_ex(void *__restrict userdata,
|
|||
ss, &test, data->brush->falloff_shape);
|
||||
const int thread_id = BLI_task_parallel_thread_id(tls);
|
||||
|
||||
float brush_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||
copy_v3_v3(brush_color, BKE_brush_color_get(ss->scene, brush));
|
||||
|
||||
BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||
{
|
||||
SCULPT_orig_vert_data_update(&orig_data, &vd);
|
||||
|
@ -168,11 +171,11 @@ static void do_paint_brush_task_cb_ex(void *__restrict userdata,
|
|||
}
|
||||
|
||||
/* Brush paint color, brush test falloff and flow. */
|
||||
float paint_color[4] = {brush->rgb[0], brush->rgb[1], brush->rgb[2], 1.0f};
|
||||
float paint_color[4];
|
||||
float wet_mix_color[4];
|
||||
float buffer_color[4];
|
||||
|
||||
mul_v4_fl(paint_color, fade * brush->flow);
|
||||
mul_v4_v4fl(paint_color, brush_color, fade * brush->flow);
|
||||
mul_v4_v4fl(wet_mix_color, data->wet_mix_sampled_color, fade * brush->flow);
|
||||
|
||||
/* Interpolate with the wet_mix color for wet paint mixing. */
|
||||
|
|
Loading…
Reference in New Issue