Fix #138545: Grease Pencil connected proportional editing wrong

It would not use topological distances.

This was the case for Grease Pencil, Curves were right though (even
though both use the same code `curve_populate_trans_data_structs` /
`calculate_curve_point_distances_for_proportional_editing`)

So that calculation is actually right, the thing that made it fail for
Grease Pencil was that `init_proportional_edit` was calling
`set_prop_dist` with the `with_dist` argument as `true` [this would
overwrite the already calculated dist with the "plain", "non-
topological" distance again... leading to wrong values being used in
`calculatePropRatio`]

So to resolve, skip the `set_prop_dist` alltogether if T_PROP_CONNECTED
is used. Done for both Curves and Grease Pencil and move into own block.
Legacy Curve get their own codeblock (with a comment where their
topological distances are calculated).

Pull Request: https://projects.blender.org/blender/blender/pulls/138588
This commit is contained in:
Philipp Oeser
2025-05-08 18:37:19 +02:00
committed by Philipp Oeser
parent 992e7c95a7
commit c86f5c2a64

View File

@@ -753,18 +753,35 @@ static void init_proportional_edit(TransInfo *t)
&TransConvertType_MeshVertCData))
{
if (t->flag & T_PROP_CONNECTED) {
/* Already calculated by transform_convert_mesh_connectivity_distance. */
/* Already calculated by #transform_convert_mesh_connectivity_distance. */
}
else {
set_prop_dist(t, false);
}
}
else if (t->data_type == &TransConvertType_MeshUV && t->flag & T_PROP_CONNECTED) {
/* Already calculated by uv_set_connectivity_distance. */
/* Already calculated by #uv_set_connectivity_distance. */
}
else if (ELEM(t->data_type, &TransConvertType_Curve, &curves::TransConvertType_Curves)) {
BLI_assert(t->obedit_type == OB_CURVES_LEGACY || t->obedit_type == OB_CURVES);
set_prop_dist(t, false);
else if (t->data_type == &TransConvertType_Curve) {
BLI_assert(t->obedit_type == OB_CURVES_LEGACY);
if (t->flag & T_PROP_CONNECTED) {
/* Already calculated by #calc_distanceCurveVerts. */
}
else {
set_prop_dist(t, false);
}
}
else if (ELEM(t->data_type,
&curves::TransConvertType_Curves,
&greasepencil::TransConvertType_GreasePencil))
{
BLI_assert(t->obedit_type == OB_CURVES || t->obedit_type == OB_GREASE_PENCIL);
if (t->flag & T_PROP_CONNECTED) {
/* Already calculated by #calculate_curve_point_distances_for_proportional_editing. */
}
else {
set_prop_dist(t, false);
}
}
else {
set_prop_dist(t, true);