![]() |
|
A scene index implementing USD native instancing. More...
Public Member Functions | |
USDIMAGING_API HdSceneIndexPrim | GetPrim (const SdfPath &primPath) const override |
Returns a pair of (prim type, datasource) for the object at primPath . More... | |
USDIMAGING_API SdfPathVector | GetChildPrimPaths (const SdfPath &primPath) const override |
Returns the paths of all scene index prims located immediately below primPath . More... | |
USDIMAGING_API std::vector< HdSceneIndexBaseRefPtr > | GetInputScenes () const override |
![]() | |
HD_API void | AddObserver (const HdSceneIndexObserverPtr &observer) |
Adds an observer to this scene index. More... | |
HD_API void | RemoveObserver (const HdSceneIndexObserverPtr &observer) |
Removes an observer from this scene index; the given observer will no longer be forwarded notices. More... | |
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 locator within that prim. More... | |
![]() | |
size_t | GetCurrentCount () const |
Return the current reference count of this object. More... | |
bool | IsUnique () const |
Return true if only one TfRefPtr points to this object. More... | |
const TfRefCount & | GetRefCount () const |
void | SetShouldInvokeUniqueChangedListener (bool shouldCall) |
![]() | |
TfWeakBase (const TfWeakBase &) | |
const TfWeakBase & | __GetTfWeakBase__ () const |
const TfWeakBase & | operator= (const TfWeakBase &) |
void | EnableNotification2 () const |
TF_API void const * | GetUniqueIdentifier () const |
Static Public Member Functions | |
static USDIMAGING_API UsdImagingNiPrototypePropagatingSceneIndexRefPtr | New (HdSceneIndexBaseRefPtr const &inputSceneIndex) |
![]() | |
static TF_API void | SetUniqueChangedListener (UniqueChangedListener listener) |
Friends | |
class | _InstanceAggregationSceneIndexObserver |
class | _MergingSceneIndexObserver |
Additional Inherited Members | |
![]() | |
typedef void(* | UniqueChangedFuncPtr) (TfRefBase const *, bool) |
![]() | |
HD_API void | _SendPrimsAdded (const HdSceneIndexObserver::AddedPrimEntries &entries) |
Notify attached observers of prims added to the scene. More... | |
HD_API void | _SendPrimsRemoved (const HdSceneIndexObserver::RemovedPrimEntries &entries) |
Notify attached observers of prims removed from the scene. More... | |
HD_API void | _SendPrimsDirtied (const HdSceneIndexObserver::DirtiedPrimEntries &entries) |
Notify attached observers of datasource invalidations from the scene. More... | |
HD_API bool | _IsObserved () const |
Returns whether the scene index has any registered observers; this information can be used to skip work preparing notices when there are no observers. More... | |
![]() | |
TfRefPtr< Tf_Remnant > | _Register () const |
template<class T > | |
TfRefPtr< Tf_Remnant > | _Register (T *tempRmnt) const |
bool | _HasRemnant () const |
A scene index implementing USD native instancing.
If combined with the UsdImagingPiPrototypePropagatingSceneIndex, the native instancing scene index has to be run after the point instancing scene index.
This scene index uses the UsdImgingNiInstanceAggregationSceneIndex to find all instances, aggregate them and insert instancers for each set of aggregated instances. This scene index then inserts copies of the corresponding USD prototype underneath each of these instancers. Each of these copies is actually a UsdImagingNiPrototypePropagatingSceneIndex itself. This way, we can handle nested native instancing. In other words, we can call the UsdImagingNiPrototypePropagatingSceneIndex for a USD prototype and it will find the instances within that prototype.
The instancing scene index uses the instancedBy:prototypeRoot of the input scene index during aggregation. Typically, the input scene index will be a UsdImagingPiPrototypePropagatingSceneIndex which populates instancedBy:prototypeRoot based on which point instancer is instancing a prim.
This scene index is implemented by a merging scene index. One input to the merging scene index is the UsdImaging_NiPrototypeSceneIndex which prepares the prototype for which this scene index was created. Another input to the merging scene index is the UsdImaging_NiInstanceAggregationSceneIndex that will insert the instancers for the instances within this prototype. The _InstanceAggregationSceneIndexObserver will observe the latter scene index to add respective UsdImagingNiPrototypePropagatingSceneIndex's under each instancer.
Example 1 (also see Example 1 in niInstanceAggregationSceneIndex.h)
USD:
def Xform "MyPrototype" { def Cube "MyCube" { } }
def "Cube_1" ( instanceable = true references = </MyPrototype> { }
Inputs of the UsdImagingNiPrototypePropagatingSceneIndex(inputSceneIndex):
* HdMergingSceneIndex * UsdImaging_NiPrototypeSceneIndex prototypeRoot = "" * HdFlatteningSceneIndex * UsdImaging_NiPrototypePruningSceneIndex prototypeRoot = "" * inputSceneIndex (typically a UsdImagingPiPrototypePropagatingSceneIndex) * UsdImaging_NiInstanceAggregationSceneIndex * HdFlatteningSceneIndex [... as above] * UsdImagingRerootingSceneIndex (inserted by _InstanceAggregationSceneIndexObserver::PrimsAdded through _MergingSceneIndexEntry) srcPrefix = / dstPrefix = /__Usd_Prototypes/NoBindings/__Prototype_1 * UsdImagingNiPrototypePropagatingSceneIndex prototypeName = __Prototype_1 * HdMergingSceneIndex * UsdImaging_NiPrototypeSceneIndex prototypeRoot = /__PrototypeRoot1 * HdFlatteningSceneIndex * UsdImagingRerootingSceneIndex srcPrefix = /__PrototypeRoot1 dstPrefix = /__PrototypeRoot1 * inputSceneIndex * UsdImaging_NiInstanceAggregationSceneIndex * HdFlatteningSceneIndex [... as just above]
UsdImagingNiPrototypePropagatingSceneIndex
/Cube_1 primType: "" dataSource: instance: # Useful for translating Usd proxy paths for selection.
instancer: /__Usd_Prototypes/NoBindings/__Prototype_1 prototypeId: 0 instanceId: 0 /MyPrototype # Not referenced from a different file, so appears here
primType: "" /MyPrototype/MyCube primType: cube /__Usd_Prototypes primType: "" /__Usd_Prototypes/NoBindings primType: "" /__Usd_Prototypes/NoBindings/__Prototype_1 primType: instancer dataSource: instancerTopology: instanceIndices: i0: [ 0 ] prototypes: [ /__Usd_Prototypes/NoBindings/__Prototype_1/__Protoype_1 ] instanceLocations: [ /Cube_1 ] # for picking primvars: instanceTransform: primvarValue: [ identity matrix ] interpolation: instance /__Usd_Prototypes/NoBindings/__Prototype_1/__Prototype_1 primType: "" instancedBy: paths: [ /__Usd_Prototypes/NoBindings/__Prototype_1 ] prototypeRoot: /__Usd_Prototypes/NoBindings/__Prototype_1 /__Prototype_1 /__Usd_Prototypes/NoBindings/__Prototype_1/__Prototype_1/MyCube primType: cube instancedBy: paths: [ /__Usd_Prototypes/NoBindings/__Prototype_1 ] prototypeRoot: /__Usd_Prototypes/NoBindings/__Prototype_1 /__Prototype_1
Example 2:
def Xform "MyNestedPrototype" # Will become USD prototype /__Prototype_1 { def Cube "MyCube" { } }
def Xform "MyPrototype" # Will become USD prototype /__Prototype_2 { def "MyNestedInstance" ( instanceable = true references = </MyNestedPrototype> ) { } }
def Xform "MyInstance" ( instanceable = true references = </MyPrototype>) {
}
UsdImagingNiPrototypePropagatingSceneIndex
... /MyInstance primType: "" dataSource: instance: instancer: /__Usd_Prototypes/NoBindings/__Prototype_2 prototypeId: 0 instanceId: 0 /__UsdPrototypes /__UsdPrototypes/NoBindings primType: "" /__UsdPrototypes/NoBindings/__Prototype_2 primType: instancer dataSource: instanerTopology: prototypes: [ /__UsdPrototypes/NoBindings/__Prototype_2 ] ... /__UsdPrototypes/NoBindings/__Prototype_2/_Prototype_2 primType: "" /__UsdPrototypes/NoBindings/__Prototype_2/_Prototype_2/MyNestedInstance primType: "" dataSource: instancer: /__UsdPrototypes/NoBindings/__Prototype_2/_Prototype_2/__UsdPrototypes/NoBindings/__Prototype_1 prototypeId: 0 instanceId: 0 /__UsdPrototypes/NoBindings/__Prototype_2/_Prototype_2/__UsdPrototypes /__UsdPrototypes/NoBindings/__Prototype_2/_Prototype_2/__UsdPrototypes/NoBindings primType: "" /__UsdPrototypes/NoBindings/__Prototype_2/_Prototype_2/__UsdPrototypes/NoBindings/__Prototype_1 primType: instancer dataSource: instanerTopology: prototypes: [ /__UsdPrototypes/NoBindings/__Prototype_2/_Prototype_2/__UsdPrototypes/NoBindings/__Prototype_1/__Prototype_1 ] ... instancedBy: paths: [ /__UsdPrototypes/NoBindings/__Prototype_2 ] prototypeRoot: /__UsdPrototypes/NoBindings/__Prototype_2/__Prototype_2 /__UsdPrototypes/NoBindings/__Prototype_2/_Prototype_2/__UsdPrototypes/NoBindings/__Prototype_1/__Prototype_1 primType: "" dataSource: instancedBy: paths: [ /__UsdPrototypes/NoBindings/__Prototype_2/_Prototype_2/__UsdPrototypes/NoBindings/__Prototype_1 ] prototypeRoot: /__UsdPrototypes/NoBindings/__Prototype_2/_Prototype_2/__UsdPrototypes/NoBindings/__Prototype_1/__Prototype_1 /__UsdPrototypes/NoBindings/__Prototype_2/_Prototype_2/__UsdPrototypes/NoBindings/__Prototype_1/__Prototype_1/MyCube primType: "cube" dataSource: instancedBy: paths: [ /__UsdPrototypes/NoBindings/__Prototype_2/_Prototype_2/__UsdPrototypes/NoBindings/__Prototype_1 ] prototypeRoot: /__UsdPrototypes/NoBindings/__Prototype_2/_Prototype_2/__UsdPrototypes/NoBindings/__Prototype_1/__Prototype_1 ...
Definition at line 243 of file niPrototypePropagatingSceneIndex.h.
|
overridevirtual |
Returns the paths of all scene index prims located immediately below primPath
.
This function can be used to traverse the scene by recursing from SdfPath::AbsoluteRootPath()
; such a traversal is expected to give the same set of prims as the flattening of the scene index's PrimsAdded
and PrimsRemoved
messages. This function is expected to be threadsafe.
Implements HdSceneIndexBase.
|
overridevirtual |
Returns a pair of (prim type, datasource) for the object at primPath
.
If no such object exists, the type will be the empty token and the datasource will be null. This function is expected to be threadsafe.
Implements HdSceneIndexBase.