Skip to content

Commit c5b925f

Browse files
committed
added the BooleanControlOutput node.
1 parent c2df6b5 commit c5b925f

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ This node adjusts the text to describe the gender based on the input. If the gen
4242
## GenderControlOutput
4343
This node determines the output based on the input gender. If the gender input is 'M', it will output male-specific text, float, and integer values. If the gender input is 'F', it will output female-specific text, float, and integer values.
4444

45+
## BooleanControlOutput
46+
This node outputs different values based on a boolean input. If the boolean input is True, it will output the values of true_text, true_float, true_int, True, and False. If the boolean input is False, it will output the values of false_text, false_float, false_int, False, and True.
47+
4548
## SplitMask
4649
This node splits one mask into two masks of the same size according to the area of the submasks. If there are more than two areas, it will select the two largest submasks.
4750

@@ -59,12 +62,18 @@ Check the three input masks. If any are available, return the first. If none are
5962
## MaskCoverFourCorners
6063
Generates a mask by covering the selected corners with circular edges. This mask can be used as an attention mask to remove watermarks from the corners.
6164

65+
## MaskofCenter
66+
Generates a mask by covering the center of the image with a circular edge. This mask can be used as an attention mask, then model can focus on the center of the image.
67+
6268
## CheckpointLoaderSimpleWithSwitch
6369
Enhanced the official LoadCheckpoint node by integrating three switches. Each switch controls whether a specific component is loaded. When a switch is turned off, the corresponding component will not be loaded. if you use the extra vae and close the model's vae loading, that will save memory.
6470

6571
## ImageResizeTo8x
6672
Modified the [image-resize-comfyui](https://github.com/palant/image-resize-comfyui) image resize node by adding logic to crop the resulting image size to 8 times size, similar to the VAE encode node. This avoids pixel differences when pasting back by the ImageCompositeMasked node.
6773

74+
## ImageAutoSelector
75+
This node is designed to automatically select the image from the input. If the prior image is not empty, return the prior image; otherwise, return the alternative image or the third image.
76+
6877
## TextPreview
6978
Added the node for convenience. The code is originally from ComfyUI-Custom-Scripts, thanks.
7079

py/nodes.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,37 @@ def select_image(self, image_prior=None, image_alternative=None, image_third=Non
13491349

13501350
return (image,)
13511351

1352+
class BooleanControlOutput:
1353+
"""
1354+
This node will output different values based on a boolean input
1355+
"""
1356+
@classmethod
1357+
def INPUT_TYPES(cls):
1358+
return {"required": {
1359+
"boolean_input": ("BOOLEAN", {"default": True, "label_on": "True", "label_off": "False"}),
1360+
"true_text": ("STRING", {"multiline": True, "defaultBehavior": "input"}),
1361+
"true_float": ("FLOAT", {"default": 1, "step": 0.05}),
1362+
"true_int": ("INT", {"default": 1, "step": 1}),
1363+
"false_text": ("STRING", {"multiline": True, "defaultBehavior": "input"}),
1364+
"false_float": ("FLOAT", {"default": 0, "step": 0.1}),
1365+
"false_int": ("INT", {"default": 0, "step": 1}),
1366+
}}
1367+
1368+
RETURN_TYPES = ("STRING", "FLOAT", "INT", "BOOLEAN", "BOOLEAN")
1369+
RETURN_NAMES = ("text", "float", "int", "is_true", "is_false")
1370+
FUNCTION = "fun"
1371+
CATEGORY = "utils/text"
1372+
1373+
@staticmethod
1374+
def fun(boolean_input, true_text, true_float, true_int, false_text, false_float, false_int):
1375+
if boolean_input:
1376+
return (true_text, true_float, true_int, True, False)
1377+
else:
1378+
return (false_text, false_float, false_int, False, True)
1379+
1380+
13521381
NODE_CLASS_MAPPINGS = {
1382+
13531383
#image
13541384
"LoadImageWithSwitch": LoadImageWithSwitch,
13551385
"LoadImageMaskWithSwitch": LoadImageMaskWithSwitch,
@@ -1369,6 +1399,7 @@ def select_image(self, image_prior=None, image_alternative=None, image_third=Non
13691399
"GenderControlOutput": GenderControlOutput,
13701400
"TextPreview": TextPreview,
13711401
"TextInputAutoSelector": TextInputAutoSelector,
1402+
"BooleanControlOutput": BooleanControlOutput,
13721403

13731404
# numbers
13741405
"MatchImageRatioToPreset": MatchImageRatioToPreset,
@@ -1408,6 +1439,7 @@ def select_image(self, image_prior=None, image_alternative=None, image_third=Non
14081439
"GenderControlOutput": "Gender Control Output",
14091440
"TextPreview": "Preview Text",
14101441
"TextInputAutoSelector": "Text Input Auto Selector",
1442+
"BooleanControlOutput": "Boolean Control Output",
14111443

14121444
# Number
14131445
"MatchImageRatioToPreset": "Match Image Ratio to Standard Size",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "comfyui-utils-nodes"
33
description = "Nodes:LoadImageWithSwitch, ImageBatchOneOrMore, ModifyTextGender, GenderControlOutput, ImageCompositeMaskedWithSwitch, ImageCompositeMaskedOneByOne, ColorCorrectOfUtils, SplitMask, MaskFastGrow, CheckpointLoaderSimpleWithSwitch, ImageResizeTo8x, MatchImageRatioToPreset, UpscaleImageWithModelIfNeed, MaskFromFaceModel, MaskCoverFourCorners, DetectorForNSFW, DeepfaceAnalyzeFaceAttributes etc."
4-
version = "1.2.1"
4+
version = "1.2.2"
55
license = { file = "LICENSE" }
66
dependencies = []
77

0 commit comments

Comments
 (0)