From 6eaaceda80a4378738a7a8c11b6d4d5f68b97c6f Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 23 Feb 2023 15:18:25 -0500 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. --- .../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); -- 2.30.2