Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc')
-rw-r--r--source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc160
1 files changed, 120 insertions, 40 deletions
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc
index eb8f111baa0..6806e185cfe 100644
--- a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc
@@ -14,8 +14,6 @@
#include "RNA_access.h"
-#include "spreadsheet_intern.hh"
-
#include "spreadsheet_data_source_geometry.hh"
#include "spreadsheet_intern.hh"
#include "spreadsheet_layout.hh"
@@ -73,6 +71,35 @@ static void apply_row_filter(const SpreadsheetRowFilter &row_filter,
}
}
}
+ else if (column_data.type().is<int8_t>()) {
+ const int value = row_filter.value_int;
+ switch (row_filter.operation) {
+ case SPREADSHEET_ROW_FILTER_EQUAL: {
+ apply_filter_operation(
+ column_data.typed<int8_t>(),
+ [&](const int cell) { return cell == value; },
+ prev_mask,
+ new_indices);
+ break;
+ }
+ case SPREADSHEET_ROW_FILTER_GREATER: {
+ apply_filter_operation(
+ column_data.typed<int8_t>(),
+ [value](const int cell) { return cell > value; },
+ prev_mask,
+ new_indices);
+ break;
+ }
+ case SPREADSHEET_ROW_FILTER_LESS: {
+ apply_filter_operation(
+ column_data.typed<int8_t>(),
+ [&](const int cell) { return cell < value; },
+ prev_mask,
+ new_indices);
+ break;
+ }
+ }
+ }
else if (column_data.type().is<int>()) {
const int value = row_filter.value_int;
switch (row_filter.operation) {
@@ -168,49 +195,76 @@ static void apply_row_filter(const SpreadsheetRowFilter &row_filter,
}
else if (column_data.type().is<ColorGeometry4f>()) {
const ColorGeometry4f value = row_filter.value_color;
- const float threshold_sq = pow2f(row_filter.threshold);
- apply_filter_operation(
- column_data.typed<ColorGeometry4f>(),
- [&](const ColorGeometry4f cell) { return len_squared_v4v4(cell, value) <= threshold_sq; },
- prev_mask,
- new_indices);
+ switch (row_filter.operation) {
+ case SPREADSHEET_ROW_FILTER_EQUAL: {
+ const float threshold_sq = pow2f(row_filter.threshold);
+ apply_filter_operation(
+ column_data.typed<ColorGeometry4f>(),
+ [&](const ColorGeometry4f cell) {
+ return len_squared_v4v4(cell, value) <= threshold_sq;
+ },
+ prev_mask,
+ new_indices);
+ break;
+ }
+ case SPREADSHEET_ROW_FILTER_GREATER: {
+ apply_filter_operation(
+ column_data.typed<ColorGeometry4f>(),
+ [&](const ColorGeometry4f cell) {
+ return cell.r > value.r && cell.g > value.g && cell.b > value.b && cell.a > value.a;
+ },
+ prev_mask,
+ new_indices);
+ break;
+ }
+ case SPREADSHEET_ROW_FILTER_LESS: {
+ apply_filter_operation(
+ column_data.typed<ColorGeometry4f>(),
+ [&](const ColorGeometry4f cell) {
+ return cell.r < value.r && cell.g < value.g && cell.b < value.b && cell.a < value.a;
+ },
+ prev_mask,
+ new_indices);
+ break;
+ }
+ }
}
else if (column_data.type().is<ColorGeometry4b>()) {
- const ColorGeometry4b value = row_filter.value_byte_color;
- const float4 value_floats = {(float)value.r, (float)value.g, (float)value.b, (float)value.a};
- const float threshold_sq = pow2f(row_filter.threshold);
- apply_filter_operation(
- column_data.typed<ColorGeometry4b>(),
- [&](const ColorGeometry4b cell) {
- const float4 cell_floats = {(float)cell.r, (float)cell.g, (float)cell.b, (float)cell.a};
- return len_squared_v4v4(value_floats, cell_floats) <= threshold_sq;
- },
- prev_mask,
- new_indices);
- }
- else if (column_data.type().is<InstanceReference>()) {
- const StringRef value = row_filter.value_string;
+ const ColorGeometry4f value = row_filter.value_color;
switch (row_filter.operation) {
case SPREADSHEET_ROW_FILTER_EQUAL: {
+ const float4 value_floats = {
+ (float)value.r, (float)value.g, (float)value.b, (float)value.a};
+ const float threshold_sq = pow2f(row_filter.threshold);
apply_filter_operation(
- column_data.typed<InstanceReference>(),
- [&](const InstanceReference cell) {
- switch (cell.type()) {
- case InstanceReference::Type::Object: {
- return value == (reinterpret_cast<ID &>(cell.object()).name + 2);
- }
- case InstanceReference::Type::Collection: {
- return value == (reinterpret_cast<ID &>(cell.collection()).name + 2);
- }
- case InstanceReference::Type::GeometrySet: {
- return false;
- }
- case InstanceReference::Type::None: {
- return false;
- }
- }
- BLI_assert_unreachable();
- return false;
+ column_data.typed<ColorGeometry4b>(),
+ [&](const ColorGeometry4b cell_bytes) {
+ const ColorGeometry4f cell = cell_bytes.decode();
+ const float4 cell_floats = {
+ (float)cell.r, (float)cell.g, (float)cell.b, (float)cell.a};
+ return len_squared_v4v4(value_floats, cell_floats) <= threshold_sq;
+ },
+ prev_mask,
+ new_indices);
+ break;
+ }
+ case SPREADSHEET_ROW_FILTER_GREATER: {
+ apply_filter_operation(
+ column_data.typed<ColorGeometry4b>(),
+ [&](const ColorGeometry4b cell_bytes) {
+ const ColorGeometry4f cell = cell_bytes.decode();
+ return cell.r > value.r && cell.g > value.g && cell.b > value.b && cell.a > value.a;
+ },
+ prev_mask,
+ new_indices);
+ break;
+ }
+ case SPREADSHEET_ROW_FILTER_LESS: {
+ apply_filter_operation(
+ column_data.typed<ColorGeometry4b>(),
+ [&](const ColorGeometry4b cell_bytes) {
+ const ColorGeometry4f cell = cell_bytes.decode();
+ return cell.r < value.r && cell.g < value.g && cell.b < value.b && cell.a < value.a;
},
prev_mask,
new_indices);
@@ -218,6 +272,32 @@ static void apply_row_filter(const SpreadsheetRowFilter &row_filter,
}
}
}
+ else if (column_data.type().is<InstanceReference>()) {
+ const StringRef value = row_filter.value_string;
+
+ apply_filter_operation(
+ column_data.typed<InstanceReference>(),
+ [&](const InstanceReference cell) {
+ switch (cell.type()) {
+ case InstanceReference::Type::Object: {
+ return value == (reinterpret_cast<ID &>(cell.object()).name + 2);
+ }
+ case InstanceReference::Type::Collection: {
+ return value == (reinterpret_cast<ID &>(cell.collection()).name + 2);
+ }
+ case InstanceReference::Type::GeometrySet: {
+ return false;
+ }
+ case InstanceReference::Type::None: {
+ return false;
+ }
+ }
+ BLI_assert_unreachable();
+ return false;
+ },
+ prev_mask,
+ new_indices);
+ }
}
static bool use_row_filters(const SpaceSpreadsheet &sspreadsheet)