mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-28 23:30:16 +08:00
Merge branch 'comfyanonymous:master' into master
This commit is contained in:
commit
e658527c7f
79
comfy_extras/nodes_primitive.py
Normal file
79
comfy_extras/nodes_primitive.py
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
# Primitive nodes that are evaluated at backend.
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, IO
|
||||||
|
|
||||||
|
|
||||||
|
class String(ComfyNodeABC):
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(cls) -> InputTypeDict:
|
||||||
|
return {
|
||||||
|
"required": {"value": (IO.STRING, {})},
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN_TYPES = (IO.STRING,)
|
||||||
|
FUNCTION = "execute"
|
||||||
|
CATEGORY = "utils/primitive"
|
||||||
|
|
||||||
|
def execute(self, value: str) -> tuple[str]:
|
||||||
|
return (value,)
|
||||||
|
|
||||||
|
|
||||||
|
class Int(ComfyNodeABC):
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(cls) -> InputTypeDict:
|
||||||
|
return {
|
||||||
|
"required": {"value": (IO.INT, {"control_after_generate": True})},
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN_TYPES = (IO.INT,)
|
||||||
|
FUNCTION = "execute"
|
||||||
|
CATEGORY = "utils/primitive"
|
||||||
|
|
||||||
|
def execute(self, value: int) -> tuple[int]:
|
||||||
|
return (value,)
|
||||||
|
|
||||||
|
|
||||||
|
class Float(ComfyNodeABC):
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(cls) -> InputTypeDict:
|
||||||
|
return {
|
||||||
|
"required": {"value": (IO.FLOAT, {})},
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN_TYPES = (IO.FLOAT,)
|
||||||
|
FUNCTION = "execute"
|
||||||
|
CATEGORY = "utils/primitive"
|
||||||
|
|
||||||
|
def execute(self, value: float) -> tuple[float]:
|
||||||
|
return (value,)
|
||||||
|
|
||||||
|
|
||||||
|
class Boolean(ComfyNodeABC):
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(cls) -> InputTypeDict:
|
||||||
|
return {
|
||||||
|
"required": {"value": (IO.BOOLEAN, {})},
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN_TYPES = (IO.BOOLEAN,)
|
||||||
|
FUNCTION = "execute"
|
||||||
|
CATEGORY = "utils/primitive"
|
||||||
|
|
||||||
|
def execute(self, value: bool) -> tuple[bool]:
|
||||||
|
return (value,)
|
||||||
|
|
||||||
|
|
||||||
|
NODE_CLASS_MAPPINGS = {
|
||||||
|
"PrimitiveString": String,
|
||||||
|
"PrimitiveInt": Int,
|
||||||
|
"PrimitiveFloat": Float,
|
||||||
|
"PrimitiveBoolean": Boolean,
|
||||||
|
}
|
||||||
|
|
||||||
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||||
|
"PrimitiveString": "String",
|
||||||
|
"PrimitiveInt": "Int",
|
||||||
|
"PrimitiveFloat": "Float",
|
||||||
|
"PrimitiveBoolean": "Boolean",
|
||||||
|
}
|
||||||
1
nodes.py
1
nodes.py
@ -2265,6 +2265,7 @@ def init_builtin_extra_nodes():
|
|||||||
"nodes_lumina2.py",
|
"nodes_lumina2.py",
|
||||||
"nodes_wan.py",
|
"nodes_wan.py",
|
||||||
"nodes_hunyuan3d.py",
|
"nodes_hunyuan3d.py",
|
||||||
|
"nodes_primitive.py",
|
||||||
]
|
]
|
||||||
|
|
||||||
import_failed = []
|
import_failed = []
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
comfyui-frontend-package==1.12.14
|
comfyui-frontend-package==1.13.9
|
||||||
torch
|
torch
|
||||||
torchsde
|
torchsde
|
||||||
torchvision
|
torchvision
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user