Skip to content

Commit

Permalink
Update based on code review
Browse files Browse the repository at this point in the history
  • Loading branch information
macumber authored and jmarrec committed Apr 19, 2024
1 parent e3e81e6 commit 5d3c826
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/model/ModelMerger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,25 +357,25 @@ namespace model {
}
}

// match new to cloned subsurfaces
// setAdjacentSurface resets the AdjacentSubSurface on all child subsurfaces
for (const auto& newSubSurface : newSurface.subSurfaces()) {
m_newMergedHandles.insert(newSubSurface.handle());
for (auto& cloneSubSurface : clone.subSurfaces()) {
if (circularEqual(newSubSurface.vertices(), cloneSubSurface.vertices(), 0.01)) {
m_currentToNewHandleMapping[cloneSubSurface.handle()] = newSubSurface.handle();
m_newToCurrentHandleMapping[newSubSurface.handle()] = cloneSubSurface.handle();

boost::optional<SubSurface> newAdjacentSubSurface = newSubSurface.adjacentSubSurface();
if (newAdjacentSubSurface) {
// for performance reasons, only find matching subsurfaces if there is an AdjacentSubSurface
boost::optional<SubSurface> newAdjacentSubSurface = newSubSurface.adjacentSubSurface();
if (newAdjacentSubSurface) {
for (auto& cloneSubSurface : clone.subSurfaces()) {
if (circularEqual(newSubSurface.vertices(), cloneSubSurface.vertices(), 0.01)) {
// only subsurfaces with an AdjacentSubSurface will be added to the handle mapping
m_currentToNewHandleMapping[cloneSubSurface.handle()] = newSubSurface.handle();
m_newToCurrentHandleMapping[newSubSurface.handle()] = cloneSubSurface.handle();
boost::optional<UUID> currentAdjacentSubSurfaceHandle = getCurrentModelHandle(newAdjacentSubSurface->handle());
if (currentAdjacentSubSurfaceHandle) {
boost::optional<SubSurface> currentAdjacentSubSurface = m_currentModel.getModelObject<SubSurface>(*currentAdjacentSubSurfaceHandle);
if (currentAdjacentSubSurface) {
cloneSubSurface.setAdjacentSubSurface(*currentAdjacentSubSurface);
}
}
break;
}
break;
}
}
}
Expand Down

0 comments on commit 5d3c826

Please sign in to comment.