7#ifndef PXR_IMAGING_HD_SCENE_INDEX_PLUGIN_REGISTRY_H
8#define PXR_IMAGING_HD_SCENE_INDEX_PLUGIN_REGISTRY_H
10#include "pxr/imaging/hd/api.h"
11#include "pxr/imaging/hd/sceneIndex.h"
12#include "pxr/imaging/hd/sceneIndexObserver.h"
13#include "pxr/imaging/hf/pluginRegistry.h"
25PXR_NAMESPACE_OPEN_SCOPE
27#define HDSCENEINDEXPLUGINREGISTRY_TOKENS \
28 ((rendererDisplayName, "__rendererDisplayName")) \
29 ((allRenderers, "")) \
33 HDSCENEINDEXPLUGINREGISTRY_TOKENS);
52 template<
typename T,
typename... Bases>
62 const TfToken &sceneIndexPluginId,
63 const HdSceneIndexBaseRefPtr &inputScene,
64 const HdContainerDataSourceHandle &inputArgs,
65 const std::string &renderInstanceId=std::string());
92 const std::string &rendererDisplayName,
93 const HdSceneIndexBaseRefPtr &inputScene,
94 const std::string &renderInstanceId=std::string(),
95 const std::string &appName=std::string(),
96 const HdContainerDataSourceHandle &sceneIndexCreateArgs=
nullptr);
100 InsertionOrderAtStart,
104 using InsertionPhase = int;
152 const std::string &rendererDisplayName,
153 const TfToken &sceneIndexPluginId,
154 const HdContainerDataSourceHandle &inputArgs,
155 InsertionPhase insertionPhase,
156 InsertionOrder insertionOrder);
159 using SceneIndexAppendCallback =
161 HdSceneIndexBaseRefPtr(
162 const std::string &renderInstanceId,
163 const HdSceneIndexBaseRefPtr &inputScene,
164 const HdContainerDataSourceHandle &inputArgs)>;
194 const std::string &rendererDisplayName,
195 SceneIndexAppendCallback callback,
196 const HdContainerDataSourceHandle &inputArgs,
197 InsertionPhase insertionPhase,
198 InsertionOrder insertionOrder);
208 const std::string& rendererDisplayName,
209 const std::string& appName);
211 struct PluginInsertionMetadata
213 std::string rendererDisplayName;
215 int insertionPhase = -1;
224 const HdSceneIndexBaseRefPtr& sceneIndex,
225 PluginInsertionMetadata& metadata);
268 void _LoadPluginsForRenderer(
269 const std::string &rendererDisplayName,
270 const std::string &appName);
275 std::unique_ptr<_Impl> _impl;
278template<
typename T,
typename... Bases>
284PXR_NAMESPACE_CLOSE_SCOPE
A scene index plugin bundles one or more (typically filtering) scene indices together and enables the...
A registry for renderer- and application-specific scene indices.
static HD_API HdSceneIndexPluginRegistry & GetInstance()
Returns the singleton registry for HdSceneIndexPlugin.
bool GetPluginInsertionMetadataForSceneIndex(const HdSceneIndexBaseRefPtr &sceneIndex, PluginInsertionMetadata &metadata)
Gets metadata about the plugin that inserted the given scene index, if available.
HD_API HdSceneIndexBaseRefPtr AppendSceneIndicesForRenderer(const std::string &rendererDisplayName, const HdSceneIndexBaseRefPtr &inputScene, const std::string &renderInstanceId=std::string(), const std::string &appName=std::string(), const HdContainerDataSourceHandle &sceneIndexCreateArgs=nullptr)
Append scene indices generated by plug-ins registered (via RegisterSceneIndexForRenderer) for this re...
HD_API void RegisterSceneIndexForRenderer(const std::string &rendererDisplayName, SceneIndexAppendCallback callback, const HdContainerDataSourceHandle &inputArgs, InsertionPhase insertionPhase, InsertionOrder insertionOrder)
Register a scene index to be instantiated via a callback for a specified renderer (or all renderers i...
static void Define()
Entry point for defining an HdSceneIndexPlugin plugin.
HD_API void RegisterSceneIndexForRenderer(const std::string &rendererDisplayName, const TfToken &sceneIndexPluginId, const HdContainerDataSourceHandle &inputArgs, InsertionPhase insertionPhase, InsertionOrder insertionOrder)
Register a scene index plugin to be instantiated for a specified renderer (or all renderers if render...
PluginOrderingPolicy
Enum to specify the policy for determining the order of scene index plugins.
@ JsonMetadataOnly
The tags and ordering specified in the JSON metadata are used to drive the ordering of scene index pl...
@ CppRegistrationOnly
The order of plugins is determined solely by the insertion phase/order arguments of the C++ registrat...
@ Hybrid
A hybrid ordering scheme where we attempt to honor both the insertion phase/order specified via the C...
void _CollectAdditionalMetadata(const PlugRegistry &plugRegistry, const TfType &pluginType) override
Gives subclasses an opportunity to inspect plugInfo-based metadata at the time of discovery.
HD_API std::vector< TfToken > LoadAndGetSceneIndexPluginIds(const std::string &rendererDisplayName, const std::string &appName)
Loads plugins for rendererDisplayName and appName.
HD_API HdSceneIndexBaseRefPtr AppendSceneIndex(const TfToken &sceneIndexPluginId, const HdSceneIndexBaseRefPtr &inputScene, const HdContainerDataSourceHandle &inputArgs, const std::string &renderInstanceId=std::string())
Given a specific scene index plug-in id, give the plug-in a chance to add scene indices to the end of...
HD_API void SetPluginOrderingPolicy(PluginOrderingPolicy policy)
Sets the policy for determining the order of scene index plugins.
Base class for registering Hydra plugins using the plug mechanism.
static void Define()
Entry point for registering a types implementation.
Defines an interface for registering plugins.
Manage a single instance of an object (see.
Token for efficient comparison, assignment, and hashing of known strings.
TfType represents a dynamic runtime type.
Manage a single instance of an object.
This file defines some macros that are useful for declaring and using static TfTokens.
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
Pointer storage with deletion detection.