7#ifndef PXR_IMAGING_HD_SCENE_INDEX_H
8#define PXR_IMAGING_HD_SCENE_INDEX_H
13#include <unordered_map>
20#include "pxr/usd/sdf/path.h"
22#include "pxr/imaging/hd/api.h"
23#include "pxr/imaging/hd/dataSource.h"
24#include "pxr/imaging/hd/dataSourceLocator.h"
25#include "pxr/imaging/hd/sceneIndexObserver.h"
27PXR_NAMESPACE_OPEN_SCOPE
37 HdContainerDataSourceHandle dataSource;
104 GetPrim(primPath).dataSource, locator);
117 const HdDataSourceBaseHandle &args);
214 const HdDataSourceBaseHandle &args);
217 void _RemoveExpiredObservers();
224 using _Observers = std::vector<HdSceneIndexObserverPtr>;
225 _Observers _observers;
231 bool _shouldRemoveExpiredObservers;
234 std::string _displayName;
269 const std::string &name, HdSceneIndexBasePtr instance);
283 using _NamedInstanceMap =
284 std::unordered_map<std::string, HdSceneIndexBasePtr>;
286 _NamedInstanceMap _namedInstances;
289PXR_NAMESPACE_CLOSE_SCOPE
virtual HdDataSourceBaseHandle Get(const TfToken &name)=0
Returns the child datasource of the given name.
Represents an object that can identify the location of a data source.
Abstract interface to scene data.
HdDataSourceBaseHandle GetDataSource(const SdfPath &primPath, const HdDataSourceLocator &locator) const
A convenience function: look up the object at primPath, and if successful return the datasource at lo...
virtual SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const =0
Returns the paths of all scene index prims located immediately below primPath.
HD_API void _SendPrimsRemoved(const HdSceneIndexObserver::RemovedPrimEntries &entries)
Notify attached observers of prims removed from the scene.
HD_API void _SendPrimsRenamed(const HdSceneIndexObserver::RenamedPrimEntries &entries)
Notify attached observers of prims (and their descendents) which have been renamed or reparented.
HD_API void RemoveObserver(const HdSceneIndexObserverPtr &observer)
Removes an observer from this scene index; the given observer will no longer be forwarded notices.
HD_API void AddObserver(const HdSceneIndexObserverPtr &observer)
Adds an observer to this scene index.
HD_API bool _IsObserved() const
Returns whether the scene index has any registered observers; this information can be used to skip wo...
HD_API void _SendPrimsAdded(const HdSceneIndexObserver::AddedPrimEntries &entries)
Notify attached observers of prims added to the scene.
HD_API std::string GetDisplayName() const
Returns a value previously set by SetDisplayName.
HD_API void AddTag(const TfToken &tag)
Adds a specified tag token to a scene index instance.
virtual HD_API void _SystemMessage(const TfToken &messageType, const HdDataSourceBaseHandle &args)
Implement in order to react directly to system messages sent from downstream.
HD_API TfTokenVector GetTags() const
Returns all tag tokens currently added to a scene index instance.
HD_API void _SendPrimsDirtied(const HdSceneIndexObserver::DirtiedPrimEntries &entries)
Notify attached observers of datasource invalidations from the scene.
virtual HdSceneIndexPrim GetPrim(const SdfPath &primPath) const =0
Returns a pair of (prim type, datasource) for the object at primPath.
HD_API void SystemMessage(const TfToken &messageType, const HdDataSourceBaseHandle &args)
Sends a message with optional arguments to this and any upstream input scene indices.
HD_API bool HasTag(const TfToken &tag) const
Returns true if a specified tag token has been added to a scene index instance.
HD_API void SetDisplayName(const std::string &n)
Allows for scene index instances to be identified in a more contextually relevant way.
HD_API void RemoveTag(const TfToken &tag)
Removes a specified tag token to a scene index instance.
A registry containing named instances of Hydra indexes.
static HD_API HdSceneIndexNameRegistry & GetInstance()
Returns the singleton-instance of this registry.
HD_API void RegisterNamedSceneIndex(const std::string &name, HdSceneIndexBasePtr instance)
Registers an instance of a scene index with a given name.
HD_API std::vector< std::string > GetRegisteredNames()
Returns the names of all registered scene indexes.
HD_API HdSceneIndexBaseRefPtr GetNamedSceneIndex(const std::string &name)
Returns the scene index that was registered with the given name.
A path value used to locate objects in layers or scenegraphs.
Enable a concrete base class for use with TfRefPtr.
Manage a single instance of an object (see.
static T & GetInstance()
Return a reference to an object of type T, creating it if necessary.
Token for efficient comparison, assignment, and hashing of known strings.
Enable a concrete base class for use with TfWeakPtr.
Standard pointer typedefs.
Manage a single instance of an object.
Small struct representing a 'prim' in the Hydra scene index.
std::vector< TfToken > TfTokenVector
Convenience types.