Fix #112294: USD import: Fix spammy prints for unsupported and non-array attributes.
- Added support for Point3* and Normal3* attributes as CD_PROP_FLOAT3. - Caught the last two quaternion formats. - Silenced prints on quaternion and string formats, as they are known unsupported attributes. This pull addresses https://projects.blender.org/blender/blender/issues/112294. The test file provided for that issue now only generates one error, which I believe is important to keep. Co-authored-by: Charles Wardlaw <kattkieru@users.noreply.github.com> Pull Request: https://projects.blender.org/blender/blender/pulls/112298
This commit is contained in:
parent
ea2746d468
commit
8caee74a11
|
@ -180,6 +180,12 @@ static std::optional<eCustomDataType> convert_usd_type_to_blender(
|
|||
map.add_new(pxr::SdfValueTypeNames->TexCoord3fArray, CD_PROP_FLOAT2);
|
||||
map.add_new(pxr::SdfValueTypeNames->TexCoord3hArray, CD_PROP_FLOAT2);
|
||||
map.add_new(pxr::SdfValueTypeNames->Float3Array, CD_PROP_FLOAT3);
|
||||
map.add_new(pxr::SdfValueTypeNames->Point3fArray, CD_PROP_FLOAT3);
|
||||
map.add_new(pxr::SdfValueTypeNames->Point3dArray, CD_PROP_FLOAT3);
|
||||
map.add_new(pxr::SdfValueTypeNames->Point3hArray, CD_PROP_FLOAT3);
|
||||
map.add_new(pxr::SdfValueTypeNames->Normal3fArray, CD_PROP_FLOAT3);
|
||||
map.add_new(pxr::SdfValueTypeNames->Normal3dArray, CD_PROP_FLOAT3);
|
||||
map.add_new(pxr::SdfValueTypeNames->Normal3hArray, CD_PROP_FLOAT3);
|
||||
map.add_new(pxr::SdfValueTypeNames->Vector3fArray, CD_PROP_FLOAT3);
|
||||
map.add_new(pxr::SdfValueTypeNames->Vector3hArray, CD_PROP_FLOAT3);
|
||||
map.add_new(pxr::SdfValueTypeNames->Vector3dArray, CD_PROP_FLOAT3);
|
||||
|
@ -189,6 +195,8 @@ static std::optional<eCustomDataType> convert_usd_type_to_blender(
|
|||
map.add_new(pxr::SdfValueTypeNames->StringArray, CD_PROP_STRING);
|
||||
map.add_new(pxr::SdfValueTypeNames->BoolArray, CD_PROP_BOOL);
|
||||
map.add_new(pxr::SdfValueTypeNames->QuatfArray, CD_PROP_QUATERNION);
|
||||
map.add_new(pxr::SdfValueTypeNames->QuatdArray, CD_PROP_QUATERNION);
|
||||
map.add_new(pxr::SdfValueTypeNames->QuathArray, CD_PROP_QUATERNION);
|
||||
return map;
|
||||
}();
|
||||
|
||||
|
@ -885,6 +893,11 @@ void USDMeshReader::read_custom_data(const ImportSettings *settings,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!pv.GetAttr().GetTypeName().IsArray()) {
|
||||
/* Non-array attributes are technically improper USD. */
|
||||
continue;
|
||||
}
|
||||
|
||||
const pxr::SdfValueTypeName type = pv.GetTypeName();
|
||||
const pxr::TfToken varying_type = pv.GetInterpolation();
|
||||
const pxr::TfToken name = pv.StripPrimvarsName(pv.GetPrimvarName());
|
||||
|
@ -897,6 +910,16 @@ void USDMeshReader::read_custom_data(const ImportSettings *settings,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (ELEM(type,
|
||||
pxr::SdfValueTypeNames->StringArray,
|
||||
pxr::SdfValueTypeNames->QuatfArray,
|
||||
pxr::SdfValueTypeNames->QuatdArray,
|
||||
pxr::SdfValueTypeNames->QuathArray))
|
||||
{
|
||||
/* Skip creating known unsupported types, and avoid spammy error prints. */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Read Color primvars. */
|
||||
if (convert_usd_type_to_blender(type) == CD_PROP_COLOR) {
|
||||
if ((settings->read_flag & MOD_MESHSEQ_READ_COLOR) != 0) {
|
||||
|
|
Loading…
Reference in New Issue