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/blenkernel/intern/screen.c | |
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/blenkernel/intern/screen.c')
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index d5540a3cfd3..d0d63192ebf 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -227,7 +227,12 @@ void BKE_screen_foreach_id_screen_area(LibraryForeachIDData *data, ScrArea *area case SPACE_SPREADSHEET: { SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)sl; - BKE_LIB_FOREACHID_PROCESS_ID(data, sspreadsheet->pinned_id, IDWALK_CB_NOP); + LISTBASE_FOREACH (SpreadsheetContext *, context, &sspreadsheet->context_path) { + if (context->type == SPREADSHEET_CONTEXT_OBJECT) { + BKE_LIB_FOREACHID_PROCESS( + data, ((SpreadsheetContextObject *)context)->object, IDWALK_CB_NOP); + } + } break; } default: @@ -1357,6 +1362,27 @@ static void write_area(BlendWriter *writer, ScrArea *area) BLO_write_struct(writer, SpreadsheetColumnID, column->id); BLO_write_string(writer, column->id->name); } + LISTBASE_FOREACH (SpreadsheetContext *, context, &sspreadsheet->context_path) { + switch (context->type) { + case SPREADSHEET_CONTEXT_OBJECT: { + SpreadsheetContextObject *object_context = (SpreadsheetContextObject *)context; + BLO_write_struct(writer, SpreadsheetContextObject, object_context); + break; + } + case SPREADSHEET_CONTEXT_MODIFIER: { + SpreadsheetContextModifier *modifier_context = (SpreadsheetContextModifier *)context; + BLO_write_struct(writer, SpreadsheetContextModifier, modifier_context); + BLO_write_string(writer, modifier_context->modifier_name); + break; + } + case SPREADSHEET_CONTEXT_NODE: { + SpreadsheetContextNode *node_context = (SpreadsheetContextNode *)context; + BLO_write_struct(writer, SpreadsheetContextNode, node_context); + BLO_write_string(writer, node_context->node_name); + break; + } + } + } } } } @@ -1715,6 +1741,25 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area) BLO_read_data_address(reader, &column->id); BLO_read_data_address(reader, &column->id->name); } + + BLO_read_list(reader, &sspreadsheet->context_path); + LISTBASE_FOREACH (SpreadsheetContext *, context, &sspreadsheet->context_path) { + switch (context->type) { + case SPREADSHEET_CONTEXT_NODE: { + SpreadsheetContextNode *node_context = (SpreadsheetContextNode *)context; + BLO_read_data_address(reader, &node_context->node_name); + break; + } + case SPREADSHEET_CONTEXT_MODIFIER: { + SpreadsheetContextModifier *modifier_context = (SpreadsheetContextModifier *)context; + BLO_read_data_address(reader, &modifier_context->modifier_name); + break; + } + case SPREADSHEET_CONTEXT_OBJECT: { + break; + } + } + } } } @@ -1931,7 +1976,12 @@ void BKE_screen_area_blend_read_lib(BlendLibReader *reader, ID *parent_id, ScrAr } case SPACE_SPREADSHEET: { SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)sl; - BLO_read_id_address(reader, parent_id->lib, &sspreadsheet->pinned_id); + LISTBASE_FOREACH (SpreadsheetContext *, context, &sspreadsheet->context_path) { + if (context->type == SPREADSHEET_CONTEXT_OBJECT) { + BLO_read_id_address( + reader, parent_id->lib, &((SpreadsheetContextObject *)context)->object); + } + } break; } default: |