HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Value Specifiers
+ Collaboration diagram for Value Specifiers:

Functions

template<typename ResultType >
ValueSpecifier Exec_ComputationBuilderAccessor< allowed >::Computation (const TfToken &computationName)
 See Computation() More...
 
template<typename ResultType >
ValueSpecifier Exec_ComputationBuilderAccessor< allowed >::IncomingConnections (const TfToken &computationName)
 See IncomingConnections() More...
 
template<typename ResultType >
ValueSpecifier Exec_ComputationBuilderAccessor< allowed >::Metadata (const TfToken &metadataKey)
 See Metadata() More...
 
template<typename ResultType >
ValueSpecifier Exec_ComputationBuilderAttributeAccessor< allowed >::Connections (const TfToken &computationName)
 See Connections() More...
 
template<typename ResultType >
ValueSpecifier Exec_ComputationBuilderRelationshipAccessor< allowed >::TargetedObjects (const TfToken &computationName)
 
 exec_registration::Computation< ResultType >::Computation (const TfToken &computationName)
 
 exec_registration::Metadata< ValueType >::Metadata (const TfToken &metadataKey)
 
 exec_registration::Constant< ValueType >::Constant (ValueType &&constantValue)
 
 exec_registration::Constant< ValueType >::Constant (const ValueType &constantValue)
 
 exec_registration::NamespaceAncestor< ResultType >::NamespaceAncestor (const TfToken &computationName)
 
template<typename ResultType >
auto exec_registration::Connections (const TfToken &computationName)
 
template<typename ResultType >
auto exec_registration::IncomingConnections (const TfToken &computationName)
 

Detailed Description

A value specifier is an element of an input registration that identifies the value that is requested from a given computation provider.

Each computation input registration must contain exactly one value specifier. A value specifier comes after a sequence of zero or more object accessors, which determine the provider. A value specifier may be followed by one or more input options.

Function Documentation

template<Exec_ComputationBuilderProviderTypes allowed>
template<typename ResultType >
ValueSpecifier Exec_ComputationBuilderAccessor< allowed >::Computation ( const TfToken computationName)
inline

See Computation()

Definition at line 499 of file computationBuilders.h.

template<typename ResultType >
exec_registration::Computation< ResultType >::Computation ( const TfToken computationName)
inline

Requests an input value from the computation computationName of type ResultType.

The default input name is computationName; use InputName to specify a different input name.

Example

```{.cpp} EXEC_REGISTER_COMPUTATIONS_FOR_SCHEMA(MySchemaType) { // Register a prim computation that returns the value of another // prim computation. self.PrimComputation(_tokens->myComputation) .Callback<double>(+[](const VdfContext &ctx) { const double *const valuePtr = ctx.GetInputValuePtr<double>(_tokens->sourceComputation); return valuePtr ? *valuePtr : 0.0; }) .Inputs( Computation<double>(_tokens->sourceComputation) } ```

Definition at line 876 of file computationBuilders.h.

template<Exec_ComputationBuilderProviderTypes allowed>
template<typename ResultType >
ValueSpecifier Exec_ComputationBuilderAttributeAccessor< allowed >::Connections ( const TfToken computationName)
inline

See Connections()

Definition at line 571 of file computationBuilders.h.

template<typename ResultType >
auto exec_registration::Connections ( const TfToken computationName)

As a direct input to an attribute computation or after an Attribute() accessor, requests input values from the computation computationName of type ResultType on the objects targeted by the attribute's connections.

Note
Conceptually, this input registration provides access to the owning attribute's connections, but as outlined in the paragraph above, in practice it requests the named computation from the objects that are targeted by those connections. The reason we choose "Connections" as the name, rather than "ConnectionTargetedObjects," is to allow for future expansion of USD to allow for value-transforming behaviors on attribute connections themselves.

The default input name is computationName; use InputName to specify a different input name.

Example

