Skip to content

Commit

Permalink
Merge pull request #1997 from zenustech/abc-not-flip-lines
Browse files Browse the repository at this point in the history
abc-not-flip-lines
  • Loading branch information
iaomw authored Aug 29, 2024
2 parents 21837ba + ebf3a95 commit 7eb2383
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions projects/Alembic/GetAlembicPrim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ struct GetAlembicPrim : INode {
prim = get_alembic_prim(abctree, index);
}
if (get_input2<bool>("flipFrontBack")) {
primFlipFaces(prim.get());
primFlipFaces(prim.get(), true);
}
if (get_input2<bool>("triangulate")) {
zeno::primTriangulate(prim.get());
Expand Down Expand Up @@ -198,7 +198,7 @@ struct AllAlembicPrim : INode {
}
auto outprim = zeno::primMerge(prims->getRaw<PrimitiveObject>());
if (get_input2<bool>("flipFrontBack")) {
primFlipFaces(outprim.get());
primFlipFaces(outprim.get(), true);
}
if (get_input2<int>("triangulate") == 1) {
zeno::primTriangulate(outprim.get());
Expand Down Expand Up @@ -297,7 +297,7 @@ struct AlembicPrimList : INode {
for (auto &prim: new_prims->arr) {
auto _prim = std::dynamic_pointer_cast<PrimitiveObject>(prim);
if (get_input2<bool>("flipFrontBack")) {
primFlipFaces(_prim.get());
primFlipFaces(_prim.get(), true);
}
if (get_input2<bool>("splitByFaceset") && get_input2<bool>("killDeadVerts")) {
primKillDeadVerts(_prim.get());
Expand Down Expand Up @@ -457,7 +457,7 @@ struct ImportAlembicPrim : INode {
outprim = get_alembic_prim(abctree, index);
}
}
primFlipFaces(outprim.get());
primFlipFaces(outprim.get(), true);
if (get_input2<bool>("triangulate")) {
zeno::primTriangulate(outprim.get());
}
Expand Down
2 changes: 1 addition & 1 deletion zeno/include/zeno/funcs/PrimitiveUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ZENO_API void primPolygonate(PrimitiveObject *prim, bool with_uv = true);
ZENO_API void primSepTriangles(PrimitiveObject *prim, bool smoothNormal = true, bool keepTriFaces = true);
//ZENO_API void primSmoothNormal(PrimitiveObject *prim, bool isFlipped = false);

ZENO_API void primFlipFaces(PrimitiveObject *prim);
ZENO_API void primFlipFaces(PrimitiveObject *prim, bool only_face = false);
ZENO_API void primCalcNormal(PrimitiveObject *prim, float flip = 1.0f, std::string nrmAttr = "nrm");
//ZENO_API void primCalcInsetDir(PrimitiveObject *prim, float flip = 1.0f, std::string nrmAttr = "nrm");

Expand Down
6 changes: 3 additions & 3 deletions zeno/src/nodes/neo/PrimFlipFaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

namespace zeno {

ZENO_API void primFlipFaces(PrimitiveObject *prim) {
if (prim->lines.size())
ZENO_API void primFlipFaces(PrimitiveObject *prim, bool only_face) {
if (!only_face && prim->lines.size())
parallel_for_each(prim->lines.begin(), prim->lines.end(), [&] (auto &line) {
std::swap(line[1], line[0]);
});
Expand Down Expand Up @@ -47,7 +47,7 @@ ZENO_API void primFlipFaces(PrimitiveObject *prim) {
struct PrimFlipFaces : zeno::INode {
virtual void apply() override {
auto prim = get_input<PrimitiveObject>("prim");
primFlipFaces(prim.get());
primFlipFaces(prim.get(), false);
set_output("prim", std::move(prim));
}
};
Expand Down

0 comments on commit 7eb2383

Please sign in to comment.