From 0c205ca510189b5188cbc83e49c5353c4f57e5a8 Mon Sep 17 00:00:00 2001 From: Alexopus Date: Sun, 14 Jan 2024 13:01:59 +0100 Subject: [PATCH] Add LoRA Stack to String converter --- efficiency_nodes.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/efficiency_nodes.py b/efficiency_nodes.py index e13b739..4d8901b 100644 --- a/efficiency_nodes.py +++ b/efficiency_nodes.py @@ -4142,6 +4142,26 @@ class TSC_Tiled_Upscaler: script["tile"] = (upscale_by, tile_size, tiling_strategy, tiling_steps, seed, denoise, tile_controlnet, strength) return (script,) +######################################################################################################################## +# TSC LoRA Stack to String converter +class TSC_LoRA_Stack2String: + @classmethod + def INPUT_TYPES(cls): + return {"required": {"lora_stack": ("LORA_STACK",)}} + + RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("LoRA string",) + FUNCTION = "convert" + CATEGORY = "Efficiency Nodes/Misc" + + def convert(self, lora_stack): + """ + Converts a list of tuples into a single space-separated string. + Each tuple contains (STR, FLOAT1, FLOAT2) and is converted to the format "". + """ + output = ' '.join(f"" for tup in lora_stack) + return (output,) + ######################################################################################################################## # NODE MAPPING NODE_CLASS_MAPPINGS = { @@ -4179,7 +4199,8 @@ NODE_CLASS_MAPPINGS = { "Image Overlay": TSC_ImageOverlay, "Noise Control Script": TSC_Noise_Control_Script, "HighRes-Fix Script": TSC_HighRes_Fix, - "Tiled Upscaler Script": TSC_Tiled_Upscaler + "Tiled Upscaler Script": TSC_Tiled_Upscaler, + "LoRA Stack to String converter": TSC_LoRA_Stack2String } ########################################################################################################################