[Bf-blender-cvs] [67a78f412ba] usd-importer-T81257-merge: USD Import: uv fixes.
makowalski
noreply at git.blender.org
Mon Apr 5 22:44:35 CEST 2021
Commit: 67a78f412ba04b5b9c29df7ca13a533461fc5b4b
Author: makowalski
Date: Sun Mar 21 23:15:45 2021 -0400
Branches: usd-importer-T81257-merge
https://developer.blender.org/rB67a78f412ba04b5b9c29df7ca13a533461fc5b4b
USD Import: uv fixes.
Added logic to handle the case where the st primvar
is a float2 array. Simplified the conditionals for
readability. Now only considering UVs when checking
for animating primvars.
===================================================================
M source/blender/io/usd/intern/usd_reader_mesh.cc
===================================================================
diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc
index 09a7dc160cf..0cdff46aace 100644
--- a/source/blender/io/usd/intern/usd_reader_mesh.cc
+++ b/source/blender/io/usd/intern/usd_reader_mesh.cc
@@ -749,18 +749,35 @@ Mesh *USDMeshReader::read_mesh(Mesh *existing_mesh,
std::vector<pxr::UsdGeomPrimvar> primvars = mesh_prim_.GetPrimvars();
for (pxr::UsdGeomPrimvar p : primvars) {
- if (primvar_varying_map_.find(p.GetPrimvarName()) == primvar_varying_map_.end()) {
- primvar_varying_map_.insert(std::make_pair(p.GetPrimvarName(), p.ValueMightBeTimeVarying()));
- if (p.ValueMightBeTimeVarying())
- is_time_varying_ = true;
+
+ pxr::TfToken name = p.GetPrimvarName();
+ pxr::SdfValueTypeName type = p.GetTypeName();
+
+ bool is_uv = false;
+
+ /* Assume all uvs are stored in one of these primvar types */
+ if (type == pxr::SdfValueTypeNames->TexCoord2hArray ||
+ type == pxr::SdfValueTypeNames->TexCoord2fArray ||
+ type == pxr::SdfValueTypeNames->TexCoord2dArray) {
+ is_uv = true;
+ }
+ /* In some cases, the st primvar is stored as float2 values. */
+ else if (name == usdtokens::st && type == pxr::SdfValueTypeNames->Float2Array) {
+ is_uv = true;
}
- // Assume all uvs are stored in one of these primvar types...
- if (p.GetTypeName() == pxr::SdfValueTypeNames->TexCoord2hArray ||
- p.GetTypeName() == pxr::SdfValueTypeNames->TexCoord2fArray ||
- p.GetTypeName() == pxr::SdfValueTypeNames->TexCoord2dArray) {
+ if (is_uv) {
uv_tokens.push_back(p.GetBaseName());
has_uvs_ = true;
+
+ /* Record whether the UVs might be time varying. */
+ if (primvar_varying_map_.find(name) == primvar_varying_map_.end()) {
+ bool might_be_time_varying = p.ValueMightBeTimeVarying();
+ primvar_varying_map_.insert(std::make_pair(name, might_be_time_varying));
+ if (might_be_time_varying) {
+ is_time_varying_ = true;
+ }
+ }
}
}
More information about the Bf-blender-cvs
mailing list