Skip to content

Commit

Permalink
Merge pull request #1336 from zenustech/abc-i32-attr
Browse files Browse the repository at this point in the history
abc-i32-attr
  • Loading branch information
kaiyang-1 authored Aug 1, 2023
2 parents a9a4bf6 + f679dfe commit 9bde0bf
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions projects/Alembic/ReadAlembic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,31 @@ static void read_attributes(std::shared_ptr<PrimitiveObject> prim, ICompoundProp
}
}
}
else if (IInt32GeomParam::matches(p)) {
IInt32GeomParam param(arbattrs, p.getName());

IInt32GeomParam::Sample samp = param.getIndexedValue(iSS);
std::vector<int> data;
data.resize(samp.getVals()->size());
for (auto i = 0; i < samp.getVals()->size(); i++) {
data[i] = samp.getVals()->get()[i];
}
if (!read_done) {
log_info("[alembic] i32 attr {}, len {}.", p.getName(), data.size());
}

if (prim->verts.size() == data.size()) {
auto &attr = prim->add_attr<int>(p.getName());
for (auto i = 0; i < prim->verts.size(); i++) {
attr[i] = data[i];
}
}
else {
if (!read_done) {
log_error("[alembic] can not load attr {}. Check if link to Points channel when exported from Houdini.", p.getName());
}
}
}
else if (IV3fGeomParam::matches(p)) {
IV3fGeomParam param(arbattrs, p.getName());
if (!read_done) {
Expand Down

0 comments on commit 9bde0bf

Please sign in to comment.