Fix: A few small issues with spreadsheet row filters

- int2 and short2 filters were completely disfunctional
- Don't use threshold for integer comparisons; it's not in the UI
- Filter with geometry set name for instance "Name" column
This commit is contained in:
Hans Goudey
2025-05-04 22:05:46 -04:00
parent 33bef53c3e
commit beadd08fb7

View File

@@ -133,16 +133,15 @@ static IndexMask apply_row_filter(const SpreadsheetRowFilter &row_filter,
const int2 value = row_filter.value_int2;
switch (row_filter.operation) {
case SPREADSHEET_ROW_FILTER_EQUAL: {
const float threshold_sq = pow2f(row_filter.threshold);
apply_filter_operation(
return apply_filter_operation(
column_data.typed<int2>(),
[&](const int2 cell) { return math::distance_squared(cell, value) <= threshold_sq; },
[&](const int2 cell) { return cell == value; },
prev_mask,
memory);
break;
}
case SPREADSHEET_ROW_FILTER_GREATER: {
apply_filter_operation(
return apply_filter_operation(
column_data.typed<int2>(),
[&](const int2 cell) { return cell.x > value.x && cell.y > value.y; },
prev_mask,
@@ -150,7 +149,7 @@ static IndexMask apply_row_filter(const SpreadsheetRowFilter &row_filter,
break;
}
case SPREADSHEET_ROW_FILTER_LESS: {
apply_filter_operation(
return apply_filter_operation(
column_data.typed<int2>(),
[&](const int2 cell) { return cell.x < value.x && cell.y < value.y; },
prev_mask,
@@ -163,16 +162,15 @@ static IndexMask apply_row_filter(const SpreadsheetRowFilter &row_filter,
const short2 value = short2(int2(row_filter.value_int2));
switch (row_filter.operation) {
case SPREADSHEET_ROW_FILTER_EQUAL: {
const float threshold_sq = pow2f(row_filter.threshold);
apply_filter_operation(
return apply_filter_operation(
column_data.typed<short2>(),
[&](const short2 cell) { return math::distance_squared(cell, value) <= threshold_sq; },
[&](const short2 cell) { return cell == value; },
prev_mask,
memory);
break;
}
case SPREADSHEET_ROW_FILTER_GREATER: {
apply_filter_operation(
return apply_filter_operation(
column_data.typed<short2>(),
[&](const short2 cell) { return cell.x > value.x && cell.y > value.y; },
prev_mask,
@@ -180,7 +178,7 @@ static IndexMask apply_row_filter(const SpreadsheetRowFilter &row_filter,
break;
}
case SPREADSHEET_ROW_FILTER_LESS: {
apply_filter_operation(
return apply_filter_operation(
column_data.typed<short2>(),
[&](const short2 cell) { return cell.x < value.x && cell.y < value.y; },
prev_mask,
@@ -345,7 +343,7 @@ static IndexMask apply_row_filter(const SpreadsheetRowFilter &row_filter,
return value == (reinterpret_cast<ID &>(cell.collection()).name + 2);
}
case bke::InstanceReference::Type::GeometrySet: {
return false;
return value == cell.geometry_set().name;
}
case bke::InstanceReference::Type::None: {
return false;