Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compare HdPrimvarDesrciptor equality by name and role #2096

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions pxr/usdImaging/usdImaging/primAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,12 +768,16 @@ UsdImagingPrimAdapter::_MergePrimvar(
bool indexed) const
{
HdPrimvarDescriptor primvar(name, interp, role, indexed);
HdPrimvarDescriptorVector::iterator it =
std::find(vec->begin(), vec->end(), primvar);
if (it == vec->end())
vec->push_back(primvar);
else
*it = primvar;

for (HdPrimvarDescriptorVector::iterator it = vec->begin();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're open to the suggestion, I think you can preserve the existing structure and the usage of the STL with std::find_if.

Either way, it's great to see this fix!

it != vec->end(); ++it) {
if (it->name == name) {
*it = primvar;
return;
}
}

vec->push_back(primvar);
}

void
Expand Down