diff options
author | Hans Goudey <h.goudey@me.com> | 2021-12-15 18:34:13 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-12-15 18:34:13 +0300 |
commit | 474adc6f883c2d5a854d7324364f7996044d83cb (patch) | |
tree | 7ed0cf70d7195526e389c586fdd87af193c8215b /source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc | |
parent | d79868c4e678b22f7f277d98ae3ce729893fdfb7 (diff) |
Refactor: Simplify spreadsheet handling of cell values
Previously we used a `CellValue` class to hold the data for a cell,
and called a function to fill it whenever necessary. This is an
unnecessary complication when we have virtual generic arrays
and most data is already easily accessible that way anyway.
This patch removes `CellValue` and uses `fn::GVArray` to provide
access to data instead.
In the future, if rows have different types within a single column,
we can use a `GVArray` of `blender::Any` to interface with the drawing.
Along with that, the use of virtual arrays made it easy to do a
few other cleanups:
- Use selection domain interpolations from rB5841f8656d95
for the mesh selection filter.
- Change the row filter to only calculate for necessary indices.
Differential Revision: https://developer.blender.org/D13478
Diffstat (limited to 'source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc')
-rw-r--r-- | source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc index a07abac4474..bcced7b5937 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc @@ -114,6 +114,8 @@ static std::string value_string(const SpreadsheetRowFilter &row_filter, } case SPREADSHEET_VALUE_TYPE_STRING: return row_filter.value_string; + case SPREADSHEET_VALUE_TYPE_UNKNOWN: + return ""; } BLI_assert_unreachable(); return ""; @@ -238,6 +240,10 @@ static void spreadsheet_filter_panel_draw(const bContext *C, Panel *panel) uiItemR(layout, filter_ptr, "threshold", 0, nullptr, ICON_NONE); break; case SPREADSHEET_VALUE_TYPE_STRING: + uiItemR(layout, filter_ptr, "value_string", 0, IFACE_("Value"), ICON_NONE); + break; + case SPREADSHEET_VALUE_TYPE_UNKNOWN: + uiItemL(layout, IFACE_("Unkown column type"), ICON_ERROR); break; } } |