Fix #131003: Mesh Filter undo panel repeat parameter doesnt work

With the brush system refactor in 4.3, the mesh filter tool was changed
to remove the `no_orig_co` `FilterCache` property. This change and
subsequent refactors had the unintended effect of breaking the filter
tool "repeat" functionality. The expected state of most filter modes
is to use the current position, not the original position.

To fix this behavior, in all modes except Sharpen, Smooth, and Relax
that used the original position data, this commit removes resetting
the transform by the distance from the original position, instead
updating this only when the modal is operating.

Unfortunately, the smooth filter is rather complicated in how it
expects this data, when running as a modal, we always use the original
data, but when the repeat parameter is being used, we need to instead
use the current position on any step that isn't the first one as the
undo step is not "committed" until the user is finished tweaking the
panel.

Additionally, many of the filter modes clipped the resulting posistions
based on the original position data instead of the new, transformed
position, this was also fixed.

Pull Request: https://projects.blender.org/blender/blender/pulls/131469
This commit is contained in:
Sean Kim
2024-12-07 22:35:15 +01:00
committed by Sean Kim
parent b7fe1ee1d6
commit a77a5ec9f3
2 changed files with 75 additions and 78 deletions

View File

@@ -1156,11 +1156,6 @@ void restore_position_from_undo_step(const Depsgraph &depsgraph, Object &object)
break;
}
}
/* Update normals for potentially-changed positions. Theoretically this may be unnecessary if
* the brush restoring to the initial state doesn't use the normals, but we have no easy way to
* know that from here. */
bke::pbvh::update_normals(depsgraph, object, pbvh);
}
static void restore_from_undo_step(const Depsgraph &depsgraph, const Sculpt &sd, Object &object)
@@ -1179,6 +1174,7 @@ static void restore_from_undo_step(const Depsgraph &depsgraph, const Sculpt &sd,
case SCULPT_BRUSH_TYPE_DRAW_FACE_SETS:
if (ss.cache->alt_smooth) {
restore_position_from_undo_step(depsgraph, object);
bke::pbvh::update_normals(depsgraph, object, *bke::object::pbvh_get(object));
}
else {
restore_face_set_from_undo_step(object);
@@ -1186,6 +1182,7 @@ static void restore_from_undo_step(const Depsgraph &depsgraph, const Sculpt &sd,
break;
default:
restore_position_from_undo_step(depsgraph, object);
bke::pbvh::update_normals(depsgraph, object, *bke::object::pbvh_get(object));
break;
}
/* Disable multi-threading when dynamic-topology is enabled. Otherwise,

View File

@@ -337,7 +337,8 @@ static void calc_smooth_filter(const Depsgraph &depsgraph,
const Sculpt &sd,
const float strength,
Object &object,
const IndexMask &node_mask)
const IndexMask &node_mask,
const bool use_original_position)
{
struct LocalData {
Vector<float> factors;
@@ -390,9 +391,16 @@ static void calc_smooth_filter(const Depsgraph &depsgraph,
tls.translations.resize(verts.size());
const MutableSpan<float3> translations = tls.translations;
translations_from_new_positions(new_positions, orig_data.positions, translations);
if (use_original_position) {
translations_from_new_positions(new_positions, orig_data.positions, translations);
}
else {
translations_from_new_positions(new_positions, positions, translations);
}
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_data.positions);
if (use_original_position) {
reset_translations_to_original(translations, positions, orig_data.positions);
}
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, position_data.eval, verts, translations);
@@ -429,12 +437,19 @@ static void calc_smooth_filter(const Depsgraph &depsgraph,
tls.translations.resize(positions.size());
const MutableSpan<float3> translations = tls.translations;
translations_from_new_positions(new_positions, orig_data.positions, translations);
if (use_original_position) {
translations_from_new_positions(new_positions, orig_data.positions, translations);
}
else {
translations_from_new_positions(new_positions, positions, translations);
}
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_data.positions);
if (use_original_position) {
reset_translations_to_original(translations, positions, orig_data.positions);
}
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_data.positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, grids, subdiv_ccg);
});
break;
@@ -464,12 +479,19 @@ static void calc_smooth_filter(const Depsgraph &depsgraph,
tls.translations.resize(verts.size());
const MutableSpan<float3> translations = tls.translations;
translations_from_new_positions(new_positions, orig_positions, translations);
if (use_original_position) {
translations_from_new_positions(new_positions, orig_positions, translations);
}
else {
translations_from_new_positions(new_positions, positions, translations);
}
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_positions);
if (use_original_position) {
reset_translations_to_original(translations, positions, orig_positions);
}
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, verts);
});
break;
@@ -502,7 +524,6 @@ static void calc_inflate_filter(const Depsgraph &depsgraph,
node_mask.foreach_index(GrainSize(1), [&](const int i) {
LocalData &tls = all_tls.local();
const Span<int> verts = nodes[i].verts();
const Span<float3> positions = gather_data_mesh(position_data.eval, verts, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, nodes[i]);
tls.factors.resize(verts.size());
@@ -516,7 +537,6 @@ static void calc_inflate_filter(const Depsgraph &depsgraph,
const MutableSpan<float3> translations = tls.translations;
translations.copy_from(orig_data.normals);
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_data.positions);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, position_data.eval, verts, translations);
@@ -545,10 +565,9 @@ static void calc_inflate_filter(const Depsgraph &depsgraph,
const MutableSpan<float3> translations = tls.translations;
translations.copy_from(orig_data.normals);
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_data.positions);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_data.positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, grids, subdiv_ccg);
});
break;
@@ -576,10 +595,9 @@ static void calc_inflate_filter(const Depsgraph &depsgraph,
const MutableSpan<float3> translations = tls.translations;
translations.copy_from(orig_normals);
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_positions);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, verts);
});
break;
@@ -610,7 +628,6 @@ static void calc_scale_filter(const Depsgraph &depsgraph,
node_mask.foreach_index(GrainSize(1), [&](const int i) {
LocalData &tls = all_tls.local();
const Span<int> verts = nodes[i].verts();
const Span<float3> positions = gather_data_mesh(position_data.eval, verts, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, nodes[i]);
tls.factors.resize(verts.size());
@@ -625,7 +642,6 @@ static void calc_scale_filter(const Depsgraph &depsgraph,
const MutableSpan<float3> translations = tls.translations;
translations.copy_from(orig_data.positions);
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_data.positions);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, position_data.eval, verts, translations);
@@ -654,10 +670,9 @@ static void calc_scale_filter(const Depsgraph &depsgraph,
const MutableSpan<float3> translations = tls.translations;
translations.copy_from(orig_data.positions);
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_data.positions);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_data.positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, grids, subdiv_ccg);
});
break;
@@ -684,10 +699,9 @@ static void calc_scale_filter(const Depsgraph &depsgraph,
const MutableSpan<float3> translations = tls.translations;
translations.copy_from(orig_positions);
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_positions);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, verts);
});
break;
@@ -736,7 +750,6 @@ static void calc_sphere_filter(const Depsgraph &depsgraph,
LocalData &tls = all_tls.local();
const Span<int> verts = nodes[i].verts();
const Span<float3> positions = gather_data_mesh(position_data.eval, verts, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, nodes[i]);
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@@ -748,8 +761,7 @@ static void calc_sphere_filter(const Depsgraph &depsgraph,
tls.translations.resize(verts.size());
const MutableSpan<float3> translations = tls.translations;
calc_sphere_translations(orig_data.positions, factors, translations);
reset_translations_to_original(translations, positions, orig_data.positions);
calc_sphere_translations(positions, factors, translations);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, position_data.eval, verts, translations);
@@ -765,7 +777,6 @@ static void calc_sphere_filter(const Depsgraph &depsgraph,
LocalData &tls = all_tls.local();
const Span<int> grids = nodes[i].grids();
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_grids(object, nodes[i]);
tls.factors.resize(positions.size());
const MutableSpan<float> factors = tls.factors;
@@ -776,11 +787,10 @@ static void calc_sphere_filter(const Depsgraph &depsgraph,
tls.translations.resize(positions.size());
const MutableSpan<float3> translations = tls.translations;
calc_sphere_translations(orig_data.positions, factors, translations);
reset_translations_to_original(translations, positions, orig_data.positions);
calc_sphere_translations(positions, factors, translations);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_data.positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, grids, subdiv_ccg);
});
break;
@@ -793,8 +803,6 @@ static void calc_sphere_filter(const Depsgraph &depsgraph,
LocalData &tls = all_tls.local();
const Set<BMVert *, 0> &verts = BKE_pbvh_bmesh_node_unique_verts(&nodes[i]);
const Span<float3> positions = gather_bmesh_positions(verts, tls.positions);
Array<float3> orig_positions(verts.size());
orig_position_data_gather_bmesh(*ss.bm_log, verts, orig_positions, {});
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@@ -803,13 +811,12 @@ static void calc_sphere_filter(const Depsgraph &depsgraph,
depsgraph, object, ss.filter_cache->automasking.get(), nodes[i], verts, factors);
scale_factors(factors, strength);
tls.translations.resize(positions.size());
tls.translations.resize(verts.size());
const MutableSpan<float3> translations = tls.translations;
calc_sphere_translations(orig_positions, factors, translations);
reset_translations_to_original(translations, positions, orig_positions);
calc_sphere_translations(positions, factors, translations);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, verts);
});
break;
@@ -852,8 +859,8 @@ static void calc_random_filter(const Depsgraph &depsgraph,
node_mask.foreach_index(GrainSize(1), [&](const int i) {
LocalData &tls = all_tls.local();
const Span<int> verts = nodes[i].verts();
const Span<float3> positions = gather_data_mesh(position_data.eval, verts, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, nodes[i]);
const Span<float3> positions = gather_data_mesh(position_data.eval, verts, tls.positions);
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@@ -863,12 +870,11 @@ static void calc_random_filter(const Depsgraph &depsgraph,
depsgraph, object, ss.filter_cache->automasking.get(), nodes[i], verts, factors);
scale_factors(factors, strength);
randomize_factors(orig_data.positions, ss.filter_cache->random_seed, factors);
randomize_factors(positions, ss.filter_cache->random_seed, factors);
tls.translations.resize(verts.size());
const MutableSpan<float3> translations = tls.translations;
translations.copy_from(orig_data.normals);
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_data.positions);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, position_data.eval, verts, translations);
@@ -893,15 +899,14 @@ static void calc_random_filter(const Depsgraph &depsgraph,
depsgraph, object, ss.filter_cache->automasking.get(), nodes[i], grids, factors);
scale_factors(factors, strength);
randomize_factors(orig_data.positions, ss.filter_cache->random_seed, factors);
randomize_factors(positions, ss.filter_cache->random_seed, factors);
tls.translations.resize(positions.size());
const MutableSpan<float3> translations = tls.translations;
translations.copy_from(orig_data.normals);
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_data.positions);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_data.positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, grids, subdiv_ccg);
});
break;
@@ -925,15 +930,14 @@ static void calc_random_filter(const Depsgraph &depsgraph,
depsgraph, object, ss.filter_cache->automasking.get(), nodes[i], verts, factors);
scale_factors(factors, strength);
randomize_factors(orig_positions, ss.filter_cache->random_seed, factors);
tls.translations.resize(positions.size());
randomize_factors(positions, ss.filter_cache->random_seed, factors);
tls.translations.resize(verts.size());
const MutableSpan<float3> translations = tls.translations;
translations.copy_from(orig_normals);
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_positions);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, verts);
});
break;
@@ -1408,15 +1412,15 @@ static void calc_surface_smooth_filter(const Depsgraph &depsgraph,
scatter_data_grids(subdiv_ccg, laplacian_disp.as_span(), grids, all_laplacian_disp);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_data.positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, grids, subdiv_ccg);
});
node_mask.foreach_index(GrainSize(1), [&](const int i) {
LocalData &tls = all_tls.local();
const Span<int> grids = nodes[i].grids();
const OrigPositionData orig_data = orig_position_data_get_grids(object, nodes[i]);
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
tls.factors.resize(orig_data.positions.size());
tls.factors.resize(positions.size());
const MutableSpan<float> factors = tls.factors;
fill_factor_from_hide_and_mask(subdiv_ccg, grids, factors);
auto_mask::calc_grids_factors(
@@ -1427,19 +1431,19 @@ static void calc_surface_smooth_filter(const Depsgraph &depsgraph,
const MutableSpan<float3> laplacian_disp = gather_data_grids(
subdiv_ccg, all_laplacian_disp.as_span(), grids, tls.laplacian_disp);
tls.average_positions.resize(orig_data.positions.size());
tls.average_positions.resize(positions.size());
const MutableSpan<float3> average_laplacian_disps = tls.average_positions;
smooth::average_data_grids(
subdiv_ccg, all_laplacian_disp.as_span(), grids, average_laplacian_disps);
tls.translations.resize(orig_data.positions.size());
tls.translations.resize(positions.size());
const MutableSpan<float3> translations = tls.translations;
smooth::surface_smooth_displace_step(
laplacian_disp, average_laplacian_disps, beta, translations);
scale_translations(translations, factors);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_data.positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, grids, subdiv_ccg);
});
break;
@@ -1479,15 +1483,13 @@ static void calc_surface_smooth_filter(const Depsgraph &depsgraph,
scatter_data_bmesh(laplacian_disp.as_span(), verts, all_laplacian_disp);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, verts);
});
node_mask.foreach_index(GrainSize(1), [&](const int i) {
LocalData &tls = all_tls.local();
const Set<BMVert *, 0> &verts = BKE_pbvh_bmesh_node_unique_verts(&nodes[i]);
Array<float3> orig_positions(verts.size());
Array<float3> orig_normals(verts.size());
orig_position_data_gather_bmesh(*ss.bm_log, verts, orig_positions, orig_normals);
const Span<float3> positions = gather_bmesh_positions(verts, tls.positions);
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@@ -1511,7 +1513,7 @@ static void calc_surface_smooth_filter(const Depsgraph &depsgraph,
scale_translations(translations, factors);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, verts);
});
break;
@@ -1819,8 +1821,6 @@ static void calc_enhance_details_filter(const Depsgraph &depsgraph,
node_mask.foreach_index(GrainSize(1), [&](const int i) {
LocalData &tls = all_tls.local();
const Span<int> verts = nodes[i].verts();
const Span<float3> positions = gather_data_mesh(position_data.eval, verts, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_mesh(object, nodes[i]);
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@@ -1833,7 +1833,6 @@ static void calc_enhance_details_filter(const Depsgraph &depsgraph,
const MutableSpan translations = gather_data_mesh(
ss.filter_cache->detail_directions.as_span(), verts, tls.translations);
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_data.positions);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, position_data.eval, verts, translations);
@@ -1849,7 +1848,6 @@ static void calc_enhance_details_filter(const Depsgraph &depsgraph,
LocalData &tls = all_tls.local();
const Span<int> grids = nodes[i].grids();
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_grids(object, nodes[i]);
tls.factors.resize(positions.size());
const MutableSpan<float> factors = tls.factors;
@@ -1861,10 +1859,9 @@ static void calc_enhance_details_filter(const Depsgraph &depsgraph,
const MutableSpan translations = gather_data_grids(
subdiv_ccg, ss.filter_cache->detail_directions.as_span(), grids, tls.translations);
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_data.positions);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_data.positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, grids, subdiv_ccg);
});
break;
@@ -1877,8 +1874,6 @@ static void calc_enhance_details_filter(const Depsgraph &depsgraph,
LocalData &tls = all_tls.local();
const Set<BMVert *, 0> &verts = BKE_pbvh_bmesh_node_unique_verts(&nodes[i]);
const Span<float3> positions = gather_bmesh_positions(verts, tls.positions);
Array<float3> orig_positions(verts.size());
orig_position_data_gather_bmesh(*ss.bm_log, verts, orig_positions, {});
tls.factors.resize(verts.size());
const MutableSpan<float> factors = tls.factors;
@@ -1890,10 +1885,9 @@ static void calc_enhance_details_filter(const Depsgraph &depsgraph,
const MutableSpan<float3> translations = gather_data_bmesh(
ss.filter_cache->detail_directions.as_span(), verts, tls.translations);
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_positions);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, verts);
});
break;
@@ -1922,7 +1916,6 @@ static void calc_erase_displacement_filter(const Depsgraph &depsgraph,
LocalData &tls = all_tls.local();
const Span<int> grids = nodes[i].grids();
const Span<float3> positions = gather_grids_positions(subdiv_ccg, grids, tls.positions);
const OrigPositionData orig_data = orig_position_data_get_grids(object, nodes[i]);
tls.factors.resize(positions.size());
const MutableSpan<float> factors = tls.factors;
@@ -1936,12 +1929,11 @@ static void calc_erase_displacement_filter(const Depsgraph &depsgraph,
subdiv_ccg, ss.filter_cache->limit_surface_co.as_span(), grids, tls.new_positions);
tls.translations.resize(positions.size());
const MutableSpan<float3> translations = tls.translations;
translations_from_new_positions(new_positions, orig_data.positions, translations);
translations_from_new_positions(new_positions, positions, translations);
scale_translations(translations, factors);
reset_translations_to_original(translations, positions, orig_data.positions);
zero_disabled_axis_components(*ss.filter_cache, translations);
clip_and_lock_translations(sd, ss, orig_data.positions, translations);
clip_and_lock_translations(sd, ss, positions, translations);
apply_translations(translations, grids, subdiv_ccg);
});
}
@@ -2136,7 +2128,7 @@ static void sculpt_mesh_update_status_bar(bContext *C, wmOperator * /*op*/)
status.item(IFACE_("Cancel"), ICON_EVENT_ESC, ICON_MOUSE_RMB);
}
static void sculpt_mesh_filter_apply(bContext *C, wmOperator *op)
static void sculpt_mesh_filter_apply(bContext *C, wmOperator *op, bool is_replay = false)
{
const Depsgraph &depsgraph = *CTX_data_depsgraph_pointer(C);
Object &ob = *CTX_data_active_object(C);
@@ -2150,7 +2142,12 @@ static void sculpt_mesh_filter_apply(bContext *C, wmOperator *op)
const IndexMask &node_mask = ss.filter_cache->node_mask;
switch (filter_type) {
case MeshFilterType::Smooth:
calc_smooth_filter(depsgraph, sd, strength, ob, node_mask);
calc_smooth_filter(depsgraph,
sd,
strength,
ob,
node_mask,
is_replay && ss.filter_cache->iteration_count == 0);
break;
case MeshFilterType::Scale:
calc_scale_filter(depsgraph, sd, strength, ob, node_mask);
@@ -2228,7 +2225,7 @@ static void sculpt_mesh_filter_apply_with_history(bContext *C, wmOperator *op)
}
sculpt_mesh_update_strength(op, ss, start_mouse, mouse);
sculpt_mesh_filter_apply(C, op);
sculpt_mesh_filter_apply(C, op, true);
}
RNA_END;
@@ -2270,7 +2267,7 @@ static void sculpt_mesh_filter_cancel(bContext *C, wmOperator * /*op*/)
}
undo::restore_position_from_undo_step(depsgraph, ob);
bke::pbvh::update_normals(depsgraph, ob, *pbvh);
bke::pbvh::update_bounds(depsgraph, ob, *pbvh);
}
@@ -2331,6 +2328,9 @@ static int sculpt_mesh_filter_modal(bContext *C, wmOperator *op, const wmEvent *
RNA_float_set_array(&itemptr, "mouse_event", mouse);
RNA_float_set(&itemptr, "pressure", WM_event_tablet_data(event, nullptr, nullptr));
}
else {
undo::restore_position_from_undo_step(*depsgraph, ob);
}
float2 prev_mval(float(event->prev_press_xy[0]), float(event->prev_press_xy[1]));
float2 mval(float(event->xy[0]), float(event->xy[1]));