Fix #114737: Curves: Random selection crash in curve select mode

Inverting an index mask needs to use the correct "full" index range.

Pull Request: https://projects.blender.org/blender/blender/pulls/114785
This commit is contained in:
Hans Goudey 2023-11-13 12:45:28 +01:00 committed by Hans Goudey
parent f2d15d4fd1
commit e10ac17fdb

@ -905,11 +905,12 @@ static int select_random_exec(bContext *C, wmOperator *op)
for (Curves *curves_id : unique_curves) {
CurvesGeometry &curves = curves_id->geometry.wrap();
const eAttrDomain selection_domain = eAttrDomain(curves_id->selection_domain);
const int domain_size = curves.attributes().domain_size(selection_domain);
IndexMaskMemory memory;
const IndexMask inv_random_elements = random_mask(
curves, selection_domain, seed, probability, memory)
.complement(curves.points_range(), memory);
.complement(IndexRange(domain_size), memory);
const bool was_anything_selected = has_anything_selected(curves);
bke::GSpanAttributeWriter selection = ensure_selection_attribute(