From 648d80f43ce6c94e0196b063846d151fad4ab511 Mon Sep 17 00:00:00 2001 From: zhouhang95 <765229842@qq.com> Date: Fri, 6 Dec 2024 21:14:41 +0800 Subject: [PATCH] fix-abc --- projects/Alembic/ReadAlembic.cpp | 4 ++-- zeno/src/nodes/neo/PrimMerge.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/Alembic/ReadAlembic.cpp b/projects/Alembic/ReadAlembic.cpp index fa7591dd7..c82570f7e 100644 --- a/projects/Alembic/ReadAlembic.cpp +++ b/projects/Alembic/ReadAlembic.cpp @@ -1172,6 +1172,7 @@ struct ReadAlembic : INode { frameid = getGlobalState()->frameid; } auto abctree = std::make_shared(); + bool read_face_set = get_input2("read_face_set"); { auto path = get_input("path")->get(); if (usedPath != path) { @@ -1185,7 +1186,6 @@ struct ReadAlembic : INode { // fmt::print("GetArchiveStartAndEndTime: {}\n", start); // fmt::print("archive.getNumTimeSamplings: {}\n", archive.getNumTimeSamplings()); auto obj = archive.getTop(); - bool read_face_set = get_input2("read_face_set"); bool outOfRangeAsEmpty = get_input2("outOfRangeAsEmpty"); bool skipInvisibleObject = get_input2("skipInvisibleObject"); Alembic::Util::uint32_t numSamplings = archive.getNumTimeSamplings(); @@ -1215,7 +1215,7 @@ struct ReadAlembic : INode { } set_output("namelist", namelist); } - if (get_input2("CopyFacesetToMatid")) { + if (get_input2("CopyFacesetToMatid") && read_face_set) { abctree->visitPrims([](auto &prim){ prim_copy_faceset_to_matid(prim.get()); }); diff --git a/zeno/src/nodes/neo/PrimMerge.cpp b/zeno/src/nodes/neo/PrimMerge.cpp index 41d6b8707..b318f991e 100644 --- a/zeno/src/nodes/neo/PrimMerge.cpp +++ b/zeno/src/nodes/neo/PrimMerge.cpp @@ -30,7 +30,7 @@ ZENO_API void prim_set_abcpath(PrimitiveObject* prim, std::string path_name) { ZENO_API void prim_copy_faceset_to_matid(PrimitiveObject* prim) { auto &ud = prim->userData(); - auto faceset_count = ud.get2("faceset_count"); + auto faceset_count = ud.get2("faceset_count", 0); ud.set2("matNum", faceset_count); for (auto i = 0; i < faceset_count; i++) { auto value = ud.get2(format("faceset_{}", i));