Skip to content

Commit

Permalink
Merge pull request #2191 from nvmkuruc/usdskelhash
Browse files Browse the repository at this point in the history
Replace boost hash usage with TfHash in pxr/usd/usdSkel

(Internal change: 2269111)
  • Loading branch information
pixar-oss committed Mar 31, 2023
2 parents f94b6b1 + ea5f00d commit 5afdcec
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
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

0 comments on commit 5afdcec

Please sign in to comment.