From 97a8bb450cdb9b6457f907cf0a128ecdd0a652f4 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 27 Feb 2023 00:01:01 +0100 Subject: [PATCH] Fix #103387: Radius affects curves bounding box e8f4010611e76e0b88cd unified the bounds computation for the new curves object type and the rest of the curves system used by geometry nodes. In the process, it made bounds affected by the control point radius. In theory that makes sense; the bounds are supposed to be the extents of the visible geometry. But in practice the change wasn't expected, for a few reasons: - The radius has never affected the bounds for the legacy curve type - The default radius of legacy curve objects is absurdly large at 1.0m - Only the new curve object has visible radius, and only in "strip" mode or when rendering with Cycles Currently the bounds are only used for the "Bounding Box" geometry node and the panel in the 3D viewport sidebar, so there isn't any incentive to choose less intuitive behavior yet. Long term, the correct behavior is probably to include the radius in the bounds, but this commit postpones that change to when it works better with the rest of the curves system. Pull Request #105154 --- .../blender/blenkernel/intern/curves_geometry.cc | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc index 704bbb34f49..b62cb7cafcc 100644 --- a/source/blender/blenkernel/intern/curves_geometry.cc +++ b/source/blender/blenkernel/intern/curves_geometry.cc @@ -981,7 +981,6 @@ void CurvesGeometry::tag_normals_changed() } void CurvesGeometry::tag_radii_changed() { - this->runtime->bounds_cache.tag_dirty(); } static void translate_positions(MutableSpan positions, const float3 &translation) @@ -1064,19 +1063,8 @@ bool CurvesGeometry::bounds_min_max(float3 &min, float3 &max) const return false; } - this->runtime->bounds_cache.ensure([&](Bounds &r_bounds) { - const Span positions = this->evaluated_positions(); - if (this->attributes().contains("radius")) { - const VArraySpan radii = this->attributes().lookup("radius"); - Array evaluated_radii(this->evaluated_points_num()); - this->ensure_can_interpolate_to_evaluated(); - this->interpolate_to_evaluated(radii, evaluated_radii.as_mutable_span()); - r_bounds = *bounds::min_max_with_radii(positions, evaluated_radii.as_span()); - } - else { - r_bounds = *bounds::min_max(positions); - } - }); + this->runtime->bounds_cache.ensure( + [&](Bounds &r_bounds) { r_bounds = *bounds::min_max(this->evaluated_positions()); }); const Bounds &bounds = this->runtime->bounds_cache.data(); min = math::min(bounds.min, min);