Skip to content

Commit

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

(Internal change: 2263940)
  • Loading branch information
pixar-oss committed Feb 28, 2023
2 parents e3ada75 + dd12b1c commit 7e6952f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 1 addition & 7 deletions pxr/usd/ar/defaultResolverContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
#include "pxr/base/tf/pathUtils.h"
#include "pxr/base/tf/stringUtils.h"

#include <boost/functional/hash.hpp>

PXR_NAMESPACE_OPEN_SCOPE

ArDefaultResolverContext::ArDefaultResolverContext(
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions pxr/usd/ar/testenv/testArDefaultResolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 7e6952f

Please sign in to comment.