Skip to content

Commit

Permalink
Merge branch 'review-lchai-aurora-dev' into 'dev'
Browse files Browse the repository at this point in the history
jira: FXSOFT-1800 [partio] indexed strings not copied during clone

See merge request effects/partio!35
  • Loading branch information
Lawrence Chai committed Jan 30, 2024
2 parents 321ae0e + 4a5832f commit 0764994
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/lib/core/Particle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ clone(const ParticlesData& other, bool particles, const std::map<std::string, st
Partio::ParticleAttribute srcAttr, dstAttr;
const int numAttributes = other.numAttributes();
const size_t numParticles = other.numParticles();
std::vector<Partio::ParticleAttribute> dstAttrs;

p->addParticles(numParticles);

// We can't assume that the particle backend stores data contiguously, so
// we copy one particle at a time. A bulk memcpy would be faster.
for (int i = 0; i < numAttributes; ++i) {
other.attributeInfo(i, srcAttr);
dstAttr = p->addAttribute(getMappedName(srcAttr.name, attrNameMap).c_str(), srcAttr.type, srcAttr.count);
// Register indexed strings
if (srcAttr.type == Partio::INDEXEDSTR) {
const std::vector<std::string>& values = other.indexedStrs(srcAttr);
Expand All @@ -153,7 +153,6 @@ clone(const ParticlesData& other, bool particles, const std::map<std::string, st
}
}
size_t size = Partio::TypeSize(srcAttr.type) * srcAttr.count;
dstAttr = p->addAttribute(getMappedName(srcAttr.name, attrNameMap).c_str(), srcAttr.type, srcAttr.count);

for (Partio::ParticleIndex j = 0; j < numParticles; ++j) {
const void *src = other.data<void>(srcAttr, j);
Expand Down

0 comments on commit 0764994

Please sign in to comment.