From 0ba0dc83f5024da3367ecc57e5abd1406bcfaa60 Mon Sep 17 00:00:00 2001 From: Alexander Piskun <13381981+bigcat88@users.noreply.github.com> Date: Sun, 28 Jul 2024 14:12:06 +0300 Subject: [PATCH] added `VixUiRangeInt` UI node Signed-off-by: Alexander Piskun --- README.md | 1 + __init__.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/README.md b/README.md index a5eea58..7e1b291 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ Current `Visionatrix/UI` nodes list: - **VixUI-Checkbox** - simple checkbox boolean input field; - **VixUi-RangeFloat** - range float number input, e.g. for prompt strength selection; - **VixUi-RangeScaleFloat** - special range float number input, to define the scale factor of the input image (e.g. for upscale) +- **VixUi-RangeInt** - range int number input, e.g. for number of steps selection; - **VixUi-List** - define list of options to be displayed in Visionatrix UI; - **VixUI-Prompt** - to define a textarea input in Visionatrix UI and pass it to your CLIPTextEncode node with prompt; - **VixUi-CheckboxLogic** - to define the boolean logical switch (checkbox), e.g. two modes and paths of workflow execution; diff --git a/__init__.py b/__init__.py index 0df41df..19a196b 100644 --- a/__init__.py +++ b/__init__.py @@ -86,6 +86,32 @@ class VixUiRangeScaleFloat: return (value,) +class VixUiRangeInt: + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "value": ("INT", {"default": 10}), + "display_name": ("STRING", {"default": "Display Range"}), + "optional": ("BOOLEAN", {"default": True}), + "advanced": ("BOOLEAN", {"default": True}), + "min": ("INT", {"default": 1}), + "max": ("INT", {"default": 20}), + "step": ("INT", {"default": 1}), + "order": ("INT", {"default": 99}), + "custom_id": ("STRING", {"default": ""}), + }, + } + + FUNCTION = "do_it" + CATEGORY = "Visionatrix/UI" + RETURN_TYPES = ("INT",) + + @classmethod + def do_it(cls, value, **kwargs) -> tuple: + return (value,) + + class VixUiList: @classmethod def INPUT_TYPES(cls): @@ -243,6 +269,7 @@ NODE_CLASS_MAPPINGS = { "VixUiCheckbox": VixUiCheckbox, "VixUiRangeFloat": VixUiRangeFloat, "VixUiRangeScaleFloat": VixUiRangeScaleFloat, + "VixUiRangeInt": VixUiRangeInt, "VixUiList": VixUiList, "VixUiPrompt": VixUiPrompt, "VixUiCheckboxLogic": VixUiCheckboxLogic, @@ -254,6 +281,7 @@ NODE_DISPLAY_NAME_MAPPINGS = { "VixUiCheckbox": "VixUI-Checkbox", "VixUiRangeFloat": "VixUI-RangeFloat", "VixUiRangeScaleFloat": "VixUI-RangeScaleFloat", + "VixUiRangeInt": "VixUI-RangeInt", "VixUiList": "VixUI-List", "VixUiPrompt": "VixUI-Prompt", "VixUiCheckboxLogic": "VixUI-CheckboxLogic",