From 1ef380803014e0614d321da4df188a2baf8d0a65 Mon Sep 17 00:00:00 2001 From: Jesse Yurkovich Date: Wed, 19 Feb 2025 23:09:03 +0100 Subject: [PATCH] Fix: Incorrect radius values used for Alembic points and USD nurbs These were reading in "widths" and not adjusting the values when setting Blender's "radius" properties. Found while cleaning up the radius API usage as part of another change. Pull Request: https://projects.blender.org/blender/blender/pulls/134709 --- source/blender/io/alembic/intern/abc_reader_points.cc | 10 +++++----- source/blender/io/usd/intern/usd_reader_nurbs.cc | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/blender/io/alembic/intern/abc_reader_points.cc b/source/blender/io/alembic/intern/abc_reader_points.cc index 87aa3cfbd59..328525f98e2 100644 --- a/source/blender/io/alembic/intern/abc_reader_points.cc +++ b/source/blender/io/alembic/intern/abc_reader_points.cc @@ -140,11 +140,11 @@ void AbcPointsReader::read_geometry(bke::GeometrySet &geometry_set, const P3fArraySamplePtr &positions = sample.getPositions(); const IFloatGeomParam widths_param = m_schema.getWidthsParam(); - FloatArraySamplePtr radii; + FloatArraySamplePtr widths; if (widths_param.valid()) { IFloatGeomParam::Sample wsample = widths_param.getExpandedValue(sample_sel); - radii = wsample.getVals(); + widths = wsample.getVals(); } if (point_cloud->totpoint != positions->size()) { @@ -163,9 +163,9 @@ void AbcPointsReader::read_geometry(bke::GeometrySet &geometry_set, attribute_accessor.lookup_or_add_for_write_span("radius", bke::AttrDomain::Point); MutableSpan point_radii = point_radii_writer.span; - if (radii) { - for (size_t i = 0; i < radii->size(); i++) { - point_radii[i] = (*radii)[i]; + if (widths) { + for (size_t i = 0; i < widths->size(); i++) { + point_radii[i] = (*widths)[i] / 2.0f; } } else { diff --git a/source/blender/io/usd/intern/usd_reader_nurbs.cc b/source/blender/io/usd/intern/usd_reader_nurbs.cc index 9e9938a71cb..47a8a3350b7 100644 --- a/source/blender/io/usd/intern/usd_reader_nurbs.cc +++ b/source/blender/io/usd/intern/usd_reader_nurbs.cc @@ -150,7 +150,7 @@ void USDNurbsReader::read_curve_sample(Curve *cu, const double motionSampleTime) float radius = 0.1f; if (idx < usdWidths.size()) { - radius = usdWidths[idx]; + radius = usdWidths[idx] / 2.0f; } bp->radius = radius;