Skip to content

Commit

Permalink
Merge pull request #1618 from zenustech/improve-abc-2
Browse files Browse the repository at this point in the history
improve abc
  • Loading branch information
teachmain authored Dec 12, 2023
2 parents 17292d8 + c544661 commit d61f748
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions projects/Alembic/ReadAlembic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,15 @@ static void read_attributes(std::shared_ptr<PrimitiveObject> prim, ICompoundProp
attr[i] = data[i];
}
}
else if (prim->loops.size() * 3 == data.size()) {
auto &attr = prim->loops.add_attr<zeno::vec3f>(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());
}
}
}
Expand Down Expand Up @@ -138,7 +144,7 @@ static void read_attributes(std::shared_ptr<PrimitiveObject> 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());
}
}
}
Expand Down Expand Up @@ -171,7 +177,7 @@ static void read_attributes(std::shared_ptr<PrimitiveObject> 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()));
}
}
}
Expand Down Expand Up @@ -204,7 +210,7 @@ static void read_attributes(std::shared_ptr<PrimitiveObject> 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()));
}
}
}
Expand Down Expand Up @@ -237,13 +243,13 @@ static void read_attributes(std::shared_ptr<PrimitiveObject> 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());
}
}
}
Expand Down Expand Up @@ -312,7 +318,7 @@ static void read_user_data(std::shared_ptr<PrimitiveObject> 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());
}
}
}
Expand Down Expand Up @@ -742,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());
Expand All @@ -751,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());
Expand Down

0 comments on commit d61f748

Please sign in to comment.