Cleanup: Use boolean operator to combine booleans instead of bitwise OR

There is a reason for the bitwise operator but it's not explained:
The attribute_foreach function callback has side-effects that the
compiler does not know about (everything is const). Simply replacing
the bitwise operator will cause the second term to be skipped, which
breaks tests due to missing attributes.

Now the term is explicitly evaluated first, then combined with actual
boolean operator.

Pull Request: https://projects.blender.org/blender/blender/pulls/126366
This commit is contained in:
Lukas Tönne
2024-08-15 15:05:02 +02:00
parent 013a2ce765
commit 4e6dff2995

View File

@@ -788,13 +788,14 @@ static bool attribute_foreach(const bke::GeometrySet &geometry_set,
reference.to_geometry_set(instance_geometry_set);
/* Process child instances with a recursive call. */
if (current_depth != child_depth_target) {
child_has_component = child_has_component | attribute_foreach(instance_geometry_set,
component_types,
current_depth + 1,
child_depth_target,
instance_depth,
selection,
callback);
const bool has_component = attribute_foreach(instance_geometry_set,
component_types,
current_depth + 1,
child_depth_target,
instance_depth,
selection,
callback);
child_has_component = child_has_component || has_component;
}
});
}