From 7ecb190ef91d988420cf0e682efb79ac7433c0b7 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Wed, 12 Mar 2025 18:58:22 +0200 Subject: [PATCH] Add StringToFloatList --- __init__.py | 1 + nodes/nodes.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/__init__.py b/__init__.py index 833f43b..a323a64 100644 --- a/__init__.py +++ b/__init__.py @@ -108,6 +108,7 @@ NODE_CONFIG = { "InjectNoiseToLatent": {"class": InjectNoiseToLatent, "name": "Inject Noise To Latent"}, "CustomSigmas": {"class": CustomSigmas, "name": "Custom Sigmas"}, #utility + "StringToFloatList": {"class": StringToFloatList, "name": "String to Float List"}, "WidgetToString": {"class": WidgetToString, "name": "Widget To String"}, "SaveStringKJ": {"class": SaveStringKJ, "name": "Save String KJ"}, "DummyOut": {"class": DummyOut, "name": "Dummy Out"}, diff --git a/nodes/nodes.py b/nodes/nodes.py index e775f00..8580366 100644 --- a/nodes/nodes.py +++ b/nodes/nodes.py @@ -1017,6 +1017,23 @@ SVD: interped_ys = np.exp(new_ys)[::-1].copy() interped_ys_tensor = torch.tensor(interped_ys) return interped_ys_tensor + +class StringToFloatList: + @classmethod + def INPUT_TYPES(s): + return {"required": + { + "string" :("STRING", {"default": "1, 2, 3", "multiline": True}), + } + } + RETURN_TYPES = ("FLOAT",) + RETURN_NAMES = ("FLOAT",) + CATEGORY = "KJNodes/misc" + FUNCTION = "createlist" + + def createlist(self, string): + float_list = [float(x.strip()) for x in string.split(',')] + return (float_list,) class InjectNoiseToLatent: