From f679dfeef5a381983b1a76aefe84ecc359bcda69 Mon Sep 17 00:00:00 2001 From: zhouhang95 <765229842@qq.com> Date: Tue, 1 Aug 2023 12:47:22 +0800 Subject: [PATCH] abc-i32-attr --- projects/Alembic/ReadAlembic.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/projects/Alembic/ReadAlembic.cpp b/projects/Alembic/ReadAlembic.cpp index 29d35053c5..e196823d61 100644 --- a/projects/Alembic/ReadAlembic.cpp +++ b/projects/Alembic/ReadAlembic.cpp @@ -85,6 +85,31 @@ static void read_attributes(std::shared_ptr prim, ICompoundProp } } } + else if (IInt32GeomParam::matches(p)) { + IInt32GeomParam param(arbattrs, p.getName()); + + IInt32GeomParam::Sample samp = param.getIndexedValue(iSS); + std::vector data; + data.resize(samp.getVals()->size()); + for (auto i = 0; i < samp.getVals()->size(); i++) { + data[i] = samp.getVals()->get()[i]; + } + if (!read_done) { + log_info("[alembic] i32 attr {}, len {}.", p.getName(), data.size()); + } + + if (prim->verts.size() == data.size()) { + auto &attr = prim->add_attr(p.getName()); + for (auto i = 0; i < prim->verts.size(); i++) { + attr[i] = data[i]; + } + } + else { + if (!read_done) { + log_error("[alembic] can not load attr {}. Check if link to Points channel when exported from Houdini.", p.getName()); + } + } + } else if (IV3fGeomParam::matches(p)) { IV3fGeomParam param(arbattrs, p.getName()); if (!read_done) {