```{.cpp} EXEC_REGISTER_COMPUTATIONS_FOR_SCHEMA(MySchemaType) { // Register an attribute computation on the attribute 'myAttr' that // sums the results of the integer values flowing over myAttr's // connections from the objects targeted by those connections. self.AttributeComputation(_tokens->myAttr, _tokens->computeSum) .Callback<int>(+[](const VdfContext &ctx) { int sum = 0; for (VdfReadIterator<int> it( ExecBuiltinComputations->computeValue); !it.IsAtEnd(); ++it) { sum += *it; } return sum; }) .Inputs( Connections<int>(ExecBuiltinComputations->computeValue)); } ```

Definition at line 1237 of file computationBuilders.h.

template<typename ValueType >
exec_registration::Constant< ValueType >::Constant ( ValueType &&  constantValue)
inline

Requests a constant input value of type ValueType.

Note
No default input name is assigned. Constant(value) must be followed by .InputName(name).

This kind of input isn't necessarily useful when used with a self-contained computation definition. But it becomes useful for more complicated registrations, where one piece of code registers a callback that configures its evaluation-time behavior based on an input value and a separate piece of code registers a constant input that selects the desired behavior.

This can happen:

  • When computation definitions are assembled programatically by parameterized registration code that is called to register various versions of a computation, possibly for multiple schemas
  • When computation definitions are composed from registrations made for different schemas on the same prim (support for composed computation definitions is still TBD in OpenExec)
  • When computation registration is configured (also TBD), allowing registrations for a single schema to be dynamic, depending on metadata values that drive the configuration process

Value Types

All computation input value types, including value types used to provide constant inputs, must be known to the execution system. All types that can be used to author attribute and metadata values in USD are known to exec by default. User-defined types must be registered by calling ExecTypeRegistry::RegisterType.

Note
Types that are used for constant inputs must be hashable (see VtIsHashable()).

Simple Example

This simple example shows the mechanics of using a constant input, without being suggestive of how it might be useful.

```{.cpp} EXEC_REGISTER_COMPUTATIONS_FOR_SCHEMA(MySchemaType) { // Register a prim computation that returns the value of its // constant input. self.PrimComputation(_tokens->myComputation) .Callback<double>(+[](const VdfContext &ctx) { return ctx.GetInputValue<double>(_tokens->myConstant); }) .Inputs( Constant(42.0).InputName(_tokens->myConstant)); } ```

Complex Example

This example demonstrate how more complicated registration code might make use of constant inputs to configure the behavior of a callback at evaluation time.

```{.cpp} template <typename registrationtype>=""> void RegisterCallback(RegistrationType &reg) { reg.Callback<std::string>(+[](const VdfContext &ctx) { const TfToken &mode = ctx.GetInputValue<TfToken>(_tokens->mode); if (mode == _tokens->mode1) { return "Mode 1 selected"; else if (mode == _tokens->mode2) { return "Mode 2 selected"; } }

template <typename registrationtype>=""> void RegisterInput(RegistrationType &reg, const int mode) { if (mode == 1) { reg.Inputs(Constant(_tokens->mode1).InputName(_tokens->mode)); } else if (mode == 2) { reg.Inputs(Constant(_tokens->mode2).InputName(_tokens->mode)); } }

EXEC_REGISTER_COMPUTATIONS_FOR_SCHEMA(MySchemaType) { auto reg = self.PrimComputation(_tokens->myComputation);

// ...

RegisterCallback(reg);

// ...

RegisterInput(reg, mode); } ```

Definition at line 1042 of file computationBuilders.h.

template<typename ValueType >
exec_registration::Constant< ValueType >::Constant ( const ValueType &  constantValue)
inline

Definition at line 1058 of file computationBuilders.h.

template<Exec_ComputationBuilderProviderTypes allowed>
template<typename ResultType >
ValueSpecifier Exec_ComputationBuilderAccessor< allowed >::IncomingConnections ( const TfToken computationName)
inline

See IncomingConnections()

Definition at line 514 of file computationBuilders.h.

template<typename ResultType >
auto exec_registration::IncomingConnections ( const TfToken computationName)

On any provider, requests input values from the computation computationName of type ResultType on the attributes that own any attribute connections that target the provider object.

When this input parameter produces multiple input values, there is no deterministic ordering.

