From 2e475299827fda0c8bcb58527452e4a4a8225bc5 Mon Sep 17 00:00:00 2001 From: zhouhang95 <765229842@qq.com> Date: Tue, 12 Dec 2023 12:33:20 +0800 Subject: [PATCH 1/2] improve abc --- projects/Alembic/ReadAlembic.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/projects/Alembic/ReadAlembic.cpp b/projects/Alembic/ReadAlembic.cpp index 39951c34dd..730b644eae 100644 --- a/projects/Alembic/ReadAlembic.cpp +++ b/projects/Alembic/ReadAlembic.cpp @@ -99,9 +99,15 @@ static void read_attributes(std::shared_ptr prim, ICompoundProp attr[i] = data[i]; } } + else if (prim->loops.size() * 3 == data.size()) { + auto &attr = prim->loops.add_attr(p.getName()); + for (auto i = 0; i < prim->loops.size(); i++) { + attr[i] = { data[ 3 * i], data[3 * i + 1], data[3 * i + 2]}; + } + } else { if (!read_done) { - log_error("[alembic] can not load float attr {}: {}. Check if link to Points channel when exported from Houdini.", p.getName(), data.size()); + log_warn("[alembic] can not load float attr {}: {}.", p.getName(), data.size()); } } } @@ -138,7 +144,7 @@ static void read_attributes(std::shared_ptr prim, ICompoundProp } else { if (!read_done) { - log_error("[alembic] can not load int attr {}. Check if link to Points channel when exported from Houdini.", p.getName()); + log_warn("[alembic] can not load int attr {}:{}.", p.getName(), data.size()); } } } @@ -171,7 +177,7 @@ static void read_attributes(std::shared_ptr prim, ICompoundProp } else { if (!read_done) { - log_error("[alembic] can not load vec3f attr {}. Check if link to Points channel when exported from Houdini.", p.getName()); + log_warn("[alembic] can not load vec3f attr {}:{}.", p.getName(), int(samp.getVals()->size())); } } } @@ -204,7 +210,7 @@ static void read_attributes(std::shared_ptr prim, ICompoundProp } else { if (!read_done) { - log_error("[alembic] can not load N3f attr {}. Check if link to Points channel when exported from Houdini.", p.getName()); + log_warn("[alembic] can not load N3f attr {}:{}.", p.getName(), int(samp.getVals()->size())); } } } @@ -237,13 +243,13 @@ static void read_attributes(std::shared_ptr prim, ICompoundProp } else { if (!read_done) { - log_error("[alembic] can not load C3f attr {}. Check if link to Points channel when exported from Houdini.", p.getName()); + log_warn("[alembic] can not load C3f attr {}:{}.", p.getName(), int(samp.getVals()->size())); } } } else { if (!read_done) { - log_error("[alembic] can not load attr {}..", p.getName()); + log_warn("[alembic] can not load attr {}..", p.getName()); } } } @@ -312,7 +318,7 @@ static void read_user_data(std::shared_ptr prim, ICompoundPrope } else { if (!read_done) { - log_error("[alembic] can not load user data {}..", p.getName()); + log_warn("[alembic] can not load user data {}..", p.getName()); } } } From c5446619114bbc6067fdcb6ba53e73f76b7ba472 Mon Sep 17 00:00:00 2001 From: zhouhang95 <765229842@qq.com> Date: Tue, 12 Dec 2023 13:59:15 +0800 Subject: [PATCH 2/2] fix --- projects/Alembic/ReadAlembic.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/Alembic/ReadAlembic.cpp b/projects/Alembic/ReadAlembic.cpp index 730b644eae..320c298185 100644 --- a/projects/Alembic/ReadAlembic.cpp +++ b/projects/Alembic/ReadAlembic.cpp @@ -748,6 +748,7 @@ void traverseABC( tree.prim = foundABCPoints(points_sch, frameid, read_done); tree.prim->userData().set2("_abc_name", obj.getName()); tree.prim->userData().set2("_abc_path", path); + tree.prim->userData().set2("faceset_count", 0); } else if(Alembic::AbcGeom::ICurvesSchema::matches(md)) { if (!read_done) { log_debug("[alembic] found curves [{}]", obj.getName()); @@ -757,6 +758,7 @@ void traverseABC( tree.prim = foundABCCurves(curves_sch, frameid, read_done); tree.prim->userData().set2("_abc_name", obj.getName()); tree.prim->userData().set2("_abc_path", path); + tree.prim->userData().set2("faceset_count", 0); } else if (Alembic::AbcGeom::ISubDSchema::matches(md)) { if (!read_done) { log_debug("[alembic] found SubD [{}]", obj.getName());