Skip to content

Commit

Permalink
fix!: Fixed floats being rounded automatically and increased step to …
Browse files Browse the repository at this point in the history
…0.001 (#7)
  • Loading branch information
evanspearman authored Sep 2, 2024
1 parent be9beab commit 4f02c59
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 0 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from .src.comfymath.graphics import NODE_CLASS_MAPPINGS as graphics_NCM




NODE_CLASS_MAPPINGS = {
**convert_NCM,
**bool_NCM,
Expand Down
10 changes: 5 additions & 5 deletions src/comfymath/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def op(self, a: int) -> tuple[bool]:
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"
Expand Down Expand Up @@ -85,7 +85,7 @@ def op(self, a: number) -> tuple[int]:
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"
Expand Down Expand Up @@ -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}),
}
}

Expand All @@ -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}),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/comfymath/float.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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,
Expand Down

0 comments on commit 4f02c59

Please sign in to comment.