diff options
Diffstat (limited to 'source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc')
-rw-r--r-- | source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc b/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc index 1fa6e47fcdf..4f870092caa 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc @@ -130,6 +130,16 @@ void DatasetRegionDrawer::draw_hierarchy(const DatasetLayoutHierarchy &layout) } } +static int element_count_from_instances(const GeometrySet &geometry_set) +{ + if (geometry_set.has_instances()) { + const InstancesComponent *instances_component = + geometry_set.get_component_for_read<InstancesComponent>(); + return instances_component->instances_amount(); + } + return 0; +} + static int element_count_from_component_domain(const GeometrySet &geometry_set, GeometryComponentType component, AttributeDomain domain) @@ -145,12 +155,6 @@ static int element_count_from_component_domain(const GeometrySet &geometry_set, return point_cloud_component->attribute_domain_size(domain); } - if (geometry_set.has_instances() && component == GEO_COMPONENT_TYPE_INSTANCES) { - const InstancesComponent *instances_component = - geometry_set.get_component_for_read<InstancesComponent>(); - return instances_component->instances_amount(); - } - if (geometry_set.has_volume() && component == GEO_COMPONENT_TYPE_VOLUME) { const VolumeComponent *volume_component = geometry_set.get_component_for_read<VolumeComponent>(); @@ -182,11 +186,17 @@ void DatasetRegionDrawer::draw_dataset_row(const int indentation, ymin_offset}; char element_count[7]; - BLI_str_format_attribute_domain_size( - element_count, - domain ? element_count_from_component_domain( - draw_context.current_geometry_set, component, *domain) : - 0); + if (component == GEO_COMPONENT_TYPE_INSTANCES) { + BLI_str_format_attribute_domain_size( + element_count, element_count_from_instances(draw_context.current_geometry_set)); + } + else { + BLI_str_format_attribute_domain_size( + element_count, + domain ? element_count_from_component_domain( + draw_context.current_geometry_set, component, *domain) : + 0); + } std::string label_and_element_count = label; label_and_element_count += UI_SEP_CHAR; |