Navigation
API > API/Runtime > API/Runtime/Engine
A lightweight wrapper around FValue* that also optionally tracks the source expression input. Used to carry both value and its origin in the expression graph. A null reference evaluates has the FValue* set to nullptr and evaluates false. It is returned by the FEmitter::TryInput() value to indicate a missing value. An invalid reference is either null or has a poison value. It is usually generated as the result of an invalid operation. Important: The Emitter APIs can safely take both null and poison values. Operations that take a single argument simply return the argument if it is invalid (null or poison), whereas operations that take multiple arguments return poison if any is invalid.
When your intention is to test for whether a value is not-null (available), leverage the operator bool() if (Value) { /* handle case when value is available */ }
Otherwise, if you would like the value to be available AND valid (not-poison) you should test for IsValid()if (Value.IsValid()) { /* handle case when the operations that produced the value were all succesful */ }
Note: In user Expression::Build() implementations, you should avoid testing values validity directly and instead leverage the UE_MIR_CHECKPOINT() macro to verify that all emitter performed so far were all valid, and thus the values you have computed so far are what you expect.
| Name | FValueRef |
| Type | struct |
| Header File | /Engine/Source/Runtime/Engine/Public/Materials/MaterialIREmitter.h |
| Include Path | #include "Materials/MaterialIREmitter.h" |
Syntax
struct FValueRef
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FValueRef () |
Default constructor. Creates an invalid reference. | Materials/MaterialIREmitter.h | |
| Constructs from a value pointer. | Materials/MaterialIREmitter.h | ||
FValueRef
(
FValue* Value, |
Constructs from a value pointer and its corresponding input source. | Materials/MaterialIREmitter.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Input | const FExpressionInput * | The expression input being read. | Materials/MaterialIREmitter.h | |
| Value | FValue * | The referenced value. | Materials/MaterialIREmitter.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool IsPoison() |
Checks if the reference holds a poison value. | Materials/MaterialIREmitter.h | |
bool IsValid() |
Checks if the reference holds a valid non-null value. | Materials/MaterialIREmitter.h | |
| Creates a new reference with the same input but a different value. | Materials/MaterialIREmitter.h | ||
FValueRef ToPoison() |
Creates a poison version of the current reference (same input, but poison value). | Materials/MaterialIREmitter.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
operator bool() |
Returns whether this references a non-null value. | Materials/MaterialIREmitter.h | |
operator FValue *() |
Returns the referenced value, which must be non-null. | Materials/MaterialIREmitter.h | |
FValue * operator->() |
Returns the referenced value, which must be non-null. | Materials/MaterialIREmitter.h |