Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit fb88973

Browse files
authored
Merge pull request #3 from pamparamm/master
Fix #2 and add more primitive nodes
2 parents a2209b0 + 80fdc16 commit fb88973

File tree

2 files changed

+54
-4
lines changed

2 files changed

+54
-4
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This repository contains an extension to [ComfyUI](https://github.com/comfyanonymous/ComfyUI) that introduces logic nodes and conditional rendering capabilities:
44
- If
55
- Compare
6-
- Int, String
6+
- Int, String, Float, Bool
77

88
![image](https://github.com/theUpsider/ComfyUI-Logic/assets/25013640/7807b2a4-989d-4021-9572-1d2d13725304)
99
> **_NOTE:_** This extension is still in development and may contain bugs. Please report any issues you encounter. New features are in development!
@@ -15,7 +15,7 @@ This repository contains an extension to [ComfyUI](https://github.com/comfyanony
1515
## Features
1616

1717
- **Comparison Nodes**: Compare two values using various comparison operators.
18-
- **Data Type Nodes**: Convert and handle `Int` and `String` data types.
18+
- **Data Type Nodes**: Convert and handle `Int`, `String`, `Float` and `Bool` data types.
1919
- **Conditional Execution**: Execute different nodes based on a boolean condition.
2020
- **Debugging**: Print any input to the console for debugging purposes.
2121

@@ -40,6 +40,14 @@ Accepts an integer value and returns it.
4040

4141
Accepts a string value and returns it.
4242

43+
### Float
44+
45+
Accepts a float value and returns it.
46+
47+
### Bool
48+
49+
Accepts a boolean value and returns it.
50+
4351
### If
4452

4553
Executes the `IF_TRUE` node if the `ANY` input is `True`, otherwise it executes the `IF_FALSE` node.

nodes.py

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def INPUT_TYPES(s):
3232
CATEGORY = "Logic"
3333

3434
def execute(self, value):
35-
return value
35+
return (value,)
3636

3737

3838
class Int:
@@ -51,7 +51,45 @@ def INPUT_TYPES(s):
5151
CATEGORY = "Logic"
5252

5353
def execute(self, value):
54-
return value
54+
return (value,)
55+
56+
57+
class Float:
58+
@classmethod
59+
def INPUT_TYPES(s):
60+
return {
61+
"required": {"value": ("FLOAT", {"default": 0, "step": 0.01})},
62+
}
63+
64+
RETURN_TYPES = ("FLOAT",)
65+
66+
RETURN_NAMES = ("FLOAT",)
67+
68+
FUNCTION = "execute"
69+
70+
CATEGORY = "Logic"
71+
72+
def execute(self, value):
73+
return (value,)
74+
75+
76+
class Bool:
77+
@classmethod
78+
def INPUT_TYPES(s):
79+
return {
80+
"required": {"value": ("BOOLEAN", {"default": False})},
81+
}
82+
83+
RETURN_TYPES = ("BOOLEAN",)
84+
85+
RETURN_NAMES = ("BOOLEAN",)
86+
87+
FUNCTION = "execute"
88+
89+
CATEGORY = "Logic"
90+
91+
def execute(self, value):
92+
return (value,)
5593

5694

5795
class Compare:
@@ -156,6 +194,8 @@ def log_input(self, ANY):
156194
NODE_CLASS_MAPPINGS = {
157195
"Compare": Compare,
158196
"Int": Int,
197+
"Float": Float,
198+
"Bool": Bool,
159199
"String": String,
160200
"If ANY execute A else B": IfExecute,
161201
"DebugPrint": DebugPrint,
@@ -165,6 +205,8 @@ def log_input(self, ANY):
165205
NODE_DISPLAY_NAME_MAPPINGS = {
166206
"Compare": "Compare",
167207
"Int": "Int",
208+
"Float": "Float",
209+
"Bool": "Bool",
168210
"String": "String",
169211
"If ANY execute A else B": "If",
170212
"DebugPrint": "DebugPrint",

0 commit comments

Comments
 (0)