diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_filter_color.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_filter_color.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_color.c b/source/blender/editors/sculpt_paint/sculpt_filter_color.c index 377f1e0ed32..cbb9180a209 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_color.c +++ b/source/blender/editors/sculpt_paint/sculpt_filter_color.c @@ -181,12 +181,16 @@ static void color_filter_task_cb(void *__restrict userdata, fade = clamp_f(fade, -1.0f, 1.0f); float smooth_color[4]; SCULPT_neighbor_color_average(ss, smooth_color, vd.index); - blend_color_interpolate_float(final_color, vd.col, smooth_color, fade); + + float col[4]; + SCULPT_vertex_color_get(ss, vd.index, col); + + blend_color_interpolate_float(final_color, col, smooth_color, fade); break; } } - copy_v3_v3(vd.col, final_color); + SCULPT_vertex_color_set(ss, vd.index, final_color); if (vd.mvert) { BKE_pbvh_vert_mark_update(ss->pbvh, vd.index); @@ -205,7 +209,7 @@ static int sculpt_color_filter_modal(bContext *C, wmOperator *op, const wmEvent float filter_strength = RNA_float_get(op->ptr, "strength"); if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { - SCULPT_undo_push_end(); + SCULPT_undo_push_end(ob); SCULPT_filter_cache_free(ss); SCULPT_flush_update_done(C, ob, SCULPT_UPDATE_COLOR); return OPERATOR_FINISHED; @@ -247,7 +251,6 @@ 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; SculptSession *ss = ob->sculpt; - int mode = RNA_enum_get(op->ptr, "type"); PBVH *pbvh = ob->sculpt->pbvh; const bool use_automasking = SCULPT_is_automasking_enabled(sd, ss, NULL); @@ -269,7 +272,7 @@ static int sculpt_color_filter_invoke(bContext *C, wmOperator *op, const wmEvent return OPERATOR_CANCELLED; } - if (!ss->vcol) { + if (!SCULPT_has_colors(ss)) { return OPERATOR_CANCELLED; } @@ -280,10 +283,9 @@ static int sculpt_color_filter_invoke(bContext *C, wmOperator *op, const wmEvent /* CTX_data_ensure_evaluated_depsgraph should be used at the end to include the updates of * earlier steps modifying the data. */ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); - const bool needs_topology_info = mode == COLOR_FILTER_SMOOTH || use_automasking; - BKE_sculpt_update_object_for_edit(depsgraph, ob, needs_topology_info, false, true); + BKE_sculpt_update_object_for_edit(depsgraph, ob, true, false, true); - if (BKE_pbvh_type(pbvh) == PBVH_FACES && needs_topology_info && !ob->sculpt->pmap) { + if (BKE_pbvh_type(pbvh) == PBVH_FACES && !ob->sculpt->pmap) { return OPERATOR_CANCELLED; } |