Skip to content

Commit

Permalink
Merge pull request #1810 from DuncanHopkinsFoundry/MR/NDRAccessor
Browse files Browse the repository at this point in the history
Add the AppendDiscoveryResult to NdrRegistry

(Internal change: 2238369)
  • Loading branch information
pixar-oss committed Jun 25, 2022
2 parents d637490 + aca3e7c commit 0fc5bb3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pxr/usd/ndr/registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,20 @@ NdrRegistry::SetExtraDiscoveryPlugins(const std::vector<TfType>& pluginTypes)
SetExtraDiscoveryPlugins(std::move(discoveryPlugins));
}

void NdrRegistry::AddDiscoveryResult(NdrNodeDiscoveryResult&& discoveryResult)
{
std::lock_guard<std::mutex> drLock(_discoveryResultMutex);
_AddDiscoveryResultNoLock(std::move(discoveryResult));
}

void NdrRegistry::AddDiscoveryResult(const NdrNodeDiscoveryResult& discoveryResult)
{
// Explicitly create a copy, otherwise this method will recurse
// into itself.
NdrNodeDiscoveryResult result = discoveryResult;
AddDiscoveryResult(std::move(result));
}

void
NdrRegistry::SetExtraParserPlugins(const std::vector<TfType>& pluginTypes)
{
Expand Down
17 changes: 17 additions & 0 deletions pxr/usd/ndr/registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,23 @@ class NdrRegistry : public TfWeakBase
NDR_API
void SetExtraDiscoveryPlugins(const std::vector<TfType>& pluginTypes);

/// Allows the client to explicitly set additional discovery results that
/// would otherwise NOT be found through the plugin system. For example
/// to support lazily-loaded plugins which cannot be easily discovered
/// in advance.
///
/// This method will not immediately spawn a parse call which will be
/// deferred until a GetNode*() method is called.
NDR_API
void AddDiscoveryResult(NdrNodeDiscoveryResult&& discoveryResult);

/// Copy version of the method above.
/// For performance reasons, one should prefer to use the rvalue reference
/// form.
/// \overload
NDR_API
void AddDiscoveryResult(const NdrNodeDiscoveryResult& discoveryResult);

/// Allows the client to set any additional parser plugins that would
/// otherwise NOT be found through the plugin system.
///
Expand Down

0 comments on commit 0fc5bb3

Please sign in to comment.