diff options
author | Jacques Lucke <jacques@blender.org> | 2021-04-15 09:57:10 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-04-15 10:00:47 +0300 |
commit | 3810bcc1604756f433b5b799b66d8b81645767ca (patch) | |
tree | de0ba2c5ca0cbadf3838959a19475d19cce994df /source/blender/makesdna | |
parent | 0bac7682239f2ee117a80ed3ce62a1877331c974 (diff) |
Spreadsheet: breadcrumbs and node pinning
This introduces a context path to the spreadsheet editor, which contains
information about what data is shown in the spreadsheet. The context
path (breadcrumbs) can reference a specific node in a node group
hierarchy. During object evaluation, the geometry nodes modifier checks
what data is currently requested by visible spreadsheets and stores
the corresponding geometry sets separately for later access.
The context path can be updated by the user explicitely, by clicking
on the new icon in the header of nodes. Under some circumstances,
the context path is updated automatically based on Blender's context.
This patch also consolidates the "Node" and "Final" object evaluation
mode to just "Evaluated". Based on the current context path, either
the final geometry set of an object will be displayed, or the data at
a specific node.
The new preview icon in geometry nodes now behaves more like
a toggle. It can be clicked again to clear the context path in an
open spreadsheet editor.
Previously, only an object could be pinned in the spreadsheet editor.
Now it is possible to pin the entire context path. That allows two
different spreadsheets to display geometry data from two different
nodes.
The breadcrumbs in the spreadsheet header can be collapsed by
clicking on the arrow icons. It's not ideal but works well for now.
This might be changed again, if we get a data set region on the left.
Differential Revision: https://developer.blender.org/D10931
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_object_types.h | 5 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 51 |
2 files changed, 50 insertions, 6 deletions
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 9822aa4f7e4..aa1178fb139 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -169,9 +169,10 @@ typedef struct Object_Runtime { struct GeometrySet *geometry_set_eval; /** - * Data from this geometry set is previewed in the spreadsheet editor. + * A GHash that contains geometry sets for intermediate stages of evaluation. The keys are just a + * hash and are not owned by the map. The geometry sets are owned. */ - struct GeometrySet *geometry_set_preview; + void *geometry_set_previews; /** * Mesh structure created during object evaluation. diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 747e392b529..ab74282eb64 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -1870,6 +1870,32 @@ typedef struct SpreadsheetColumn { SpreadsheetColumnID *id; } SpreadsheetColumn; +/** + * An item in SpaceSpreadsheet.context_path. + * This is a bases struct for the structs below. + */ +typedef struct SpreadsheetContext { + struct SpreadsheetContext *next, *prev; + /* eSpaceSpreadsheet_ContextType. */ + int type; + char _pad[4]; +} SpreadsheetContext; + +typedef struct SpreadsheetContextObject { + SpreadsheetContext base; + struct Object *object; +} SpreadsheetContextObject; + +typedef struct SpreadsheetContextModifier { + SpreadsheetContext base; + char *modifier_name; +} SpreadsheetContextModifier; + +typedef struct SpreadsheetContextNode { + SpreadsheetContext base; + char *node_name; +} SpreadsheetContextNode; + typedef struct SpaceSpreadsheet { SpaceLink *next, *prev; /** Storage of regions for inactive spaces. */ @@ -1882,7 +1908,13 @@ typedef struct SpaceSpreadsheet { /* List of #SpreadsheetColumn. */ ListBase columns; - struct ID *pinned_id; + /** + * List of #SpreadsheetContext. + * This is a path to the data that is displayed in the spreadsheet. + * It can be set explicitely by an action of the user (e.g. clicking the preview icon in a + * geometry node) or it can be derived from context automatically based on some heuristic. + */ + ListBase context_path; /* eSpaceSpreadsheet_FilterFlag. */ uint8_t filter_flag; @@ -1894,21 +1926,32 @@ typedef struct SpaceSpreadsheet { /* eSpaceSpreadsheet_ObjectContext. */ uint8_t object_eval_state; - char _pad1[4]; + /* eSpaceSpreadsheet_Flag. */ + uint32_t flag; SpaceSpreadsheet_Runtime *runtime; } SpaceSpreadsheet; +typedef enum eSpaceSpreadsheet_Flag { + SPREADSHEET_FLAG_PINNED = (1 << 0), + SPREADSHEET_FLAG_CONTEXT_PATH_COLLAPSED = (1 << 1), +} eSpaceSpreadsheet_Flag; + typedef enum eSpaceSpreadsheet_FilterFlag { SPREADSHEET_FILTER_SELECTED_ONLY = (1 << 0), } eSpaceSpreadsheet_FilterFlag; typedef enum eSpaceSpreadsheet_ObjectEvalState { - SPREADSHEET_OBJECT_EVAL_STATE_FINAL = 0, + SPREADSHEET_OBJECT_EVAL_STATE_EVALUATED = 0, SPREADSHEET_OBJECT_EVAL_STATE_ORIGINAL = 1, - SPREADSHEET_OBJECT_EVAL_STATE_NODE = 2, } eSpaceSpreadsheet_Context; +typedef enum eSpaceSpreadsheet_ContextType { + SPREADSHEET_CONTEXT_OBJECT = 0, + SPREADSHEET_CONTEXT_MODIFIER = 1, + SPREADSHEET_CONTEXT_NODE = 2, +} eSpaceSpreadsheet_ContextType; + /** * 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. |