From 1b5b4b067e634b54149e371bd7f8f004fff2d1b3 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 28 Apr 2021 08:22:10 -0500 Subject: 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 --- .../space_spreadsheet/spreadsheet_data_source_geometry.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/space_spreadsheet') 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 InstancesDataSource::get_column_values( }, default_float3_column_width); } + Span 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 {}; } -- cgit v1.2.3