GPv3: Cyclical set operator #111904
@ -179,6 +179,7 @@ void copy_group_to_group(OffsetIndices<int> src_offsets,
|
||||
void count_indices(Span<int> indices, MutableSpan<int> counts);
|
||||
|
||||
void invert_booleans(MutableSpan<bool> span);
|
||||
void invert_booleans(MutableSpan<bool> span, const IndexMask &mask);
|
||||
|
||||
enum class BooleanMix {
|
||||
None,
|
||||
|
@ -85,6 +85,11 @@ void invert_booleans(MutableSpan<bool> span)
|
||||
});
|
||||
}
|
||||
|
||||
void invert_booleans(MutableSpan<bool> span, const IndexMask &mask)
|
||||
{
|
||||
mask.foreach_index_optimized<int64_t>([&](const int64_t i) { span[i] = !span[i]; });
|
||||
}
|
||||
|
||||
BooleanMix booleans_mix_calc(const VArray<bool> &varray, const IndexRange range_to_check)
|
||||
{
|
||||
if (varray.is_empty()) {
|
||||
|
@ -846,17 +846,17 @@ static int grease_pencil_cyclical_set_exec(bContext *C, wmOperator *op)
|
||||
IndexMaskMemory memory;
|
||||
const IndexMask curve_selection = ed::curves::retrieve_selected_curves(curves, memory);
|
||||
|
||||
curve_selection.foreach_index([&](const int64_t curve_i) {
|
||||
if (mode == CyclicalMode::CLOSE) {
|
||||
cyclic[curve_i] = true;
|
||||
}
|
||||
else if (mode == CyclicalMode::OPEN) {
|
||||
cyclic[curve_i] = false;
|
||||
}
|
||||
else if (mode == CyclicalMode::TOGGLE) {
|
||||
cyclic[curve_i] ^= true;
|
||||
}
|
||||
});
|
||||
switch (mode) {
|
||||
case CyclicalMode::CLOSE:
|
||||
casey-bianco-davis marked this conversation as resolved
Outdated
Hans Goudey
commented
Outdated
Review
```
switch (mode) {
case CyclicalMode::CLOSE:
index_mask::masked_fill(cyclic, true, curve_selection);
break;
case CyclicalMode::OPEN:
index_mask::masked_fill(cyclic, false, curve_selection);
break;
case CyclicalMode::TOGGLE:
array_utils::invert_booleans(cyclic, curve_selection);
break;
}
```
|
||||
index_mask::masked_fill(cyclic, true, curve_selection);
|
||||
break;
|
||||
case CyclicalMode::OPEN:
|
||||
index_mask::masked_fill(cyclic, false, curve_selection);
|
||||
break;
|
||||
case CyclicalMode::TOGGLE:
|
||||
array_utils::invert_booleans(cyclic, curve_selection);
|
||||
break;
|
||||
}
|
||||
|
||||
changed = true;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user