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")) \
32 HDSCENEINDEXPLUGINREGISTRY_TOKENS);
34class HdSceneIndexPlugin;
51 template<
typename T,
typename... Bases>
61 const TfToken &sceneIndexPluginId,
62 const HdSceneIndexBaseRefPtr &inputScene,
63 const HdContainerDataSourceHandle &inputArgs,
64 const std::string &renderInstanceId=std::string());
83 const std::string &rendererDisplayName,
84 const HdSceneIndexBaseRefPtr &inputScene,
85 const std::string &renderInstanceId=std::string(),
86 const std::string &appName=std::string());
90 InsertionOrderAtStart,
94 using InsertionPhase = int;
142 const std::string &rendererDisplayName,
143 const TfToken &sceneIndexPluginId,
144 const HdContainerDataSourceHandle &inputArgs,
145 InsertionPhase insertionPhase,
146 InsertionOrder insertionOrder);
149 using SceneIndexAppendCallback =
151 HdSceneIndexBaseRefPtr(
152 const std::string &renderInstanceId,
153 const HdSceneIndexBaseRefPtr &inputScene,
154 const HdContainerDataSourceHandle &inputArgs)>;
184 const std::string &rendererDisplayName,
185 SceneIndexAppendCallback callback,
186 const HdContainerDataSourceHandle &inputArgs,
187 InsertionPhase insertionPhase,
188 InsertionOrder insertionOrder);
198 const std::string& rendererDisplayName,
199 const std::string& appName);
201 struct PluginInsertionMetadata
203 std::string rendererDisplayName;
205 int insertionPhase = -1;
214 const HdSceneIndexBaseRefPtr& sceneIndex,
215 PluginInsertionMetadata& metadata);
258 void _LoadPluginsForRenderer(
259 const std::string &rendererDisplayName,
260 const std::string &appName);
262 HdSceneIndexPlugin *_GetSceneIndexPlugin(
const TfToken &pluginId);
265 std::unique_ptr<_Impl> _impl;
268template<
typename T,
typename... Bases>
274PXR_NAMESPACE_CLOSE_SCOPE
A registry for renderer- and application-specific scene indices.
static HD_API HdSceneIndexPluginRegistry & GetInstance()
Returns the singleton registry for HdSceneIndexPlugin.
HD_API HdSceneIndexBaseRefPtr AppendSceneIndicesForRenderer(const std::string &rendererDisplayName, const HdSceneIndexBaseRefPtr &inputScene, const std::string &renderInstanceId=std::string(), const std::string &appName=std::string())
Append scene indices generated by plug-ins registered (via RegisterSceneIndexForRenderer) for this re...
bool GetPluginInsertionMetadataForSceneIndex(const HdSceneIndexBaseRefPtr &sceneIndex, PluginInsertionMetadata &metadata)
Gets metadata about the plugin that inserted the given scene index, if available.
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.