Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Schempp <fabianschempp@googlemail.com>2021-06-25 23:57:47 +0300
committerFabian Schempp <fabianschempp@googlemail.com>2021-06-25 23:57:47 +0300
commit5759bbe9f9e8706356c9d39939f472e3bb717860 (patch)
treef8d4cf78e9dc58112762f9a5a80068ae65a27d41
parenteae709046469d58282258203da802cae8b745d21 (diff)
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
-rw-r--r--source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc32
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;