Difference between revisions of "For (LogiX node)"
(Update to new node style & update category) |
|||
Line 3: | Line 3: | ||
<!--T:1--> | <!--T:1--> | ||
{{Infobox Logix Node | {{Infobox Logix Node | ||
− | | Name = | + | | Name = While |
− | | Image =[[File: | + | | Image =[[File: WhileNodeNode.png | noframe | 128px | 'While' LogiX node ]] |
| Input0Type = Impulse | Input0Name = Run | | Input0Type = Impulse | Input0Name = Run | ||
− | | Input1Type = | + | | Input1Type = Bool | Input1Name = Condition |
− | |||
| Output0Type = Impulse | Output0Name = LoopStart | | Output0Type = Impulse | Output0Name = LoopStart | ||
| Output1Type = Impulse | Output1Name = LoopIteration | | Output1Type = Impulse | Output1Name = LoopIteration | ||
| Output2Type = Impulse | Output2Name = LoopEnd | | Output2Type = Impulse | Output2Name = LoopEnd | ||
− | |||
}} | }} | ||
<!--T:2--> | <!--T:2--> | ||
− | The ''' | + | The '''While''' node is used to fire impulses from the <code>LoopIteration</code> output until the <code>Condition</code> becomes True after an impulse is received at <code>Run</code>. |
== Usage == <!--T:3--> | == Usage == <!--T:3--> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
The <code>LoopStart</code> output fires an impulse once after an impulse is received at <code>Run</code>. The impulse chain will complete before any impulses are fired from <code>LoopIteration</code>. | The <code>LoopStart</code> output fires an impulse once after an impulse is received at <code>Run</code>. The impulse chain will complete before any impulses are fired from <code>LoopIteration</code>. | ||
− | The <code>LoopIteration</code> output fires impulses sequentially until | + | The <code>LoopIteration</code> output fires impulses sequentially until the <code>Condition</code> becomes True. Each impulse chain started from <code>LoopIteration</code> completes before the following one is fired. |
The <code>LoopEnd</code> output fires an impulse once the final impulse chain started from <code>LoopIteration</code> has ended. | The <code>LoopEnd</code> output fires an impulse once the final impulse chain started from <code>LoopIteration</code> has ended. | ||
− | |||
− | |||
− | |||
Line 39: | Line 28: | ||
== Examples == <!--T:4--> | == Examples == <!--T:4--> | ||
+ | The While node is useful when looping and the required number of iterations cannot be determined in advance. If similar looping behavior is required, but the number of required iterations can be fixed, use the [[For (LogiX node)|For]] node instead. | ||
== Node Menu == <!--T:5--> | == Node Menu == <!--T:5--> | ||
</translate> | </translate> | ||
− | [[Category:LogiX{{#translation:}}| | + | [[Category:LogiX{{#translation:}}|While]] |
− | [[Category:LogiX:Flow{{#translation:}}| | + | [[Category:LogiX:Flow{{#translation:}}|While]] |
{{:NodeMenu-Flow{{#translation:}}}} | {{:NodeMenu-Flow{{#translation:}}}} |
Revision as of 14:55, 10 July 2021
While | ||
---|---|---|
Inputs | ||
Impulse | Run | |
Bool | Condition | |
Outputs | ||
Impulse | LoopStart | |
Impulse | LoopIteration | |
Impulse | LoopEnd |
The While node is used to fire impulses from the LoopIteration
output until the Condition
becomes True after an impulse is received at Run
.
Usage
The LoopStart
output fires an impulse once after an impulse is received at Run
. The impulse chain will complete before any impulses are fired from LoopIteration
.
The LoopIteration
output fires impulses sequentially until the Condition
becomes True. Each impulse chain started from LoopIteration
completes before the following one is fired.
The LoopEnd
output fires an impulse once the final impulse chain started from LoopIteration
has ended.
Note that all impulse chains started from this node effectively continue the one which arrived at Run
, meaning that any temporary values from previous nodes are still available. All iterations from LoopIteration
complete within a single frame update and therefore this can produce framerate hitches if an excessively demanding computation is performed. There is a failsafe which will put this node into an error state (node visual turns red) if a frame is delayed excessively - this helps prevent complete freezes.
Examples
The While node is useful when looping and the required number of iterations cannot be determined in advance. If similar looping behavior is required, but the number of required iterations can be fixed, use the For node instead.