Loading...
Searching...
No Matches
HdInstancerTopologySchema Class Reference

Since the instancing schema is complicated: More...

#include <instancerTopologySchema.h>

+ Inheritance diagram for HdInstancerTopologySchema:

Classes

class  Builder
 Utility class for setting sparse sets of child data source fields to be filled as arguments into BuildRetained. More...
 

Public Member Functions

HD_API VtArray< int > ComputeInstanceIndicesForProto (SdfPath const &path)
 
Member accessor
HD_API HdPathArrayDataSourceHandle GetPrototypes () const
 
HD_API HdIntArrayVectorSchema GetInstanceIndices () const
 
HD_API HdBoolArrayDataSourceHandle GetMask () const
 
HD_API HdPathArrayDataSourceHandle GetInstanceLocations () const
 
- Public Member Functions inherited from HdSchema
 HdSchema (HdContainerDataSourceHandle container)
 
HD_API HdContainerDataSourceHandle GetContainer () const
 Returns the container data source that this schema is interpreting.
 
HD_API bool IsDefined () const
 
 operator bool () const
 Returns true if this schema is applied on top of a non-null container.
 

Static Public Member Functions

Schema location
static HD_API const TfTokenGetSchemaToken ()
 Returns a token where the container representing this schema is found in a container by default.
 
static HD_API const HdDataSourceLocatorGetDefaultLocator ()
 Returns an HdDataSourceLocator (relative to the prim-level data source) where the container representing this schema is found by default.
 
Schema construction
static HD_API HdContainerDataSourceHandle BuildRetained (const HdPathArrayDataSourceHandle &prototypes, const HdVectorDataSourceHandle &instanceIndices, const HdBoolArrayDataSourceHandle &mask, const HdPathArrayDataSourceHandle &instanceLocations)
 

Schema retrieval

 HdInstancerTopologySchema (HdContainerDataSourceHandle container)
 
static HD_API HdInstancerTopologySchema GetFromParent (const HdContainerDataSourceHandle &fromParentContainer)
 Retrieves a container data source with the schema's default name token "instancerTopology" from the parent container and constructs a HdInstancerTopologySchema instance.
 

Additional Inherited Members

- Public Types inherited from HdSchema
using UnderlyingDataSource = HdContainerDataSource
 
- Protected Member Functions inherited from HdSchema
template<typename T >
T::Handle _GetTypedDataSource (TfToken name) const
 Returns a datasource of the requested type for the given name: schema implementations can use this to ask for child containers, sampled values, vectors, etc.
 
- Protected Attributes inherited from HdSchema
HdContainerDataSourceHandle _container
 

Detailed Description

Since the instancing schema is complicated:

An instancer is a prim at a certain scenegraph location that causes other prims to be duplicated. The instancer can also hold instance-varying data like constant primvars or material relationships.

The important things an instancer has is:

1.) Instancer topology, describing how exactly the prims are duplicated;

2.) Instance-rate data, meaning data that varies per instance, such as primvars or material bindings.

If an instancer causes prims "/A" and "/B" to be duplicated, we encode that by setting prototypes = ["/A", "/B"]. Note that "/A" and "/B" can be subtrees, not direct gprims. instanceIndices encodes both multiplicity and position in arrays of instance-rate data, per prototype path; if instanceIndices = { [0,2], [1] }, then we draw /A twice (with instance primvar indices 0 and 2); and /B once (with instance primvar index 1). Mask is an auxiliary parameter that can be used to deactivate certain instances; mask = [true, true, false] would disable the second copy of "/A". An empty mask array is the same as all-true.

Scenes generally specify instancing in one of two ways:

1.) Explicit instancing: prim /Instancer wants to draw its subtree at an array of locations. This is a data expansion form.

2.) Implicit instancing: prims /X and /Y are marked as being identical, and scene load replaces them with a single prim and an instancer. This is a data coalescing form.

For implicit instancing, we want to know the original paths of /X and /Y, for doing things like resolving inheritance. This is encoded in the "instanceLocations" path, while the prototype prims (e.g. /_Prototype/Cube, the deduplicated version of /X/Cube and /Y/Cube) is encoded in the "prototypes" path.

For explicit instancing, the "instanceLocations" attribute is meaningless and should be left null.

Definition at line 92 of file instancerTopologySchema.h.

Constructor & Destructor Documentation

◆ HdInstancerTopologySchema()

HdInstancerTopologySchema ( HdContainerDataSourceHandle  container)
inline

Definition at line 98 of file instancerTopologySchema.h.

Member Function Documentation

◆ BuildRetained()

static HD_API HdContainerDataSourceHandle BuildRetained ( const HdPathArrayDataSourceHandle &  prototypes,
const HdVectorDataSourceHandle &  instanceIndices,
const HdBoolArrayDataSourceHandle &  mask,
const HdPathArrayDataSourceHandle &  instanceLocations 
)
static
Deprecated:
Use Builder instead.

Builds a container data source which includes the provided child data sources. Parameters with nullptr values are excluded. This is a low-level interface. For cases in which it's desired to define the container with a sparse set of child fields, the Builder class is often more convenient and readable.

◆ GetDefaultLocator()

static HD_API const HdDataSourceLocator & GetDefaultLocator ( )
static

Returns an HdDataSourceLocator (relative to the prim-level data source) where the container representing this schema is found by default.

◆ GetFromParent()

static HD_API HdInstancerTopologySchema GetFromParent ( const HdContainerDataSourceHandle &  fromParentContainer)
static

Retrieves a container data source with the schema's default name token "instancerTopology" from the parent container and constructs a HdInstancerTopologySchema instance.

Because the requested container data source may not exist, the result should be checked with IsDefined() or a bool comparison before use.

◆ GetSchemaToken()

static HD_API const TfToken & GetSchemaToken ( )
static

Returns a token where the container representing this schema is found in a container by default.


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