diff --git a/projects/Alembic/ReadAlembic.cpp b/projects/Alembic/ReadAlembic.cpp index c38d20ba1f..98ca8a6639 100644 --- a/projects/Alembic/ReadAlembic.cpp +++ b/projects/Alembic/ReadAlembic.cpp @@ -132,6 +132,9 @@ static void read_velocity(std::shared_ptr prim, V3fArraySampleP template void attr_from_data(std::shared_ptr prim, GeometryScope scope, std::string attr_name, std::vector &data) { if (scope == GeometryScope::kUniformScope) { + if (zeno::ends_with(attr_name, "_polys")) { + attr_name = attr_name.substr(0, attr_name.size() - 6); + } if (prim->polys.size() == data.size()) { auto &attr = prim->polys.add_attr(attr_name); for (auto i = 0; i < prim->polys.size(); i++) { @@ -161,6 +164,9 @@ void attr_from_data(std::shared_ptr prim, GeometryScope scope, } } else if (scope == GeometryScope::kFacevaryingScope) { + if (zeno::ends_with(attr_name, "_loops")) { + attr_name = attr_name.substr(0, attr_name.size() - 6); + } if (prim->loops.size() == data.size()) { auto &attr = prim->loops.add_attr(attr_name); for (auto i = 0; i < prim->loops.size(); i++) { diff --git a/projects/Alembic/WriteAlembic.cpp b/projects/Alembic/WriteAlembic.cpp index afc60f7028..8373bb468e 100644 --- a/projects/Alembic/WriteAlembic.cpp +++ b/projects/Alembic/WriteAlembic.cpp @@ -253,11 +253,16 @@ void write_attrs( } }); if (prim->loops.size() > 0) { - prim->loops.foreach_attr>([&](auto const &key, auto &arr) { - if (key == "uvs") { + prim->loops.foreach_attr>([&](auto const &_key, auto &arr) { + if (_key == "uvs") { return; } + std::string key = _key; std::string full_key = path + '/' + key; + if (verts_attrs.count(full_key)) { + key += "_loops"; + full_key = path + '/' + key; + } using T = std::decay_t; if constexpr (std::is_same_v) { if (loops_attrs.count(full_key) == 0) { @@ -308,11 +313,16 @@ void write_attrs( }); } if (prim->polys.size() > 0) { - prim->polys.foreach_attr>([&](auto const &key, auto &arr) { - if (key == "faceset" || key == "matid" || key == "abcpath") { + prim->polys.foreach_attr>([&](auto const &_key, auto &arr) { + if (_key == "faceset" || _key == "matid" || _key == "abcpath") { return; } + std::string key = _key; std::string full_key = path + '/' + key; + if (verts_attrs.count(full_key) || loops_attrs.count(full_key)) { + key += "_polys"; + full_key = path + '/' + key; + } using T = std::decay_t; if constexpr (std::is_same_v) { if (polys_attrs.count(full_key) == 0) {