From 4e213086bb1501acd4cafef7f696b5aafc5c3911 Mon Sep 17 00:00:00 2001 From: Fill Date: Tue, 14 Oct 2025 05:43:31 -0700 Subject: [PATCH] added number converter --- __init__.py | 5 +++ nodes/utility/FL_NumberConverter.py | 48 +++++++++++++++++++++++++++++ pyproject.toml | 2 +- 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 nodes/utility/FL_NumberConverter.py diff --git a/__init__.py b/__init__.py index 806009a..d8b7c0a 100644 --- a/__init__.py +++ b/__init__.py @@ -161,6 +161,7 @@ from .nodes.utility.FL_InpaintCrop import FL_Inpaint_Stitch from .nodes.utility.FL_JS import FL_JS from .nodes.utility.FL_Math import FL_Math from .nodes.utility.FL_ModelInspector import FL_ModelInspector +from .nodes.utility.FL_NumberConverter import FL_IntToFloat, FL_FloatToInt from .nodes.utility.FL_Padding import FL_Padding from .nodes.utility.FL_PasteByMask import FL_PasteByMask from .nodes.utility.FL_PasteOnCanvas import FL_PasteOnCanvas @@ -385,6 +386,8 @@ NODE_CLASS_MAPPINGS = { "FL_Audio_Separation": FL_Audio_Separation, "FL_Audio_Shot_Iterator": FL_Audio_Shot_Iterator, "FL_QwenImageEditStrength": FL_QwenImageEditStrength, + "FL_IntToFloat": FL_IntToFloat, + "FL_FloatToInt": FL_FloatToInt, } NODE_DISPLAY_NAME_MAPPINGS = { @@ -563,6 +566,8 @@ NODE_DISPLAY_NAME_MAPPINGS = { "FL_Audio_Separation": "FL Audio Separation", "FL_Audio_Shot_Iterator": "FL Audio Shot Iterator", "FL_QwenImageEditStrength": "FL Qwen Image Edit with Strength", + "FL_IntToFloat": "FL Int to Float", + "FL_FloatToInt": "FL Float to Int", } diff --git a/nodes/utility/FL_NumberConverter.py b/nodes/utility/FL_NumberConverter.py new file mode 100644 index 0000000..4e72126 --- /dev/null +++ b/nodes/utility/FL_NumberConverter.py @@ -0,0 +1,48 @@ +class FL_IntToFloat: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "int_value": ("INT", {"default": 0, "min": -2147483648, "max": 2147483647}), + }, + } + + RETURN_TYPES = ("FLOAT",) + RETURN_NAMES = ("float_value",) + FUNCTION = "convert" + CATEGORY = "🏵️Fill Nodes/Utility" + + def convert(self, int_value): + return (float(int_value),) + + +class FL_FloatToInt: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "float_value": ("FLOAT", {"default": 0.0}), + "rounding_mode": (["round", "floor", "ceil", "truncate"], {"default": "round"}), + }, + } + + RETURN_TYPES = ("INT",) + RETURN_NAMES = ("int_value",) + FUNCTION = "convert" + CATEGORY = "🏵️Fill Nodes/Utility" + + def convert(self, float_value, rounding_mode): + import math + + if rounding_mode == "round": + result = round(float_value) + elif rounding_mode == "floor": + result = math.floor(float_value) + elif rounding_mode == "ceil": + result = math.ceil(float_value) + elif rounding_mode == "truncate": + result = math.trunc(float_value) + else: + result = round(float_value) + + return (int(result),) diff --git a/pyproject.toml b/pyproject.toml index 05f7acd..afad701 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui_fill-nodes" description = "Fill-Nodes is a versatile collection of custom nodes for ComfyUI that extends functionality across multiple domains. Features include advanced image processing (pixelation, slicing, masking), visual effects generation (glitch, halftone, pixel art), comprehensive file handling (PDF creation/extraction, Google Drive integration), AI model interfaces (GPT, DALL-E, Hugging Face), utility nodes for workflow enhancement, and specialized tools for video processing, captioning, and batch operations. The pack provides both practical workflow solutions and creative tools within a unified node collection." -version = "2.0.0" +version = "2.0.1" license = "LICENSE" dependencies = ["diffusers", "librosa", "sounddevice", "glitch_this", "PyOpenGL", "glfw", "scipy>=1.13.1", "requests", "aiohttp", "moviepy", "matplotlib", "reportlab", "openai", "PyPDF2", "pdf2image", "PyMuPDF", "reportlab", "PyPDF2", "ollama", "kornia", "opencv-python", "gdown", "open_clip_torch", "google-genai"]