MCPcopy Create free account
hub / github.com/WainWong/ComfyUI-Loop-image / BatchImageLoopClose

Class BatchImageLoopClose

flow_control.py:125–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123
124@VariantSupport()
125class BatchImageLoopClose:
126 def __init__(self):
127 pass
128
129 @classmethod
130 def INPUT_TYPES(cls):
131 inputs = {
132 "required": {
133 "flow_control": ("FLOW_CONTROL", {"rawLink": True}),
134 "current_image": ("IMAGE",),
135 "current_mask": ("MASK",),
136 "max_iterations": ("INT", {"forceInput": True}),
137 },
138 "optional": {
139 "pass_back": ("BOOLEAN", {"default": False}), # 新增:控制是否传回图片
140 },
141 "hidden": {
142 "dynprompt": "DYNPROMPT",
143 "unique_id": "UNIQUE_ID",
144 "result_images": ("IMAGE",),
145 "result_masks": ("MASK",),
146 "iteration_count": ("INT", {"default": 0}),
147 }
148 }
149 return inputs
150
151 RETURN_TYPES = tuple(["IMAGE", "MASK"])
152 RETURN_NAMES = tuple(["result_images", "result_masks"])
153 FUNCTION = "while_loop_close"
154 CATEGORY = "CyberEveLoop🐰"
155
156 def explore_dependencies(self, node_id, dynprompt, upstream, parent_ids):
157 node_info = dynprompt.get_node(node_id)
158 if "inputs" not in node_info:
159 return
160
161 for k, v in node_info["inputs"].items():
162 if is_link(v):
163 parent_id = v[0]
164 display_id = dynprompt.get_display_node_id(parent_id)
165 display_node = dynprompt.get_node(display_id)
166 class_type = display_node["class_type"]
167 # 排除循环结束节点
168 if class_type not in ['BatchImageLoopClose']:
169 parent_ids.append(display_id)
170 if parent_id not in upstream:
171 upstream[parent_id] = []
172 self.explore_dependencies(parent_id, dynprompt, upstream, parent_ids)
173 upstream[parent_id].append(node_id)
174
175 def explore_output_nodes(self, dynprompt, upstream, output_nodes, parent_ids):
176 """探索并添加输出节点的连接"""
177 for parent_id in upstream:
178 display_id = dynprompt.get_display_node_id(parent_id)
179 for output_id in output_nodes:
180 id = output_nodes[output_id][0]
181 if id in parent_ids and display_id == id and output_id not in upstream[parent_id]:
182 if '.' in parent_id:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected