diff --git a/source/blender/io/usd/intern/usd_reader_curve.cc b/source/blender/io/usd/intern/usd_reader_curve.cc index a347db8d09c..66e191f48a8 100644 --- a/source/blender/io/usd/intern/usd_reader_curve.cc +++ b/source/blender/io/usd/intern/usd_reader_curve.cc @@ -289,13 +289,12 @@ void USDCurvesReader::read_custom_data(bke::CurvesGeometry &curves, std::vector primvars = pv_api.GetPrimvarsWithValues(); for (const pxr::UsdGeomPrimvar &pv : primvars) { - if (!pv.HasValue()) { - continue; + const pxr::SdfValueTypeName pv_type = pv.GetTypeName(); + if (!pv_type.IsArray()) { + continue; /* Skip non-array primvar attributes. */ } - const pxr::SdfValueTypeName pv_type = pv.GetTypeName(); const pxr::TfToken pv_interp = pv.GetInterpolation(); - const std::optional domain = convert_usd_interp_to_blender(pv_interp); const std::optional type = convert_usd_type_to_blender(pv_type); diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc index 00f4097450e..d7d140d406c 100644 --- a/source/blender/io/usd/intern/usd_reader_mesh.cc +++ b/source/blender/io/usd/intern/usd_reader_mesh.cc @@ -662,22 +662,12 @@ void USDMeshReader::read_custom_data(const ImportSettings *settings, pxr::TfToken active_uv_set_name; /* Convert primvars to custom layer data. */ - for (pxr::UsdGeomPrimvar &pv : primvars) { - if (!pv.HasValue()) { - BKE_reportf(reports(), - RPT_WARNING, - "Skipping primvar %s, mesh %s -- no value", - pv.GetName().GetText(), - &mesh->id.name[2]); - continue; - } - - if (!pv.GetAttr().GetTypeName().IsArray()) { - /* Non-array attributes are technically improper USD. */ - continue; - } - + for (const pxr::UsdGeomPrimvar &pv : primvars) { const pxr::SdfValueTypeName type = pv.GetTypeName(); + if (!type.IsArray()) { + continue; /* Skip non-array primvar attributes. */ + } + const pxr::TfToken varying_type = pv.GetInterpolation(); const pxr::TfToken name = pxr::UsdGeomPrimvar::StripPrimvarsName(pv.GetPrimvarName()); diff --git a/source/blender/io/usd/intern/usd_reader_points.cc b/source/blender/io/usd/intern/usd_reader_points.cc index 674b3cb1d87..496f2bb5243 100644 --- a/source/blender/io/usd/intern/usd_reader_points.cc +++ b/source/blender/io/usd/intern/usd_reader_points.cc @@ -129,15 +129,13 @@ void USDPointsReader::read_custom_data(PointCloud *point_cloud, std::vector primvars = pv_api.GetPrimvarsWithValues(); for (const pxr::UsdGeomPrimvar &pv : primvars) { - if (!pv.HasValue()) { - continue; - } - const pxr::SdfValueTypeName pv_type = pv.GetTypeName(); + if (!pv_type.IsArray()) { + continue; /* Skip non-array primvar attributes. */ + } const bke::AttrDomain domain = bke::AttrDomain::Point; const std::optional type = convert_usd_type_to_blender(pv_type); - if (!type.has_value()) { return; } diff --git a/source/blender/io/usd/intern/usd_reader_shape.cc b/source/blender/io/usd/intern/usd_reader_shape.cc index a2364c96a6b..60ae7d6f1f2 100644 --- a/source/blender/io/usd/intern/usd_reader_shape.cc +++ b/source/blender/io/usd/intern/usd_reader_shape.cc @@ -187,18 +187,9 @@ void USDShapeReader::apply_primvars_to_mesh(Mesh *mesh, const double motionSampl pxr::TfToken active_color_name; for (const pxr::UsdGeomPrimvar &pv : primvars) { - if (!pv.HasValue()) { - BKE_reportf(reports(), - RPT_WARNING, - "Skipping primvar %s, mesh %s -- no value", - pv.GetName().GetText(), - &mesh->id.name[2]); - continue; - } - - if (!pv.GetAttr().GetTypeName().IsArray()) { - /* Non-array attributes are technically improper USD. */ - continue; + const pxr::SdfValueTypeName pv_type = pv.GetTypeName(); + if (!pv_type.IsArray()) { + continue; /* Skip non-array primvar attributes. */ } const pxr::TfToken name = pxr::UsdGeomPrimvar::StripPrimvarsName(pv.GetPrimvarName()); @@ -208,9 +199,7 @@ void USDShapeReader::apply_primvars_to_mesh(Mesh *mesh, const double motionSampl continue; } - const pxr::SdfValueTypeName sdf_type = pv.GetTypeName(); - - const std::optional type = convert_usd_type_to_blender(sdf_type); + const std::optional type = convert_usd_type_to_blender(pv_type); if (type == CD_PROP_COLOR) { /* Set the active color name to 'displayColor', if a color primvar * with this name exists. Otherwise, use the name of the first