[Bf-blender-cvs] [1b5b4b067e6] master: Spreadsheet: Add instance IDs from geometry set

Hans Goudey noreply at git.blender.org
Wed Apr 28 15:22:17 CEST 2021


Commit: 1b5b4b067e634b54149e371bd7f8f004fff2d1b3
Author: Hans Goudey
Date:   Wed Apr 28 08:22:10 2021 -0500
Branches: master
https://developer.blender.org/rB1b5b4b067e634b54149e371bd7f8f004fff2d1b3

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

===================================================================

M	source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc

===================================================================

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



More information about the Bf-blender-cvs mailing list