Loading...
Searching...
No Matches
HdsiPrimManagingSceneIndexObserver Class Reference

A scene index observer that turns prims in the observed scene index into instances (of RAII subclasses) of PrimBase using the given prim factory. More...

#include <primManagingSceneIndexObserver.h>

+ Inheritance diagram for HdsiPrimManagingSceneIndexObserver:

Classes

class  PrimBase
 Base class for prims managed by the observer. More...
 
class  PrimFactoryBase
 Base class for a prim factory given to the observer. More...
 

Public Types

using PrimBaseHandle = std::shared_ptr< PrimBase >
 
using PrimFactoryBaseHandle = std::shared_ptr< PrimFactoryBase >
 
- Public Types inherited from HdSceneIndexObserver
using AddedPrimEntries = TfSmallVector< AddedPrimEntry, 16 >
 
using RemovedPrimEntries = TfSmallVector< RemovedPrimEntry, 16 >
 
using DirtiedPrimEntries = TfSmallVector< DirtiedPrimEntry, 16 >
 
using RenamedPrimEntries = TfSmallVector< RenamedPrimEntry, 16 >
 
- Public Types inherited from TfRefBase
typedef void(* UniqueChangedFuncPtr) (TfRefBase const *, bool)
 

Public Member Functions

const HdSceneIndexBaseRefPtr & GetSceneIndex () const
 Get observed scene index.
 
HDSI_API const PrimBaseHandle & GetPrim (const SdfPath &primPath) const
 Get managed prim at path.
 
template<typename PrimType >
std::shared_ptr< PrimType > GetTypedPrim (const SdfPath &primPath) const
 Get managed prim cast to a particular type.
 
virtual HD_API void PrimsAdded (const HdSceneIndexBase &sender, const AddedPrimEntries &entries)=0
 A notification indicating prims have been added to the scene.
 
virtual HD_API void PrimsRemoved (const HdSceneIndexBase &sender, const RemovedPrimEntries &entries)=0
 A notification indicating prims have been removed from the scene.
 
virtual HD_API void PrimsDirtied (const HdSceneIndexBase &sender, const DirtiedPrimEntries &entries)=0
 A notification indicating prim datasources have been invalidated.
 
virtual HD_API void PrimsRenamed (const HdSceneIndexBase &sender, const RenamedPrimEntries &entries)=0
 A notification indicating prims (and their descendants) have been renamed or reparented.
 
- Public Member Functions inherited from TfWeakBase
 TfWeakBase (const TfWeakBase &)
 
const TfWeakBase__GetTfWeakBase__ () const
 
const TfWeakBaseoperator= (const TfWeakBase &)
 
void EnableNotification2 () const
 
TF_API void const * GetUniqueIdentifier () const
 
- Public Member Functions inherited from TfRefBase
 TfRefBase (TfRefBase const &)
 
TfRefBaseoperator= (TfRefBase const &)
 
size_t GetCurrentCount () const
 Return the current reference count of this object.
 
bool IsUnique () const
 Return true if only one TfRefPtr points to this object.
 
void SetShouldInvokeUniqueChangedListener (bool shouldCall)
 

Static Public Member Functions

static HdsiPrimManagingSceneIndexObserverRefPtr New (HdSceneIndexBaseRefPtr const &sceneIndex, HdContainerDataSourceHandle const &inputArgs)
 C'tor.
 
- Static Public Member Functions inherited from HdSceneIndexObserver
static HD_API void ConvertPrimsRenamedToRemovedAndAdded (const HdSceneIndexBase &sender, const HdSceneIndexObserver::RenamedPrimEntries &renamedEntries, HdSceneIndexObserver::RemovedPrimEntries *outputRemovedEntries, HdSceneIndexObserver::AddedPrimEntries *outputAddedEntries)
 A utility for converting prims renamed messages into equivalent removed and added notices.
 
static HD_API void ConvertPrimsRenamedToRemovedAndAdded (const HdSceneIndexBase &sender, const HdSceneIndexObserver::RenamedPrimEntries &renamedEntries, HdSceneIndexObserver *observer)
 A utility for converting prims renamed messages into equivalent removed and added notices at the observer level.
 
- Static Public Member Functions inherited from TfRefBase
static TF_API void SetUniqueChangedListener (UniqueChangedListener listener)
 

Protected Member Functions

void PrimsAdded (const HdSceneIndexBase &sender, const AddedPrimEntries &entries) override
 A notification indicating prims have been added to the scene.
 
void PrimsDirtied (const HdSceneIndexBase &sender, const DirtiedPrimEntries &entries) override
 A notification indicating prim datasources have been invalidated.
 
void PrimsRemoved (const HdSceneIndexBase &sender, const RemovedPrimEntries &entries) override
 A notification indicating prims have been removed from the scene.
 
