m types fixed |
overhaul |
||
Line 12: | Line 12: | ||
|}} | |}} | ||
The '''Field As Variable''' node transforms an [[Type:IValue|IValue]] of the given type into an [[Type:IVariable|IVariable]] that can then be written to with an [[ProtoFlux:Indirect Write|Indirect Write]] node. | |||
Field As Variable | Despite being called "Field As Variable", any IValue type will work as input. An example of an IValue that is not necessarily a [[Type:IField|Field]] is the [[Component:AuthorityTimeBase|AuthorityTimeBase]] component. | ||
This node implements IVariable itself. This means that one may drag the output of this node into a normal [[ProtoFlux:Write|Write]] node and write to the given IValue. This is actually more performant than using an Indirect Write, as a normal write node does not check if the variable changes every time it is pulsed. However, The performance gain diminishes the more often the input IValue changes, being roughly equal if the IValue changes at every write call. | |||
== Inputs == | == Inputs == | ||
=== Field ([[Type:IValue`1|IValue<T>]] | === Field ([[Type:IValue`1|IValue<T>]])=== | ||
The | The IValue of type T to transform into a variable. | ||
== Outputs == | == Outputs == | ||
=== * ([[Type:IVariable`2|Variable]] | === * ([[Type:IVariable`2|Variable]]) === | ||
A variable | |||
A variable created from the given <code>Field</code>. | |||
== Examples == | == Examples == | ||
<gallery widths=560px heights=240px> | |||
File:ProtoFlux Example Field As Variable Writing.webp|The two methods of conditionally writing to an IValue reference (in this case, a [[Component:ValueField|ValueField]] value) using the Field As Variable node. The top method is much more performant if the conditional does not change often. | |||
</gallery> | |||
[[Category:ProtoFlux:Core]] | [[Category:ProtoFlux:Core]] |
Latest revision as of 01:37, 14 August 2024
The Field As Variable node transforms an IValue of the given type into an IVariable that can then be written to with an Indirect Write node.
Despite being called "Field As Variable", any IValue type will work as input. An example of an IValue that is not necessarily a Field is the AuthorityTimeBase component.
This node implements IVariable itself. This means that one may drag the output of this node into a normal Write node and write to the given IValue. This is actually more performant than using an Indirect Write, as a normal write node does not check if the variable changes every time it is pulsed. However, The performance gain diminishes the more often the input IValue changes, being roughly equal if the IValue changes at every write call.
Inputs
Field (IValue<T>)
The IValue of type T to transform into a variable.
Outputs
* (Variable)
A variable created from the given Field
.
Examples
-
The two methods of conditionally writing to an IValue reference (in this case, a ValueField value) using the Field As Variable node. The top method is much more performant if the conditional does not change often.