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:
authorHans Goudey <h.goudey@me.com>2021-06-19 00:33:02 +0300
committerHans Goudey <h.goudey@me.com>2021-06-19 00:33:02 +0300
commitf9aea19d98908be450f228a35bb6098e7e3e4b03 (patch)
tree87e91bc56f4235a86bcd44706b0f76064131e3df /source/blender/makesdna/DNA_space_types.h
parentd52b7dbe2695c673b3bad091b55893413e7b022b (diff)
Spreadsheet Editor: Row Filters
This patch adds support for filtering rows based on rules and values. Filters will work for any attribute data source, they are a property of the spreadsheet rather than of the attribute system. The properties displayed in the row filter can depend on data type of the currently visible column with that name. If the name is no longer visible, the row filter filter is grayed out, but it will remember the value until a column with its name is visible again. Note: The comments in `screen.c` combined with tagging the sidebar for redraw after the main region point to a lack of understanding or technical debt, that is a point to improve in the future. **Future Improvements** * T89272: A search menu for visible columns when adding a new filter. * T89273: Possibly a "Range" operation. Differential Revision: https://developer.blender.org/D10959
Diffstat (limited to 'source/blender/makesdna/DNA_space_types.h')
-rw-r--r--source/blender/makesdna/DNA_space_types.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 71764d9308c..7804ece9769 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -1874,6 +1874,19 @@ typedef struct SpreadsheetColumn {
* #SpreadsheetColumnID in the future for different kinds of ids.
*/
SpreadsheetColumnID *id;
+
+ /**
+ * An indicator of the type of values in the column, set at runtime.
+ * #eSpreadsheetColumnValueType.
+ */
+ uint8_t data_type;
+ char _pad0[7];
+
+ /**
+ * The final column name generated by the data source, also just
+ * cached at runtime when the data source columns are generated.
+ */
+ char *display_name;
} SpreadsheetColumn;
/**
@@ -1914,6 +1927,9 @@ typedef struct SpaceSpreadsheet {
/* List of #SpreadsheetColumn. */
ListBase columns;
+ /* SpreadsheetRowFilter. */
+ ListBase row_filters;
+
/**
* List of #SpreadsheetContext.
* This is a path to the data that is displayed in the spreadsheet.
@@ -1945,8 +1961,44 @@ typedef enum eSpaceSpreadsheet_Flag {
typedef enum eSpaceSpreadsheet_FilterFlag {
SPREADSHEET_FILTER_SELECTED_ONLY = (1 << 0),
+ SPREADSHEET_FILTER_ENABLE = (1 << 1),
} eSpaceSpreadsheet_FilterFlag;
+typedef struct SpreadsheetRowFilter {
+ struct SpreadsheetRowFilter *next, *prev;
+
+ char column_name[64]; /* MAX_NAME. */
+
+ /* eSpreadsheetFilterOperation. */
+ uint8_t operation;
+ /* eSpaceSpreadsheet_RowFilterFlag. */
+ uint8_t flag;
+
+ char _pad0[2];
+
+ int value_int;
+ char *value_string;
+ float value_float;
+ float threshold;
+ float value_float2[2];
+ float value_float3[3];
+ float value_color[4];
+
+ char _pad1[4];
+} SpreadsheetRowFilter;
+
+typedef enum eSpaceSpreadsheet_RowFilterFlag {
+ SPREADSHEET_ROW_FILTER_UI_EXPAND = (1 << 0),
+ SPREADSHEET_ROW_FILTER_BOOL_VALUE = (1 << 1),
+ SPREADSHEET_ROW_FILTER_ENABLED = (1 << 2),
+} eSpaceSpreadsheet_RowFilterFlag;
+
+typedef enum eSpreadsheetFilterOperation {
+ SPREADSHEET_ROW_FILTER_EQUAL = 0,
+ SPREADSHEET_ROW_FILTER_GREATER = 1,
+ SPREADSHEET_ROW_FILTER_LESS = 2,
+} eSpreadsheetFilterOperation;
+
typedef enum eSpaceSpreadsheet_ObjectEvalState {
SPREADSHEET_OBJECT_EVAL_STATE_EVALUATED = 0,
SPREADSHEET_OBJECT_EVAL_STATE_ORIGINAL = 1,
@@ -1958,6 +2010,16 @@ typedef enum eSpaceSpreadsheet_ContextType {
SPREADSHEET_CONTEXT_NODE = 2,
} eSpaceSpreadsheet_ContextType;
+typedef enum eSpreadsheetColumnValueType {
+ SPREADSHEET_VALUE_TYPE_BOOL = 0,
+ SPREADSHEET_VALUE_TYPE_INT32 = 1,
+ SPREADSHEET_VALUE_TYPE_FLOAT = 2,
+ SPREADSHEET_VALUE_TYPE_FLOAT2 = 3,
+ SPREADSHEET_VALUE_TYPE_FLOAT3 = 4,
+ SPREADSHEET_VALUE_TYPE_COLOR = 5,
+ SPREADSHEET_VALUE_TYPE_INSTANCES = 6,
+} eSpreadsheetColumnValueType;
+
/**
* We can't just use UI_UNIT_X, because it does not take `widget.points` into account, which
* modifies the width of text as well.