Fix #131451: Crash moving Grease Pencil points

Proportional editing expects `IndexMask` from all Bezier points not only from selection as it affects not only selected curves.
Therefore `selected_editable_strokes` changed `editable_strokes` and initialized with `retrieve_editable_strokes`.

Pull Request: https://projects.blender.org/blender/blender/pulls/131519
This commit is contained in:
Laurynas Duburas
2024-12-09 12:48:02 +01:00
committed by Falk David
parent 0d8f040c8b
commit b68be2aedd
2 changed files with 5 additions and 6 deletions

View File

@@ -260,7 +260,7 @@ static void createTransCurvesVerts(bContext * /*C*/, TransInfo *t)
tc.data_len = curves.points_num() + 2 * bezier_points.size();
points_to_transform_per_attribute[i].append(curves.points_range());
if (bezier_points.size() > 0) {
if (selection_attribute_names.size() > 1) {
points_to_transform_per_attribute[i].append(bezier_points);
points_to_transform_per_attribute[i].append(bezier_points);
}

View File

@@ -89,9 +89,8 @@ static void createTransGreasePencilVerts(bContext *C, TransInfo *t)
const IndexMask editable_points = ed::greasepencil::retrieve_editable_points(
*object, info.drawing, info.layer_index, curves_transform_data->memory);
const IndexMask selected_editable_strokes =
ed::greasepencil::retrieve_editable_and_selected_strokes(
*object, info.drawing, info.layer_index, curves_transform_data->memory);
const IndexMask editable_strokes = ed::greasepencil::retrieve_editable_strokes(
*object, info.drawing, info.layer_index, curves_transform_data->memory);
for (const int attribute_i : selection_attribute_names.index_range()) {
const StringRef &selection_name = selection_attribute_names[attribute_i];
@@ -106,7 +105,7 @@ static void createTransGreasePencilVerts(bContext *C, TransInfo *t)
bezier_curves[layer_offset] = bke::curves::indices_for_type(curves.curve_types(),
curves.curve_type_counts(),
CURVE_TYPE_BEZIER,
selected_editable_strokes,
editable_strokes,
curves_transform_data->memory);
/* Alter selection as in legacy curves bezt_select_to_transform_triple_flag(). */
if (!bezier_curves[layer_offset].is_empty()) {
@@ -147,7 +146,7 @@ static void createTransGreasePencilVerts(bContext *C, TransInfo *t)
tc.data_len += curves.points_num() + 2 * bezier_points.size();
points_to_transform_per_attribute[layer_offset].append(curves.points_range());
if (!bezier_points.is_empty()) {
if (selection_attribute_names.size() > 1) {
points_to_transform_per_attribute[layer_offset].append(bezier_points);
points_to_transform_per_attribute[layer_offset].append(bezier_points);
}