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

Class SingleImageLoopClose

flow_control.py:384–531  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382
383@VariantSupport()
384class SingleImageLoopClose:
385 def __init__(self):
386 pass
387
388 @classmethod
389 def INPUT_TYPES(cls):
390 inputs = {
391 "required": {
392 "flow_control": ("FLOW_CONTROL", {"rawLink": True}),
393 "current_image": ("IMAGE",),
394 "max_iterations": ("INT", {"forceInput": True}),
395 },
396 "optional": {
397 "current_mask": ("MASK",),
398 },
399 "hidden": {
400 "dynprompt": "DYNPROMPT",
401 "unique_id": "UNIQUE_ID",
402 "iteration_count": ("INT", {"default": 0}),
403 }
404 }
405 return inputs
406
407 RETURN_TYPES = tuple(["IMAGE", "MASK"])
408 RETURN_NAMES = tuple(["final_image", "final_mask"])
409 FUNCTION = "loop_close"
410 CATEGORY = "CyberEveLoop🐰"
411
412 def explore_dependencies(self, node_id, dynprompt, upstream, parent_ids):
413 node_info = dynprompt.get_node(node_id)
414 if "inputs" not in node_info:
415 return
416
417 for k, v in node_info["inputs"].items():
418 if is_link(v):
419 parent_id = v[0]
420 display_id = dynprompt.get_display_node_id(parent_id)
421 display_node = dynprompt.get_node(display_id)
422 class_type = display_node["class_type"]
423 if class_type not in ['SingleImageLoopClose']:
424 parent_ids.append(display_id)
425 if parent_id not in upstream:
426 upstream[parent_id] = []
427 self.explore_dependencies(parent_id, dynprompt, upstream, parent_ids)
428 upstream[parent_id].append(node_id)
429
430 def explore_output_nodes(self, dynprompt, upstream, output_nodes, parent_ids):
431 for parent_id in upstream:
432 display_id = dynprompt.get_display_node_id(parent_id)
433 for output_id in output_nodes:
434 id = output_nodes[output_id][0]
435 if id in parent_ids and display_id == id and output_id not in upstream[parent_id]:
436 if '.' in parent_id:
437 arr = parent_id.split('.')
438 arr[len(arr)-1] = output_id
439 upstream[parent_id].append('.'.join(arr))
440 else:
441 upstream[parent_id].append(output_id)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected