24 template<
typename T,
typename OperationFn>
31 if (check_fn(
data[i])) {
44 if (column_data.
type().
is<
float>()) {
50 column_data.
typed<
float>(),
51 [&](
const float cell) { return std::abs(cell - value) < threshold; },
58 column_data.
typed<
float>(),
59 [&](
const float cell) { return cell > value; },
66 column_data.
typed<
float>(),
67 [&](
const float cell) { return cell < value; },
74 else if (column_data.
type().
is<
bool>()) {
77 column_data.
typed<
bool>(),
78 [&](
const bool cell) { return cell == value; },
88 [&](
const int cell) { return cell == value; },
96 [value](
const int cell) { return cell > value; },
104 [&](
const int cell) { return cell < value; },
111 else if (column_data.
type().
is<
int>()) {
116 column_data.
typed<
int>(),
117 [&](
const int cell) { return cell == value; },
124 column_data.
typed<
int>(),
125 [value](
const int cell) { return cell > value; },
132 column_data.
typed<
int>(),
133 [&](
const int cell) { return cell < value; },
147 [&](
const float2 cell) { return math::distance_squared(cell, value) <= threshold_sq; },
155 [&](
const float2 cell) { return cell.x > value.x && cell.y > value.y; },
163 [&](
const float2 cell) { return cell.x < value.x && cell.y < value.y; },
177 [&](
const float3 cell) { return math::distance_squared(cell, value) <= threshold_sq; },
186 return cell.x > value.x && cell.y > value.y && cell.z > value.z;
196 return cell.x < value.x && cell.y < value.y && cell.z < value.z;
212 return len_squared_v4v4(cell, value) <= threshold_sq;
222 return cell.r > value.r && cell.g > value.g && cell.b > value.b && cell.a > value.a;
232 return cell.r < value.r && cell.g < value.g && cell.b < value.b && cell.a < value.a;
244 const float4 value_floats = {
250 const ColorGeometry4f cell = cell_bytes.decode();
251 const float4 cell_floats = {
252 (float)cell.r, (float)cell.g, (float)cell.b, (float)cell.a};
263 const ColorGeometry4f cell = cell_bytes.decode();
264 return cell.r > value.r && cell.g > value.g && cell.b > value.b && cell.a > value.a;
274 const ColorGeometry4f cell = cell_bytes.decode();
275 return cell.r < value.r && cell.g < value.g && cell.b < value.b && cell.a < value.a;
284 const StringRef value = row_filter.value_string;
288 switch (cell.type()) {
289 case InstanceReference::Type::Object: {
290 return value == (reinterpret_cast<ID &>(cell.object()).name + 2);
292 case InstanceReference::Type::Collection: {
293 return value == (reinterpret_cast<ID &>(cell.collection()).name + 2);
295 case InstanceReference::Type::GeometrySet: {
298 case InstanceReference::Type::None: {
338 const int tot_rows = data_source.
tot_rows();
344 if (!(use_filters || use_selection)) {
351 mask_indices.
reserve(tot_rows);
367 if (!columns.
contains(row_filter->column_name)) {
403 new_filter->
next =
nullptr;
404 new_filter->
prev =
nullptr;
typedef float(TangentPoint)[2]
#define BLI_assert_unreachable()
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
MINLINE float pow2f(float x)
MINLINE float len_squared_v4v4(const float a[4], const float b[4]) ATTR_WARN_UNUSED_RESULT
@ SPREADSHEET_ROW_FILTER_BOOL_VALUE
@ SPREADSHEET_ROW_FILTER_UI_EXPAND
@ SPREADSHEET_ROW_FILTER_ENABLED
@ SPREADSHEET_FILTER_SELECTED_ONLY
@ SPREADSHEET_FILTER_ENABLE
@ SPREADSHEET_ROW_FILTER_GREATER
@ SPREADSHEET_ROW_FILTER_EQUAL
@ SPREADSHEET_ROW_FILTER_LESS
const CPPType & type() const
VArray< T > typed() const
bool add(const Key &key, const Value &value)
const Value & lookup(const Key &key) const
bool contains(const Key &key) const
void append(const T &value)
void reserve(const int64_t min_capacity)
StringRefNull name() const
const GVArray & data() const
virtual int tot_rows() const
virtual bool has_selection_filter() const
IndexMask apply_selection_filter(Vector< int64_t > &indices) const
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
void(* MEM_freeN)(void *vmemh)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
SpreadsheetRowFilter * spreadsheet_row_filter_new()
IndexMask spreadsheet_filter_rows(const SpaceSpreadsheet &sspreadsheet, const SpreadsheetLayout &spreadsheet_layout, const DataSource &data_source, ResourceScope &scope)
SpreadsheetRowFilter * spreadsheet_row_filter_copy(const SpreadsheetRowFilter *src_row_filter)
static bool use_selection_filter(const SpaceSpreadsheet &sspreadsheet, const DataSource &data_source)
static void apply_row_filter(const SpreadsheetRowFilter &row_filter, const Map< StringRef, const ColumnValues * > &columns, const IndexMask prev_mask, Vector< int64_t > &new_indices)
void spreadsheet_row_filter_free(SpreadsheetRowFilter *row_filter)
static bool use_row_filters(const SpaceSpreadsheet &sspreadsheet)
static void apply_filter_operation(const VArray< T > &data, OperationFn check_fn, const IndexMask mask, Vector< int64_t > &new_indices)
struct SpreadsheetRowFilter * prev
struct SpreadsheetRowFilter * next
const ColumnValues * values
Vector< ColumnLayout > columns