RtPrimSelection#
Fully qualified name: usdrt::RtPrimSelection
-
class RtPrimSelection#
The RtPrimSelection class represents a subset of a stage’s prims, and allows you to efficiently process them on CPU or GPU using the fabric::batch API.
It provides:
a batch::View from which you can construct a batch::ViewIterator to iterate over the data on CPU or GPU.
a method to convert attribute names and types to AttributeRefs, which you need to get attributes from the batch::ViewIterator.
a method to get the number of prims in the view without creating a batch::ViewIterator. When processing prims on GPU you typically use the CPU to spawn a set of GPU threads, for example one thread per prim. This method allows you to do this without the expense of creating a batch::ViewIterator on both CPU and GPU.
To create an RtPrimSelection, use UsdStage::GetDataView(), which allows you to specify which of the stage’s prims you want to include in the view.
Public Functions
- inline AttributeRef GetRef(
- SdfValueTypeName type,
- const TfToken &name,
Convert an attribute name and type to an AttributeRef, which you need to get attributes from the batch::ViewIterator.
-
inline omni::fabric::batch::View GetBatchView() const#
Get a batch::View that represents this view. From this you can construct a batch::ViewIterator to iterate over the data on CPU or GPU.
-
inline size_t GetCount() const#
Get the number of prims in the view without creating a batch::ViewIterator. When processing prims on GPU you typically use the CPU to spawn a set of GPU threads, for example one thread per prim. This method allows you to do this without the expense of creating a batch::ViewIterator on both CPU and GPU.
-
inline std::vector<usdrt::SdfPath> GetPaths() const#
Get the paths represented by the selection if wantPaths=true was set during selection creation. If wantPaths=false (the default) during selection creation, this will return an empty vector.
-
inline bool PrepareForReuse() const#
Allows a selection to be reused across frames. If Fabric topology has changed since the last call to this method this will re-generate the internally-held Batch view and return true. If Fabric topology was not changed since the last call to this method, this will just mark the selected attributes as dirty in Fabric and return false. In either case, downstream consumers of Fabric change tracking will know the writable attributes of this selection were potentially modified.