Note
Conceptually, this input registration provides access to the connections that target the provider, but as outlined in the paragraph above, in practice it requests the named computation from the attributes that own those connections. The reason we choose "IncomingConnections" as the name, rather than "IncomingConnectionOwningAttributes," is to allow for future expansion of USD to allow for value-transforming behaviors on attribute connections themselves.

The default input name is computationName; use InputName to specify a different input name.

Example

```{.cpp} EXEC_REGISTER_COMPUTATIONS_FOR_SCHEMA(MySchemaType) { // Register a prim computation that sums the values of the // integer-valued attributes that own connections that target the // provider prim. self.PrimComputation(_tokens->computeSum) .Callback<int>(+[](const VdfContext &ctx) { VdfReadIteratorRange<int> range( ctx, ExecBuiltinComputations->computeValue); return std::accumulate(range.begin(), range.end(), 0); }) .Inputs( IncomingConnections<int>(ExecBuiltinComputations->computeValue)); } ```

Definition at line 1288 of file computationBuilders.h.

template<Exec_ComputationBuilderProviderTypes allowed>
template<typename ResultType >
ValueSpecifier Exec_ComputationBuilderAccessor< allowed >::Metadata ( const TfToken metadataKey)
inline

See Metadata()

Definition at line 527 of file computationBuilders.h.

template<typename ValueType >
exec_registration::Metadata< ValueType >::Metadata ( const TfToken metadataKey)
inline

Requests an input value from the metadata field indicated by metadataKey, of type ResultType.

The default input name is metadataKey; use InputName to specify a different input name.

Example

```{.cpp} self.PrimComputation(_tokens->computeDocMetadata) .Callback<std::string>(+[](const VdfContext &ctx) { return ctx.GetInputValue<std::string>( SdfFieldKeys->Documentation); }) .Inputs( Metadata<std::string>(SdfFieldKeys->Documentation).Required() ); ```

Definition at line 918 of file computationBuilders.h.

template<typename ResultType >
exec_registration::NamespaceAncestor< ResultType >::NamespaceAncestor ( const TfToken computationName)
inline

On a prim computation, requests an input value from the computation computationName of type ResultType on the nearest namespace ancestor prim.

The default input name is computationName; use InputName to specify a different input name.

Example

```{.cpp} EXEC_REGISTER_COMPUTATIONS_FOR_SCHEMA(MySchemaType) { // Register a prim computation that finds the nearest namespace // ancestor that defines a computation 'sourceComputation' with // an int result type. If found, the result is the value of the // ancestor compuation; otherwise, returns 0. self.PrimComputation(_tokens->myComputation) .Callback<int>(+[](const VdfContext &ctx) { const int *const valuePtr = ctx.GetInputValuePtr<int>(_tokens->sourceComputation); return valuePtr ? *valuePtr : 0; }) .Inputs( NamespaceAncestor<int>(_tokens->sourceComputation)); } ```

Definition at line 1123 of file computationBuilders.h.

template<Exec_ComputationBuilderProviderTypes allowed>
template<typename ResultType >
ValueSpecifier Exec_ComputationBuilderRelationshipAccessor< allowed >::TargetedObjects ( const TfToken computationName)
inline

After a Relationship() accessor, requests input values from the computation computationName of type ResultType on the objects targeted by the relationship.

Relationship forwarding is applied, so if the relationship targets another relationship, the targets are transitively expanded, resulting in the ultimately targeted, non-relationship objects.

The default input name is computationName; use InputName to specify a different input name.

Example

```{.cpp} EXEC_REGISTER_COMPUTATIONS_FOR_SCHEMA(MySchemaType) { // Register a prim computation that looks for the computation // 'sourceComputation' on all targeted objects of the relationship // 'myRel' and returns the number of matching targets. self.PrimComputation(_tokens->myComputation) .Callback<int>(+[](const VdfContext &ctx) { VdfReadIterator<int> it(_tokens->sourceComputation); return static_cast<int>(it.ComputeSize()); }) .Inputs( Relationship(_tokens->myRel) .TargetedObjects<int>(_tokens->sourceComputation)); } ```

Definition at line 635 of file computationBuilders.h.