From ea5f00d0ce18c5ad5737c23487ad2bf1ba6dc897 Mon Sep 17 00:00:00 2001 From: Matt Kuruc Date: Mon, 23 Jan 2023 09:44:25 -0800 Subject: [PATCH] Replace boost hash usage with TfHash in pxr/usd/usdSkel --- pxr/usd/usdSkel/skeletonQuery.cpp | 5 ++--- pxr/usd/usdSkel/testenv/testUsdSkelSkeletonQuery.py | 3 +++ pxr/usd/usdSkel/wrapSkeletonQuery.cpp | 5 +++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pxr/usd/usdSkel/skeletonQuery.cpp b/pxr/usd/usdSkel/skeletonQuery.cpp index fb3c264a77..0aa768220e 100644 --- a/pxr/usd/usdSkel/skeletonQuery.cpp +++ b/pxr/usd/usdSkel/skeletonQuery.cpp @@ -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); } diff --git a/pxr/usd/usdSkel/testenv/testUsdSkelSkeletonQuery.py b/pxr/usd/usdSkel/testenv/testUsdSkelSkeletonQuery.py index de7f02f90f..6f74173d3f 100644 --- a/pxr/usd/usdSkel/testenv/testUsdSkelSkeletonQuery.py +++ b/pxr/usd/usdSkel/testenv/testUsdSkelSkeletonQuery.py @@ -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) diff --git a/pxr/usd/usdSkel/wrapSkeletonQuery.cpp b/pxr/usd/usdSkel/wrapSkeletonQuery.cpp index 3a6836dcfe..bd0f978cdf 100644 --- a/pxr/usd/usdSkel/wrapSkeletonQuery.cpp +++ b/pxr/usd/usdSkel/wrapSkeletonQuery.cpp @@ -104,6 +104,10 @@ _ComputeJointRestRelativeTransforms(UsdSkelSkeletonQuery& self, return xforms; } +static size_t __hash__(const UsdSkelSkeletonQuery &self) +{ + return TfHash{}(self); +} } // namespace @@ -119,6 +123,7 @@ void wrapUsdSkelSkeletonQuery() .def(self != self) .def("__str__", &This::GetDescription) + .def("__hash__" , __hash__) .def("GetPrim", &This::GetPrim, return_value_policy())