HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HdInstancerTopologySchema Class Reference

#include <instancerTopologySchema.h>

+ Inheritance diagram for HdInstancerTopologySchema:

Classes

class  Builder
 

Public Member Functions

HD_API VtArray< intComputeInstanceIndicesForProto (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. More...
 
HD_API bool IsDefined () const
 
 operator bool () const
 

Static Public Member Functions

Schema location
static HD_API const TfTokenGetSchemaToken ()
 
static HD_API const
HdDataSourceLocator
GetDefaultLocator ()
 
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)
 

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
 
- 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

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.

Definition at line 98 of file instancerTopologySchema.h.

Member Function Documentation

static HD_API HdContainerDataSourceHandle HdInstancerTopologySchema::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.

HD_API VtArray<int> HdInstancerTopologySchema::ComputeInstanceIndicesForProto ( SdfPath const &  path)
static HD_API const HdDataSourceLocator& HdInstancerTopologySchema::GetDefaultLocator ( )
static

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

static HD_API HdInstancerTopologySchema 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.

HD_API HdIntArrayVectorSchema HdInstancerTopologySchema::GetInstanceIndices ( ) const
HD_API HdPathArrayDataSourceHandle HdInstancerTopologySchema::GetInstanceLocations ( ) const
HD_API HdBoolArrayDataSourceHandle HdInstancerTopologySchema::GetMask ( ) const
HD_API HdPathArrayDataSourceHandle HdInstancerTopologySchema::GetPrototypes ( ) const
static HD_API const TfToken& HdInstancerTopologySchema::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: