[Bf-blender-cvs] [5759bbe9f9e] master: Fixes a bug where the instances count in the spreadsheet editor dataset region always showed 0. This was caused by a conditional statement that needed a domain to be set, which is not the case for Instances component type.
Fabian Schempp
noreply at git.blender.org
Fri Jun 25 22:57:54 CEST 2021
Commit: 5759bbe9f9e8706356c9d39939f472e3bb717860
Author: Fabian Schempp
Date: Fri Jun 25 22:57:47 2021 +0200
Branches: master
https://developer.blender.org/rB5759bbe9f9e8706356c9d39939f472e3bb717860
Fixes a bug where the instances count in the spreadsheet
editor dataset region always showed 0. This was caused by a conditional
statement that needed a domain to be set, which is not the case for
Instances component type.
Reviewer: Hans Goudey (Hoogly Boogly)
Differential Revision: https://developer.blender.org/D11710
===================================================================
M source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc
===================================================================
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;
More information about the Bf-blender-cvs
mailing list