diff options
author | Hans Goudey <h.goudey@me.com> | 2021-03-19 19:38:35 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-03-19 19:38:35 +0300 |
commit | ae51cde3d783b1cec848dd8f78f3b91d85e90d8d (patch) | |
tree | 3833b6b1e5ffee549c58fbc9e8448357555c1bf6 /source/blender/editors/space_spreadsheet/spreadsheet_from_geometry.cc | |
parent | 25f80508300b1a220cb5907f7eb4ab8c587c4032 (diff) |
Larger width for name column, use values for object and collection specifically
Diffstat (limited to 'source/blender/editors/space_spreadsheet/spreadsheet_from_geometry.cc')
-rw-r--r-- | source/blender/editors/space_spreadsheet/spreadsheet_from_geometry.cc | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_from_geometry.cc b/source/blender/editors/space_spreadsheet/spreadsheet_from_geometry.cc index e6ee0ce0432..0937e81c309 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_from_geometry.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_from_geometry.cc @@ -29,8 +29,6 @@ #include "DEG_depsgraph_query.h" -#include "UI_resources.h" - #include "bmesh.h" #include "spreadsheet_from_geometry.hh" @@ -41,34 +39,6 @@ namespace blender::ed::spreadsheet { using blender::bke::ReadAttribute; using blender::bke::ReadAttributePtr; -static StringRefNull instance_data_name(const InstancedData &data) -{ - switch (data.type) { - case INSTANCE_DATA_TYPE_OBJECT: { - const ID *id = reinterpret_cast<const ID *>(data.data.object); - return id->name + 2; - } - case INSTANCE_DATA_TYPE_COLLECTION: { - const ID *id = reinterpret_cast<const ID *>(data.data.object); - return id->name + 2; - } - } - return nullptr; -} - -static int instance_data_icon_id(const InstancedData &data) -{ - switch (data.type) { - case INSTANCE_DATA_TYPE_OBJECT: { - return ICON_OBJECT_DATA; - } - case INSTANCE_DATA_TYPE_COLLECTION: { - return ICON_OUTLINER_COLLECTION; - } - } - return ICON_BLANK1; -} - static void add_columns_for_instances(const InstancesComponent &instances_component, SpreadsheetColumnLayout &column_layout, ResourceCollector &resources) @@ -82,9 +52,20 @@ static void add_columns_for_instances(const InstancesComponent &instances_compon columns.append(spreadsheet_column_from_function( "Name", [instance_data](int index, CellValue &r_cell_value) { const InstancedData &data = instance_data[index]; - r_cell_value.value = IconText{instance_data_icon_id(data), instance_data_name(data)}; + if (data.type == INSTANCE_DATA_TYPE_OBJECT) { + if (data.data.object != nullptr) { + r_cell_value.value = ObjectCellValue{data.data.object}; + } + } + else if (data.type == INSTANCE_DATA_TYPE_COLLECTION) { + if (data.data.collection != nullptr) { + r_cell_value.value = CollectionCellValue{data.data.collection}; + } + } })); + columns.last().get()->default_width = 8.0f; + static std::array<char, 3> axis_char = {'X', 'Y', 'Z'}; for (const int i : {0, 1, 2}) { std::string name = std::string("Position ") + axis_char[i]; |