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
This commit is contained in:
Hans Goudey 2021-04-28 08:22:10 -05:00
parent 54c5835293
commit 1b5b4b067e
1 changed files with 10 additions and 1 deletions

View File

@ -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 {};
}