diff options
-rw-r--r-- | release/scripts/startup/bl_ui/properties_paint_common.py | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_paint.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/paint.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 8 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_paint_color.c | 7 |
6 files changed, 20 insertions, 8 deletions
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index ba0d904a323..edef65d254b 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -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': diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index d3718b70c96..21195566179 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -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; diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 151e0006092..d04300449ce 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -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)) { diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 08af3bdd16c..7f64fdf3501 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -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; } } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index e2d69c7b0be..c45f01ae7cd 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -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); diff --git a/source/blender/editors/sculpt_paint/sculpt_paint_color.c b/source/blender/editors/sculpt_paint/sculpt_paint_color.c index 1ae40837998..3b6343a0920 100644 --- a/source/blender/editors/sculpt_paint/sculpt_paint_color.c +++ b/source/blender/editors/sculpt_paint/sculpt_paint_color.c @@ -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. */ |