Improve seed and loop controls
This commit is contained in:
+5
-3
@@ -258,6 +258,7 @@ class SxCPForLoopStart:
|
||||
return {
|
||||
"required": {
|
||||
"total": ("INT", {"default": 2, "min": 1, "max": 100000, "step": 1}),
|
||||
"skip": ("INT", {"default": 0, "min": 0, "max": 100000, "step": 1}),
|
||||
},
|
||||
"optional": {
|
||||
f"initial_value{index}": (ANY_TYPE,) for index in range(1, MAX_CARRY_VALUES + 1)
|
||||
@@ -276,9 +277,10 @@ class SxCPForLoopStart:
|
||||
FUNCTION = "start"
|
||||
CATEGORY = "prompt_builder/loop"
|
||||
|
||||
def start(self, total, initial_index=None, initial_collected=None, **kwargs):
|
||||
def start(self, total, skip=0, initial_index=None, initial_collected=None, **kwargs):
|
||||
_require_graph_builder()
|
||||
index = 0 if initial_index is None else initial_index
|
||||
skip = max(0, int(skip))
|
||||
index = skip if initial_index is None else max(int(initial_index), skip)
|
||||
collected = initial_collected
|
||||
initial_values = {
|
||||
"initial_value0": index,
|
||||
@@ -287,7 +289,7 @@ class SxCPForLoopStart:
|
||||
for carry_index in range(1, MAX_CARRY_VALUES + 1):
|
||||
initial_values[f"initial_value{carry_index + 1}"] = kwargs.get(f"initial_value{carry_index}")
|
||||
graph = GraphBuilder()
|
||||
graph.node("SxCPWhileLoopStart", condition=total, **initial_values)
|
||||
graph.node("SxCPWhileLoopStart", condition=index < int(total), **initial_values)
|
||||
return {
|
||||
"result": tuple(["stub", index, collected] + [kwargs.get(f"initial_value{index}") for index in range(1, MAX_CARRY_VALUES + 1)]),
|
||||
"expand": graph.finalize(),
|
||||
|
||||
Reference in New Issue
Block a user