Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_filter_mask.c
| Show First 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | switch (mode) { | ||||
| } | } | ||||
| *vd.mask = gain * (*vd.mask) + offset; | *vd.mask = gain * (*vd.mask) + offset; | ||||
| break; | break; | ||||
| } | } | ||||
| *vd.mask = clamp_f(*vd.mask, 0.0f, 1.0f); | *vd.mask = clamp_f(*vd.mask, 0.0f, 1.0f); | ||||
| if (*vd.mask != prev_val) { | if (*vd.mask != prev_val) { | ||||
| update = true; | update = true; | ||||
| } | } | ||||
| if (vd.mvert) { | |||||
| BKE_pbvh_vert_mark_update(ss->pbvh, vd.vertex); | |||||
| } | |||||
| } | } | ||||
| BKE_pbvh_vertex_iter_end; | BKE_pbvh_vertex_iter_end; | ||||
| if (update) { | if (update) { | ||||
| BKE_pbvh_node_mark_update_mask(node); | BKE_pbvh_node_mark_update_mask(node); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 206 Lines • ▼ Show 20 Lines | static void dirty_mask_apply_task_cb(void *__restrict userdata, | ||||
| BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) { | BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) { | ||||
| float dirty_mask = neighbor_dirty_mask(ss, &vd); | float dirty_mask = neighbor_dirty_mask(ss, &vd); | ||||
| float mask = *vd.mask + (1.0f - ((dirty_mask - min) * range)); | float mask = *vd.mask + (1.0f - ((dirty_mask - min) * range)); | ||||
| if (dirty_only) { | if (dirty_only) { | ||||
| mask = fminf(mask, 0.5f) * 2.0f; | mask = fminf(mask, 0.5f) * 2.0f; | ||||
| } | } | ||||
| *vd.mask = CLAMPIS(mask, 0.0f, 1.0f); | *vd.mask = CLAMPIS(mask, 0.0f, 1.0f); | ||||
| if (vd.mvert) { | |||||
| BKE_pbvh_vert_mark_update(ss->pbvh, vd.vertex); | |||||
| } | |||||
| } | } | ||||
| BKE_pbvh_vertex_iter_end; | BKE_pbvh_vertex_iter_end; | ||||
| BKE_pbvh_node_mark_update_mask(node); | BKE_pbvh_node_mark_update_mask(node); | ||||
| } | } | ||||
| static int sculpt_dirty_mask_exec(bContext *C, wmOperator *op) | static int sculpt_dirty_mask_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| ARegion *region = CTX_wm_region(C); | ARegion *region = CTX_wm_region(C); | ||||
| ▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines | |||||