diff --git a/visual_area_prompt.py b/visual_area_prompt.py index 7a916c7..f18c13f 100644 --- a/visual_area_prompt.py +++ b/visual_area_prompt.py @@ -1,3 +1,5 @@ +from comfy_execution.graph_utils import GraphBuilder + class VisualAreaPrompt: def __init__(self) -> None: pass @@ -5,8 +7,9 @@ class VisualAreaPrompt: @classmethod def INPUT_TYPES(cls): return { - "optional": { - "global_conditioning": ("CONDITIONING", { "tooltip": "Base conditioning. Will be applied to the whole image." }), + "required": { + "general_conditioning": ("CONDITIONING", { "tooltip": "Base conditioning. Will be concatenated to all other conditionings." }), + "global_conditioning": ("CONDITIONING", { "tooltip": "Base conditioning. Will be applied to the whole image once." }), }, "hidden": { "extra_pnginfo": "EXTRA_PNGINFO", @@ -21,12 +24,27 @@ class VisualAreaPrompt: OUTPUT_NODE = False CATEGORY = "RegionalPrompt" - def run_node(self, global_conditioning, extra_pnginfo, unique_id, **kwargs): - # TODO: Implement this function + def run_node(self, general_conditioning, global_conditioning, extra_pnginfo, unique_id, **kwargs): for node in extra_pnginfo["workflow"]["nodes"]: if node["id"] == int(unique_id): conditioning_areas = node["properties"]["area_values"] print(conditioning_areas) break - return (global_conditioning, global_conditioning) + graph = GraphBuilder() + # TODO: Implement this graph: + + # general_conditioning + # concat to all other conditionings (except global) (to: general, from: og prompt) + + # global_conditioning (SECOND OUTPUT!) + # concat all other conditionings (to: (to: (to: general, from global), from prompt1), from prompt2 ...) + + # Apply area with percentage from conditionings + + # Combine all prompts (including merged global last) into one (FIRST OUTPUT!) + + return { + "result": (global_conditioning, global_conditioning), + "expand": graph.finalize() + }