Loading...
Searching...
No Matches

An input option is an element of an input registration that applies to a value specifier, modifying its behavior. More...

+ Collaboration diagram for Input Options:

Functions

This & InputName (const TfToken &inputName)
 Overrides the default input name, setting it to inputName.
 
This & Required ()
 Declares the input is required, i.e., that the computation expects an input value always to be provided at evaluation time.
 
This & FallsBackToDispatched ()
 Declares the input can find dispatched computations if the requested computation name doesn't match a local computation on the provider.
 

Detailed Description

An input option is an element of an input registration that applies to a value specifier, modifying its behavior.

A value specifier may be followed by zero or more input options.

Function Documentation

◆ FallsBackToDispatched()

This & FallsBackToDispatched ( )
inline

Declares the input can find dispatched computations if the requested computation name doesn't match a local computation on the provider.

See also
DispatchedPrimComputation

Example

{
// Register a dispatched prim computation.
self.DispatchedPrimComputation(_tokens->myDispatchedComputation)
.Callback(+[](const VdfContext &) -> double { return 11.0; })
// Register a prim computation that requests the above dispatched
// computation via uses relationship targets.
self.PrimComputation(_tokens->myComputation)
.Callback(+[](const VdfContext &ctx) -> double {
const double *const valuePtr =
ctx.GetInputValuePtr<double>(
_tokens->myDispatchedComputation);
return valuePtr ? *valuePtr : -1.0;
})
.Inputs(
Relationship(_tokens->myRelationship)
.TargetedObjects<double>(
_tokens->myDispatchedComputation)
}
A context is the parameter bundle passed to callbacks of computations.
Definition: context.h:40
const T * GetInputValuePtr(const TfToken &name) const
Returns a pointer to the value from the input named name if the input has a valid value,...
Definition: context.h:331
#define EXEC_REGISTER_COMPUTATIONS_FOR_SCHEMA(SchemaType)
Initiates registration of exec computations for the schema SchemaType.
This & FallsBackToDispatched()
Declares the input can find dispatched computations if the requested computation name doesn't match a...

Definition at line 415 of file computationBuilders.h.

◆ InputName()

This & InputName ( const TfToken inputName)
inline

Overrides the default input name, setting it to inputName.

Example

{
// Register a prim computation that returns the value of another
// prim computation, using a non-default input name.
self.PrimComputation(_tokens->myComputation)
.Callback(+[](const VdfContext &ctx) -> double {
const double *const valuePtr =
ctx.GetInputValuePtr<double>(_tokens->myInputName);
return valuePtr ? *valuePtr : 0.0;
})
.Inputs(
Computation<double>(_tokens->anotherComputation)
.InputName(_tokens->myInputName));
}

Definition at line 347 of file computationBuilders.h.

◆ Required()

This & Required ( )
inline

Declares the input is required, i.e., that the computation expects an input value always to be provided at evaluation time.

If exec compilation is unable to compile input connections for a required input, an error will be emitted.

Example

{
// Register a prim computation that returns the value of another
// prim computation, using a non-default input name.
self.PrimComputation(_tokens->myComputation)
.Callback(+[](const VdfContext &ctx) -> int {
return ctx.GetInputValue<int>(_tokens->myInputName);
})
.Inputs(
Computation<int>(_tokens->anotherComputation).Required());
}
VdfByValueOrConstRef< T > GetInputValue(const TfToken &name) const
Returns a value from the input named name of type T.
Definition: context.h:312

Definition at line 376 of file computationBuilders.h.