From 5a51b0458ede98171783a42e4b2606e7105259a9 Mon Sep 17 00:00:00 2001 From: zhouhang95 <765229842@qq.com> Date: Thu, 8 Aug 2024 17:42:18 +0800 Subject: [PATCH 1/2] improve-abc-curve --- projects/Alembic/ReadAlembic.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/projects/Alembic/ReadAlembic.cpp b/projects/Alembic/ReadAlembic.cpp index 3cba387f0b..9dbfe444ec 100644 --- a/projects/Alembic/ReadAlembic.cpp +++ b/projects/Alembic/ReadAlembic.cpp @@ -990,6 +990,20 @@ static std::shared_ptr foundABCCurves(Alembic::AbcGeom::ICurves offset += count; } } + if (auto width = mesh.getWidthsParam()) { + auto widthsamp = + width.getIndexedValue(Alembic::Abc::v12::ISampleSelector((Alembic::AbcCoreAbstract::index_t)sample_index)); + int index_size = (int)widthsamp.getIndices()->size(); + prim->userData().set2("index_size", index_size); + if (prim->verts.size() == index_size) { + auto &width_attr = prim->add_attr("width"); + for (auto i = 0; i < prim->verts.size(); i++) { + auto index = widthsamp.getIndices()->operator[](i); + auto value = widthsamp.getVals()->operator[](index); + width_attr[i] = value; + } + } + } ICompoundProperty arbattrs = mesh.getArbGeomParams(); read_attributes2(prim, arbattrs, iSS, read_done); ICompoundProperty usrData = mesh.getUserProperties(); From 0d821513b8a90f7b8b7c848b9001aea0aa5dd634 Mon Sep 17 00:00:00 2001 From: zhouhang95 <765229842@qq.com> Date: Thu, 8 Aug 2024 17:46:35 +0800 Subject: [PATCH 2/2] fix --- projects/Alembic/ReadAlembic.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/Alembic/ReadAlembic.cpp b/projects/Alembic/ReadAlembic.cpp index 9dbfe444ec..d6af7d05ce 100644 --- a/projects/Alembic/ReadAlembic.cpp +++ b/projects/Alembic/ReadAlembic.cpp @@ -994,7 +994,6 @@ static std::shared_ptr foundABCCurves(Alembic::AbcGeom::ICurves auto widthsamp = width.getIndexedValue(Alembic::Abc::v12::ISampleSelector((Alembic::AbcCoreAbstract::index_t)sample_index)); int index_size = (int)widthsamp.getIndices()->size(); - prim->userData().set2("index_size", index_size); if (prim->verts.size() == index_size) { auto &width_attr = prim->add_attr("width"); for (auto i = 0; i < prim->verts.size(); i++) {