From 4f02c591c7fa708f3238c6671d40171168697393 Mon Sep 17 00:00:00 2001 From: evanspearman Date: Mon, 2 Sep 2024 10:47:19 -0500 Subject: [PATCH] fix!: Fixed floats being rounded automatically and increased step to 0.001 (#7) --- __init__.py | 2 -- src/comfymath/convert.py | 10 +++++----- src/comfymath/float.py | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/__init__.py b/__init__.py index 0888cb3..5d66825 100644 --- a/__init__.py +++ b/__init__.py @@ -8,8 +8,6 @@ from .src.comfymath.control import NODE_CLASS_MAPPINGS as control_NCM from .src.comfymath.graphics import NODE_CLASS_MAPPINGS as graphics_NCM - - NODE_CLASS_MAPPINGS = { **convert_NCM, **bool_NCM, diff --git a/src/comfymath/convert.py b/src/comfymath/convert.py index 25ddf84..f5db68b 100644 --- a/src/comfymath/convert.py +++ b/src/comfymath/convert.py @@ -33,7 +33,7 @@ class IntToBool: class FloatToInt: @classmethod def INPUT_TYPES(cls) -> Mapping[str, Any]: - return {"required": {"a": ("FLOAT", {"default": 0.0})}} + return {"required": {"a": ("FLOAT", {"default": 0.0, "round": False})}} RETURN_TYPES = ("INT",) FUNCTION = "op" @@ -85,7 +85,7 @@ class NumberToInt: class FloatToNumber: @classmethod def INPUT_TYPES(cls) -> Mapping[str, Any]: - return {"required": {"a": ("FLOAT", {"default": 0.0})}} + return {"required": {"a": ("FLOAT", {"default": 0.0, "round": False})}} RETURN_TYPES = ("NUMBER",) FUNCTION = "op" @@ -113,8 +113,8 @@ class ComposeVec2: def INPUT_TYPES(cls) -> Mapping[str, Any]: return { "required": { - "x": ("FLOAT", {"default": 0.0}), - "y": ("FLOAT", {"default": 0.0}), + "x": ("FLOAT", {"default": 0.0, "round": False}), + "y": ("FLOAT", {"default": 0.0, "round": False}), } } @@ -131,7 +131,7 @@ class FillVec2: def INPUT_TYPES(cls) -> Mapping[str, Any]: return { "required": { - "a": ("FLOAT", {"default": 0.0}), + "a": ("FLOAT", {"default": 0.0, "round": False}), } } diff --git a/src/comfymath/float.py b/src/comfymath/float.py index 0e74b33..86a6eca 100644 --- a/src/comfymath/float.py +++ b/src/comfymath/float.py @@ -2,7 +2,7 @@ import math from typing import Any, Callable, Mapping -DEFAULT_FLOAT = ("FLOAT", {"default": 0.0}) +DEFAULT_FLOAT = ("FLOAT", {"default": 0.0, "step": 0.001, "round": False}) FLOAT_UNARY_OPERATIONS: Mapping[str, Callable[[float], float]] = { "Neg": lambda a: -a,