mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-06 01:37:45 +08:00
CURVE type (#12581)
* CURVE type * fix: update typed wrapper unwrap keys to __type__ and __value__ * code improve * code improve
This commit is contained in:
parent
f719a9d928
commit
b6ddc590ed
@ -1240,6 +1240,19 @@ class BoundingBox(ComfyTypeIO):
|
|||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
@comfytype(io_type="CURVE")
|
||||||
|
class Curve(ComfyTypeIO):
|
||||||
|
CurvePoint = tuple[float, float]
|
||||||
|
Type = list[CurvePoint]
|
||||||
|
|
||||||
|
class Input(WidgetInput):
|
||||||
|
def __init__(self, id: str, display_name: str=None, optional=False, tooltip: str=None,
|
||||||
|
socketless: bool=True, default: list[tuple[float, float]]=None, advanced: bool=None):
|
||||||
|
super().__init__(id, display_name, optional, tooltip, None, default, socketless, None, None, None, None, advanced)
|
||||||
|
if default is None:
|
||||||
|
self.default = [(0.0, 0.0), (1.0, 1.0)]
|
||||||
|
|
||||||
|
|
||||||
DYNAMIC_INPUT_LOOKUP: dict[str, Callable[[dict[str, Any], dict[str, Any], tuple[str, dict[str, Any]], str, list[str] | None], None]] = {}
|
DYNAMIC_INPUT_LOOKUP: dict[str, Callable[[dict[str, Any], dict[str, Any], tuple[str, dict[str, Any]], str, list[str] | None], None]] = {}
|
||||||
def register_dynamic_input_func(io_type: str, func: Callable[[dict[str, Any], dict[str, Any], tuple[str, dict[str, Any]], str, list[str] | None], None]):
|
def register_dynamic_input_func(io_type: str, func: Callable[[dict[str, Any], dict[str, Any], tuple[str, dict[str, Any]], str, list[str] | None], None]):
|
||||||
DYNAMIC_INPUT_LOOKUP[io_type] = func
|
DYNAMIC_INPUT_LOOKUP[io_type] = func
|
||||||
@ -2226,5 +2239,6 @@ __all__ = [
|
|||||||
"PriceBadgeDepends",
|
"PriceBadgeDepends",
|
||||||
"PriceBadge",
|
"PriceBadge",
|
||||||
"BoundingBox",
|
"BoundingBox",
|
||||||
|
"Curve",
|
||||||
"NodeReplace",
|
"NodeReplace",
|
||||||
]
|
]
|
||||||
|
|||||||
14
execution.py
14
execution.py
@ -876,12 +876,14 @@ async def validate_inputs(prompt_id, prompt, item, validated):
|
|||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
# Unwraps values wrapped in __value__ key. This is used to pass
|
# Unwraps values wrapped in __value__ key or typed wrapper.
|
||||||
# list widget value to execution, as by default list value is
|
# This is used to pass list widget values to execution,
|
||||||
# reserved to represent the connection between nodes.
|
# as by default list value is reserved to represent the
|
||||||
if isinstance(val, dict) and "__value__" in val:
|
# connection between nodes.
|
||||||
val = val["__value__"]
|
if isinstance(val, dict):
|
||||||
inputs[x] = val
|
if "__value__" in val:
|
||||||
|
val = val["__value__"]
|
||||||
|
inputs[x] = val
|
||||||
|
|
||||||
if input_type == "INT":
|
if input_type == "INT":
|
||||||
val = int(val)
|
val = int(val)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user