void PrimsRenamed (const HdSceneIndexBase &sender, const RenamedPrimEntries &entries) override
 A notification indicating prims (and their descendants) have been renamed or reparented.
 
- Protected Member Functions inherited from TfWeakBase
TfRefPtr< Tf_Remnant > _Register () const
 
template<class T >
TfRefPtr< Tf_Remnant > _Register (T *tempRmnt) const
 
bool _HasRemnant () const
 

Detailed Description

A scene index observer that turns prims in the observed scene index into instances (of RAII subclasses) of PrimBase using the given prim factory.

This observer is an analogue to the HdPrimTypeIndex in the old hydra API (though we do not have separate observers for b/s/r-prims and instead rely on the observed filtering scene index (e.g., the HdsiPrimTypeNoticeBatchingSceneIndex) to batch notices in a way respecting dependencies).

More precisely, a AddedPrimEntry results in a call to the prim factory (this also applies to prims that exist in the observed scene index at the time the observer was instantiated).

The observer manages a map from paths to PrimBase handles so that subsequent a DirtiedPrimEntry or RemovedPrimEntry results in a call to PrimBase::Dirty or releases the handles to the PrimBase's at paths prefixed by the RemovedPrimEntry's path.

Definition at line 65 of file primManagingSceneIndexObserver.h.

Member Typedef Documentation

◆ PrimBaseHandle

using PrimBaseHandle = std::shared_ptr<PrimBase>

Definition at line 94 of file primManagingSceneIndexObserver.h.

◆ PrimFactoryBaseHandle

using PrimFactoryBaseHandle = std::shared_ptr<PrimFactoryBase>

Definition at line 109 of file primManagingSceneIndexObserver.h.

Member Function Documentation

◆ GetPrim()

HDSI_API const PrimBaseHandle & GetPrim ( const SdfPath primPath) const

Get managed prim at path.

Clients can prolong life-time of prim by holding on to the resulting handle.

◆ GetSceneIndex()

const HdSceneIndexBaseRefPtr & GetSceneIndex ( ) const
inline

Get observed scene index.

Definition at line 128 of file primManagingSceneIndexObserver.h.

◆ GetTypedPrim()

std::shared_ptr< PrimType > GetTypedPrim ( const SdfPath primPath) const
inline

Get managed prim cast to a particular type.

Definition at line 142 of file primManagingSceneIndexObserver.h.

◆ New()

static HdsiPrimManagingSceneIndexObserverRefPtr New ( HdSceneIndexBaseRefPtr const &  sceneIndex,
HdContainerDataSourceHandle const &  inputArgs 
)
inlinestatic

C'tor.

Prim factory can be given through inputArgs as PrimFactoryBaseHandle typed data source under HdsiPrimManagingSceneIndexObserverTokens->primFactory key.

Definition at line 115 of file primManagingSceneIndexObserver.h.

◆ PrimsAdded()

void PrimsAdded ( const HdSceneIndexBase sender,
const AddedPrimEntries entries 
)
overrideprotectedvirtual

A notification indicating prims have been added to the scene.

The set of scene prims compiled from added/removed notices should match the set from a traversal based on sender.GetChildPrimNames. Each prim has a path and type. It's possible for PrimsAdded to be called for prims that already exist; in that case, observers should be sure to update the prim type, in case it changed, and resync the prim. This function is not expected to be threadsafe.

Implements HdSceneIndexObserver.

◆ PrimsDirtied()

void PrimsDirtied ( const HdSceneIndexBase sender,
const DirtiedPrimEntries entries 
)
overrideprotectedvirtual

A notification indicating prim datasources have been invalidated.

This message is not considered hierarchical on primPath; if /Path is dirtied, /Path/child is not necessarily dirtied. However datasource locators are considered hierarchical: if primvars is dirtied on a prim, primvars/color is considered dirtied as well. This function is not expected to be threadsafe.

Implements HdSceneIndexObserver.

◆ PrimsRemoved()

void PrimsRemoved ( const HdSceneIndexBase sender,
const RemovedPrimEntries entries 
)
overrideprotectedvirtual

A notification indicating prims have been removed from the scene.

Note that this message is considered hierarchical; if /Path is removed, /Path/child is considered removed as well. This function is not expected to be threadsafe.

Implements HdSceneIndexObserver.

◆ PrimsRenamed()

void PrimsRenamed ( const HdSceneIndexBase sender,
const RenamedPrimEntries entries 
)
overrideprotectedvirtual

A notification indicating prims (and their descendants) have been renamed or reparented.

This function is not expected to be threadsafe.

Implements HdSceneIndexObserver.


The documentation for this class was generated from the following file: