From dd12b1c01a6cb032b77bcaecb5d499370aa4972d Mon Sep 17 00:00:00 2001 From: Matt Kuruc Date: Fri, 20 Jan 2023 13:56:17 -0800 Subject: [PATCH] Replace boost hash usage with TfHash in pxr/usd/ar --- pxr/usd/ar/defaultResolverContext.cpp | 8 +------- pxr/usd/ar/testenv/testArDefaultResolver.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pxr/usd/ar/defaultResolverContext.cpp b/pxr/usd/ar/defaultResolverContext.cpp index 12872c43e4..cfdd15e5c4 100644 --- a/pxr/usd/ar/defaultResolverContext.cpp +++ b/pxr/usd/ar/defaultResolverContext.cpp @@ -30,8 +30,6 @@ #include "pxr/base/tf/pathUtils.h" #include "pxr/base/tf/stringUtils.h" -#include - PXR_NAMESPACE_OPEN_SCOPE ArDefaultResolverContext::ArDefaultResolverContext( @@ -91,11 +89,7 @@ ArDefaultResolverContext::GetAsString() const size_t hash_value(const ArDefaultResolverContext& context) { - size_t hash = 0; - for (const std::string& p : context.GetSearchPath()) { - boost::hash_combine(hash, TfHash()(p)); - } - return hash; + return TfHash()(context.GetSearchPath()); } PXR_NAMESPACE_CLOSE_SCOPE diff --git a/pxr/usd/ar/testenv/testArDefaultResolver.py b/pxr/usd/ar/testenv/testArDefaultResolver.py index 46bfd472bd..1bc316f906 100644 --- a/pxr/usd/ar/testenv/testArDefaultResolver.py +++ b/pxr/usd/ar/testenv/testArDefaultResolver.py @@ -320,6 +320,18 @@ def test_ResolverContext(self): self.assertNotEqual(emptyContext, context) + def test_ResolverContextHash(self): + self.assertEqual( + hash(Ar.DefaultResolverContext()), + hash(Ar.DefaultResolverContext()) + ) + + paths = ["/path1", "/path2", "/path3", "/path4"] + self.assertEqual( + hash(Ar.DefaultResolverContext(paths)), + hash(Ar.DefaultResolverContext(paths)) + ) + def test_ResolveForNewAsset(self): resolver = Ar.GetResolver()