HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
firstValidInputValue.h
Go to the documentation of this file.
1
//
2
// Copyright 2025 Pixar
3
//
4
// Licensed under the terms set forth in the LICENSE.txt file available at
5
// https://openusd.org/license.
6
//
7
#ifndef PXR_EXEC_EF_FIRST_VALID_INPUT_VALUE_H
8
#define PXR_EXEC_EF_FIRST_VALID_INPUT_VALUE_H
9
10
/// \file
11
12
#include "
pxr/pxr.h
"
13
14
#include "
pxr/exec/vdf/context.h
"
15
#include "
pxr/exec/vdf/executionTypeRegistry.h
"
16
#include "
pxr/exec/vdf/iterator.h
"
17
#include "
pxr/exec/vdf/node.h
"
18
19
PXR_NAMESPACE_OPEN_SCOPE
20
21
////////////////////////////////////////////////////////////////////////////////
22
///
23
/// A function that may be used as a callback (or in a callback) to return the
24
/// first valid input value.
25
///
26
/// This will iterate over the inputs in the order they have been registered
27
/// and return the value of the first valid input, i.e. the first input that
28
/// provides a value. If no valid input value exists, return the fallback value
29
/// for TYPE.
30
///
31
template
<
typename
Type>
32
Type
33
EfGetFirstValidInputValue
(
const
VdfContext
&context)
34
{
35
struct
ContextAccess final :
public
VdfIterator
{
36
const
VdfNode
&GetNode(
const
VdfContext
&context) {
37
return
_GetNode
(context);
38
}
39
};
40
41
// Iterate over all inputs, and return the first valid input value.
42
const
VdfNode
&node = ContextAccess().GetNode(context);
43
for
(
const
std::pair<TfToken, VdfInput *> &
in
: node.
GetInputsIterator
()) {
44
if
(
const
Type
*
value
= context.
GetInputValuePtr
<
Type
>(
in
.first)) {
45
return
*
value
;
46
}
47
}
48
49
// Ask the type registry for the fallback value to use.
50
return
VdfExecutionTypeRegistry::GetInstance
().
GetFallback
<
Type
>();
51
}
52
53
PXR_NAMESPACE_CLOSE_SCOPE
54
55
#endif
iterator.h
VdfNode::GetInputsIterator
const InputMapIterator GetInputsIterator() const
Definition:
node.h:177
SOP_AttribCreate_2_0Enums::Type
Type
Definition:
SOP_AttribCreate-2.0.proto.h:90
PXR_NAMESPACE_OPEN_SCOPE
#define PXR_NAMESPACE_OPEN_SCOPE
Definition:
pxr.h:73
value
GLsizei const GLfloat * value
Definition:
glcorearb.h:824
VdfNode
Definition:
node.h:52
detail::in
constexpr auto in(type t, int set) -> bool
Definition:
core.h:611
VdfContext::GetInputValuePtr
const T * GetInputValuePtr(const TfToken &name) const
Definition:
context.h:319
EfGetFirstValidInputValue
PXR_NAMESPACE_OPEN_SCOPE Type EfGetFirstValidInputValue(const VdfContext &context)
Definition:
firstValidInputValue.h:33
pxr.h
context.h
VdfExecutionTypeRegistry::GetFallback
const T & GetFallback() const
Definition:
executionTypeRegistry.h:276
VdfExecutionTypeRegistry::GetInstance
static VDF_API VdfExecutionTypeRegistry & GetInstance()
PXR_NAMESPACE_CLOSE_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition:
pxr.h:74
VdfIterator
Definition:
iterator.h:35
VdfIterator::_GetNode
const VdfNode & _GetNode(const VdfContext &context) const
Definition:
iterator.h:45
executionTypeRegistry.h
VdfContext
Definition:
context.h:39
node.h
pxr
exec
ef
firstValidInputValue.h
Generated on Sat Jul 18 2026 02:16:54 for HDK by
1.8.6