Fix #134909: Crazyspace has incorrect deformed positions due to armature modifier

The fix 8af27ce27e assumed that
the `edit_hints->positions()` were always empty and that we would always
fallback to using the evalauted positions instead.

But if the edit hints are populated, this fails. In this case, we populate the
positions in `remember_deformed_positions_if_necessary`.

The fix makes sure that we write to the `edit_hint` positions if they are
populated.

Pull Request: https://projects.blender.org/blender/blender/pulls/135033
This commit is contained in:
Falk David
2025-02-24 13:52:42 +01:00
committed by Falk David
parent 857743db9d
commit 8cf9d01453

View File

@@ -165,7 +165,7 @@ static void modify_curves(ModifierData &md,
edit_hints->deform_mats.emplace(drawing.strokes().points_num(), float3x3::identity());
}
deform_mats = edit_hints->deform_mats->as_mutable_span();
if (has_bezier_curves) {
if (edit_hints->positions()) {
deform_positions = edit_hints->positions_for_write();
}
}
@@ -180,24 +180,39 @@ static void modify_curves(ModifierData &md,
deform_mats_for_curve = deform_mats->slice(points);
}
BKE_armature_deform_coords_with_curves(*amd.object,
*ctx.object,
&curves.vertex_group_names,
positions.slice(points),
old_positions_for_curve,
deform_mats_for_curve,
dverts.slice(points),
deformflag,
amd.influence.vertex_group_name);
if (deform_positions) {
const IndexRange orig_points = orig_points_by_curve[curve_i];
if (has_bezier_curves) {
const IndexRange orig_points = orig_points_by_curve[curve_i];
BKE_armature_deform_coords_with_curves(*amd.object,
*ctx.object,
&curves.vertex_group_names,
deform_positions->slice(orig_points),
{},
{},
orig_dverts.as_span().slice(orig_points),
deformflag,
amd.influence.vertex_group_name);
}
else {
BKE_armature_deform_coords_with_curves(*amd.object,
*ctx.object,
&curves.vertex_group_names,
deform_positions->slice(points),
old_positions_for_curve,
deform_mats_for_curve,
dverts.slice(points),
deformflag,
amd.influence.vertex_group_name);
}
}
else {
BKE_armature_deform_coords_with_curves(*amd.object,
*ctx.object,
&curves.vertex_group_names,
deform_positions->slice(orig_points),
{},
{},
orig_dverts.as_span().slice(orig_points),
positions.slice(points),
old_positions_for_curve,
deform_mats_for_curve,
dverts.slice(points),
deformflag,
amd.influence.vertex_group_name);
}