diff options
author | Hans Goudey <h.goudey@me.com> | 2021-04-28 16:22:10 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-04-28 16:22:10 +0300 |
commit | 1b5b4b067e634b54149e371bd7f8f004fff2d1b3 (patch) | |
tree | 8d5ca916666cb5e8878a7b7f5cf880c213cf5f63 /source/blender | |
parent | 54c583529345df0403a49159c934d0f84b08d8bf (diff) |
Spreadsheet: Add instance IDs from geometry set
Mostly the interesting information about the instances IDs whether they
are -1 or not, but it's still worth displaying them in the editor.
In the future when we can hide or show colums, we could decide to hide
this one by default.
Differential Revision: https://developer.blender.org/D11104
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc index 1ae3f462cfa..bd459944cff 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc @@ -261,7 +261,7 @@ void InstancesDataSource::foreach_default_column_ids( SpreadsheetColumnID column_id; column_id.name = (char *)"Name"; fn(column_id); - for (const char *name : {"Position", "Rotation", "Scale"}) { + for (const char *name : {"Position", "Rotation", "Scale", "ID"}) { column_id.name = (char *)name; fn(column_id); } @@ -322,6 +322,15 @@ std::unique_ptr<ColumnValues> InstancesDataSource::get_column_values( }, default_float3_column_width); } + Span<int> ids = component_->ids(); + if (STREQ(column_id.name, "ID")) { + /* Make the column a bit wider by default, since the IDs tend to be large numbers. */ + return column_values_from_function( + column_id.name, + size, + [ids](int index, CellValue &r_cell_value) { r_cell_value.value_int = ids[index]; }, + 5.5f); + } return {}; } |