From 349a8524c6f7fcab4a124cacb60bfbef1463cf1b Mon Sep 17 00:00:00 2001 From: Mel Massadian Date: Thu, 2 May 2024 07:58:37 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20add=20back=20was=20conver?= =?UTF-8?q?sion=20node?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To avoid breaking other worklfows I thought this was now builtin WAS suite. Fixes #172 --- nodes/number.py | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/nodes/number.py b/nodes/number.py index f5933ef..59e6c2e 100644 --- a/nodes/number.py +++ b/nodes/number.py @@ -22,6 +22,64 @@ class MTB_IntToBool: return (bool(int),) +class MTB_IntToNumber: + """Node addon for the WAS Suite. Converts a "comfy" INT to a NUMBER.""" + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "int": ( + "INT", + { + "default": 0, + "min": -1e9, + "max": 1e9, + "step": 1, + "forceInput": True, + }, + ), + } + } + + RETURN_TYPES = ("NUMBER",) + FUNCTION = "int_to_number" + CATEGORY = "mtb/number" + + def int_to_number(self, int): + return (int,) + + +class MTB_FloatToNumber: + """Node addon for the WAS Suite. Converts a "comfy" FLOAT to a NUMBER.""" + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "float": ( + "FLOAT", + { + "default": 0, + "min": -1e9, + "max": 1e9, + "step": 1, + "forceInput": True, + }, + ), + } + } + + RETURN_TYPES = ("NUMBER",) + FUNCTION = "float_to_number" + CATEGORY = "mtb/number" + + def float_to_number(self, float): + return (float,) + + __nodes__ = [ + MTB_FloatToNumber, MTB_IntToBool, + MTB_IntToNumber, ]