Python-like xrange/range node that iterates over an arithmetic progression.
Parameters (range semantics):
- If only stop is provided: start=0, stop=stop, step=1.
- start (INT, optional): defaults to 0 when left blank.
- stop (INT, required): end (exclusive).
- step (INT, optional): defaults to 1 when left blank. Cannot be 0. Can be negative.
- reset (BOOLEAN, optional): when True, immediately restart the loop at the beginning for this evaluation and set the UI cursor accordingly.
Behavior:
- Produces the full list for convenience, and outputs the current value (based on an internal cursor widget).
- The cursor advances by 1 on each execution unless advance is disabled.
- When the range is exhausted:
- If repeat=false, the overflow flag is True and the current value remains the last valid value.
- If repeat=true, the cursor wraps to the beginning (or end for negative step) and the overflow flag is True until next run.
- If reset=true, the cursor is set to the first position for this evaluation before any advancing logic is applied.
Notes:
- Works for negative steps exactly as Python range.
- Leave start/step blank to use defaults. Tooltips explain the defaults.
- The node is marked as always-changed to allow stepping each run.
Composition example:
- To emulate minutes -> hours: configure one node as 0..60 with repeat=true, and another as 0..24 with repeat=true.
- Connect minutes.exhausted_or_looped -> hours.advance so the hours node advances once each time minutes wraps.
- Optionally connect a trigger to both minutes.reset and hours.reset to restart both counters from zero.
By sfinktah·Created 12 months ago·Updated 9 months ago· 6
XRange Node
current_value
range_list
overflow
◄start0►
◄stop10►
◄step1►
◄repeatfalse►
◄cursor0►
◄advancetrue►
◄resetfalse►
CategoryData
Inputs (7)
Name
Type
Default
Description
startopt
STRING
0
Optional start as integer string. Blank/whitespace -> 0.
stopopt
STRING
10
Required stop as integer string. Leave blank to error at runtime.
stepopt
STRING
1
Optional step as integer string. Blank/whitespace -> 1. Non-zero. Can be negative.
repeatopt
BOOLEAN
false
When enabled, wraps to beginning after reaching the end (or to end for negative step).