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

Replace boost hash usage with TfHash in pxr/usd/usdSkel #2191

Merged
merged 1 commit into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions pxr/usd/usdSkel/skeletonQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ UsdSkelSkeletonQuery::HasRestPose() const
size_t
hash_value(const UsdSkelSkeletonQuery& query)
{
size_t hash = hash_value(query._definition);
boost::hash_combine(hash, query._animQuery);
return hash;
return TfHash::Combine(query._definition,
query._animQuery);
}


Expand Down
3 changes: 3 additions & 0 deletions pxr/usd/usdSkel/testenv/testUsdSkelSkeletonQuery.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ def test_SkeletonQuery(self):
query = skelCache.GetSkelQuery(skel)
self.assertTrue(query)

self.assertEqual(hash(query), hash(query))
self.assertEqual(hash(query), hash(skelCache.GetSkelQuery(skel)))

# Validate joint rest xform computations.

xforms = query.ComputeJointLocalTransforms(0, atRest=True)
Expand Down
5 changes: 5 additions & 0 deletions pxr/usd/usdSkel/wrapSkeletonQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ _ComputeJointRestRelativeTransforms(UsdSkelSkeletonQuery& self,
return xforms;
}

static size_t __hash__(const UsdSkelSkeletonQuery &self)
{
return TfHash{}(self);
}

} // namespace

Expand All @@ -119,6 +123,7 @@ void wrapUsdSkelSkeletonQuery()
.def(self != self)

.def("__str__", &This::GetDescription)
.def("__hash__" , __hash__)

.def("GetPrim", &This::GetPrim,
return_value_policy<return_by_value>())
Expand Down