|
HDK
|
Collaboration diagram for Value Specifiers: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.
|
inline |
See Computation()
Definition at line 499 of file computationBuilders.h.
|
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.
```{.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.
|
inline |
See Connections()
Definition at line 571 of file computationBuilders.h.
| 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.
The default input name is computationName; use InputName to specify a different input name.
```{.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.
|
inline |
Requests a constant input value of type ValueType.
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:
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.
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)); } ```
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.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 ®, 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.
|
inline |
Definition at line 1058 of file computationBuilders.h.
|
inline |
Definition at line 514 of file computationBuilders.h.
| 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.
The default input name is computationName; use InputName to specify a different input name.
```{.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.
|
inline |
See Metadata()
Definition at line 527 of file computationBuilders.h.
|
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.
```{.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.
|
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.
```{.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.
|
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.
```{.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.