diff --git a/projects/Alembic/ReadAlembic.cpp b/projects/Alembic/ReadAlembic.cpp index d6af7d05ce..9bc1cd6cd7 100644 --- a/projects/Alembic/ReadAlembic.cpp +++ b/projects/Alembic/ReadAlembic.cpp @@ -840,7 +840,7 @@ static std::shared_ptr foundABCSubd(Alembic::AbcGeom::ISubDSche } if (!prim->loops.has_attr("uvs")) { if (!read_done) { - log_warn("[alembic] Not found uv, auto fill zero."); + // log_warn("[alembic] Not found uv, auto fill zero."); } prim->uvs.resize(1); prim->uvs[0] = zeno::vec2f(0, 0); diff --git a/zeno/include/zeno/funcs/PrimitiveUtils.h b/zeno/include/zeno/funcs/PrimitiveUtils.h index 2fca7e1614..663a99a15b 100644 --- a/zeno/include/zeno/funcs/PrimitiveUtils.h +++ b/zeno/include/zeno/funcs/PrimitiveUtils.h @@ -36,7 +36,7 @@ ZENO_API void primLineDistance(PrimitiveObject *prim, std::string resAttr, int s ZENO_API void prim_set_abcpath(PrimitiveObject* prim, std::string path_name); ZENO_API void prim_set_faceset(PrimitiveObject* prim, std::string faceset_name); -ZENO_API void primFilterVerts(PrimitiveObject *prim, std::string tagAttr, int tagValue, bool isInversed = false, std::string revampAttrO = {}, std::string method = "verts"); +ZENO_API void primFilterVerts(PrimitiveObject *prim, std::string tagAttr, int tagValue, bool isInversed = false, std::string revampAttrO = {}, std::string method = "verts", int* aux = nullptr, int aux_size = 0, bool use_aux = false); ZENO_API void primMarkIsland(PrimitiveObject *prim, std::string tagAttr); ZENO_API std::vector> primUnmergeVerts(PrimitiveObject *prim, std::string tagAttr); diff --git a/zeno/include/zeno/types/AttrVector.h b/zeno/include/zeno/types/AttrVector.h index bf20d7c6ec..da19df7355 100644 --- a/zeno/include/zeno/types/AttrVector.h +++ b/zeno/include/zeno/types/AttrVector.h @@ -498,6 +498,7 @@ struct AttrVector { for (auto &[key, val] : attrs) { std::visit([&](auto &val) { val.resize(size); }, val); } + shrink_to_fit(); } void clear() { diff --git a/zeno/src/nodes/neo/PrimFilter.cpp b/zeno/src/nodes/neo/PrimFilter.cpp index 67e87e0cca..3be252934b 100644 --- a/zeno/src/nodes/neo/PrimFilter.cpp +++ b/zeno/src/nodes/neo/PrimFilter.cpp @@ -13,7 +13,14 @@ namespace zeno { static void primRevampVerts(PrimitiveObject *prim, std::vector const &revamp); static void primRevampFaces(PrimitiveObject *prim, std::vector const &unrevamp); -ZENO_API void primFilterVerts(PrimitiveObject *prim, std::string tagAttr, int tagValue, bool isInversed, std::string revampAttrO, std::string method) { +ZENO_API void primFilterVerts(PrimitiveObject *prim, + std::string tagAttr, + int tagValue, + bool isInversed, + std::string revampAttrO, + std::string method, + int* aux, int aux_size, + bool use_aux) { if (method == "faces") { std::vector unrevamp(prim->size()); auto const &tagArr = prim->verts.attr(tagAttr); @@ -41,18 +48,27 @@ ZENO_API void primFilterVerts(PrimitiveObject *prim, std::string tagAttr, int ta } } else { std::vector revamp; - revamp.reserve(prim->size()); - auto const &tagArr = prim->verts.attr(tagAttr); - if (!isInversed) { + if(aux_size==0 && use_aux == false) { + revamp.reserve(prim->size()); + auto const &tagArr = prim->verts.attr(tagAttr); + if (!isInversed) { for (int i = 0; i < prim->size(); i++) { - if (tagArr[i] == tagValue) - revamp.emplace_back(i); + if (tagArr[i] == tagValue) + revamp.emplace_back(i); } - } else { + } else { for (int i = 0; i < prim->size(); i++) { - if (tagArr[i] != tagValue) - revamp.emplace_back(i); + if (tagArr[i] != tagValue) + revamp.emplace_back(i); } + } + } else + { + revamp.resize(aux_size); + for(int i=0;i static void revamp_vector(std::vector &arr, std::vector const &revamp) { - std::vector newarr(arr.size()); + std::vector newarr(revamp.size()); +#pragma omp parallel for for (int i = 0; i < revamp.size(); i++) { newarr[i] = arr[revamp[i]]; } @@ -337,7 +354,6 @@ static void primRevampVerts(PrimitiveObject *prim, std::vector const &revam } } - static void primRevampFaces(PrimitiveObject *prim, std::vector const &unrevamp) { if ((0 || prim->tris.size() diff --git a/zeno/src/nodes/neo/PrimUnmerge.cpp b/zeno/src/nodes/neo/PrimUnmerge.cpp index cb29e9433f..1f547ef195 100644 --- a/zeno/src/nodes/neo/PrimUnmerge.cpp +++ b/zeno/src/nodes/neo/PrimUnmerge.cpp @@ -22,9 +22,18 @@ ZENO_API std::vector> primUnmergeVerts(Primitiv } #if 1 + std::vector> aux_arrays; + aux_arrays.resize(tagMax); + for (int tag = 0; tag < tagMax; tag++) { + aux_arrays[tag].resize(0); + } + //auto const &tagArr = prim->verts.attr(tagAttr); + for (int i = 0; i < prim->size(); i++) { + aux_arrays[tagArr[i]].emplace_back(i); + } for (int tag = 0; tag < tagMax; tag++) { primList[tag]->assign(prim); - primFilterVerts(primList[tag].get(), tagAttr, tag); + primFilterVerts(primList[tag].get(), tagAttr, tag, false, {}, "verts", aux_arrays[tag].data(), aux_arrays[tag].size(),true); } #else