Added new nodes: Triple_Prompt, Embedding_Selector, Sampler_Settings, Image_Dimensions

This commit is contained in:
Aconex
2025-01-03 17:42:06 +01:00
parent f986e15bc6
commit 04a3ab197a
8 changed files with 221 additions and 3 deletions
+1 -1
View File
@@ -5,5 +5,5 @@ from ComfyUI_GOAT_Nodes.nodes.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAM
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
__version__ = '1.0.0'
__version__ = '1.1.0'
__author__ = 'Aconex'
+1 -1
View File
@@ -1,2 +1,2 @@
__version__ = '1.0.0'
__version__ = '1.1.0'
__author__ = 'Aconex'
+62
View File
@@ -0,0 +1,62 @@
from pathlib import Path
import folder_paths
class Embedding_Selector:
@classmethod
def INPUT_TYPES(s):
# Get the list of available embeddings
embeddings = folder_paths.get_filename_list("embeddings")
return {
"required": {
"embedding": ((embeddings),), # Dropdown for selecting embeddings
"strength": (
"FLOAT",
{
"default": 1.0,
"min": 0.0,
"max": 2.0,
"step": 0.05,
},
),
},
}
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("text",)
FUNCTION = "exec"
CATEGORY = '🐐 GOAT Nodes/Input'
DESCRIPTION = '''
Picks an embedding and returns it as a string with the chosen strength.
'''
def exec(self, embedding, strength):
# If emphasis is too low, return the original text
if strength < 0.05:
return ("",)
else:
# Extract the embedding name (without file extension)
embedding_name = Path(embedding).stem
# Format the embedding with strength if not 1.0
if strength != 1.0:
embedding_formatted = f"({embedding_name}:{strength:.3f})"
else:
embedding_formatted = embedding_name
# Combine the embedding and text
embedding_string = f"{embedding_formatted}, "
return (embedding_string,)
NODE_CLASS_MAPPINGS = {
"Embedding_Selector": Embedding_Selector
}
NODE_DISPLAY_NAME_MAPPINGS = {
"Embedding_Selector": "🐐 Embedding Selector"
}
+47
View File
@@ -0,0 +1,47 @@
class Image_Dimensions:
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"width": (
"INT",
{
"default": 1024,
"min": 64,
"max": 8192,
"step": 1,
},
),
"height": (
"INT",
{
"default": 1024,
"min": 64,
"max": 8192,
"step": 1,
},
),
},
}
RETURN_TYPES = ("INT", "INT",)
RETURN_NAMES = ("width", "height",)
FUNCTION = "exec"
CATEGORY = '🐐 GOAT Nodes/Input'
DESCRIPTION = '''
Allows selection or manual input of image dimensions (width and height). \n
Outputs the selected values.
'''
def exec(self, width, height):
return (width, height,)
NODE_CLASS_MAPPINGS = {
"Image_Dimensions": Image_Dimensions
}
NODE_DISPLAY_NAME_MAPPINGS = {
"Image_Dimensions": "🐐 Image Dimensions"
}
+12
View File
@@ -6,6 +6,10 @@ from ComfyUI_GOAT_Nodes.nodes.int_divide_rounded import Int_Divide_Rounded # typ
from ComfyUI_GOAT_Nodes.nodes.fast_film_grain import Fast_Film_Grain # type: ignore
from ComfyUI_GOAT_Nodes.nodes.advanced_upscale_image_using_model import Advanced_Upscale_Image_Using_Model # type: ignore
from ComfyUI_GOAT_Nodes.nodes.fast_color_match import Fast_Color_Match # type: ignore
from ComfyUI_GOAT_Nodes.nodes.triple_prompt import Triple_Prompt # type: ignore
from ComfyUI_GOAT_Nodes.nodes.embedding_selector import Embedding_Selector # type: ignore
from ComfyUI_GOAT_Nodes.nodes.sampler_settings import Sampler_Settings # type: ignore
from ComfyUI_GOAT_Nodes.nodes.image_dimensions import Image_Dimensions # type: ignore
NODE_CLASS_MAPPINGS = {
@@ -18,6 +22,10 @@ NODE_CLASS_MAPPINGS = {
"Fast_Film_Grain": Fast_Film_Grain,
"Advanced_Upscale_Image_Using_Model": Advanced_Upscale_Image_Using_Model,
"Fast_Color_Match": Fast_Color_Match,
"Triple_Prompt": Triple_Prompt,
"Embedding_Selector": Embedding_Selector,
"Sampler_Settings": Sampler_Settings,
"Image_Dimensions": Image_Dimensions,
}
@@ -31,4 +39,8 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"Fast_Film_Grain": "🐐 Fast Film Grain",
"Advanced_Upscale_Image_Using_Model": "🐐 Advanced Upscale Image (using Model)",
"Fast_Color_Match": "🐐 Fast Color Match",
"Triple_Prompt": "🐐 Triple Prompt",
"Embedding_Selector": "🐐 Embedding Selector",
"Sampler_Settings": "🐐 Sampler Settings",
"Image_Dimensions": "🐐 Image Dimensions",
}
+56
View File
@@ -0,0 +1,56 @@
class Sampler_Settings:
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"steps": (
"INT",
{
"default": 20,
"min": 0,
"max": 100,
"step": 1,
},
),
"cfg": (
"FLOAT",
{
"default": 4.0,
"min": 0.0,
"max": 100.0,
"step": 0.5,
},
),
"denoise": (
"FLOAT",
{
"default": 1.0,
"min": 0.0,
"max": 1.0,
"step": 0.01,
},
),
},
}
RETURN_TYPES = ("INT", "FLOAT", "FLOAT",)
RETURN_NAMES = ("steps", "cfg", "denoise",)
FUNCTION = "exec"
CATEGORY = '🐐 GOAT Nodes/Input'
DESCRIPTION = '''
Allows selection of sampler settings: steps, CFG, and denoise. \n
Outputs the selected values.
'''
def exec(self, steps, cfg, denoise):
return (steps, cfg, denoise,)
NODE_CLASS_MAPPINGS = {
"Sampler_Settings": Sampler_Settings
}
NODE_DISPLAY_NAME_MAPPINGS = {
"Sampler_Settings": "🐐 Sampler Settings"
}
+41
View File
@@ -0,0 +1,41 @@
class Triple_Prompt:
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"text1": ("STRING", {"default": "", "multiline": True}),
"text2": ("STRING", {"default": "", "multiline": True}),
"text3": ("STRING", {"default": "", "multiline": True}),
},
}
RETURN_TYPES = ("STRING", "STRING", "STRING", "STRING",)
RETURN_NAMES = ("text1", "text1", "text1", "concatenated_text",)
FUNCTION = "exec"
CATEGORY = '🐐 GOAT Nodes/Input'
DESCRIPTION = '''
Takes three text inputs and outputs them either separately or as a concatenated version with automatic comma separation handling.
'''
def exec(self, text1, text2, text3):
# Ensure each non-empty text ends with a comma if it doesn't already
if text1 and not text1.endswith(','):
text1 += ','
if text2 and not text2.endswith(','):
text2 += ','
if text3 and not text3.endswith(','):
text3 += ','
# Concatenate the texts, skipping empty ones
concatenated_text = ''.join([text for text in [text1, text2, text3] if text])
return (text1, text2, text3, concatenated_text,)
NODE_CLASS_MAPPINGS = {
"Triple_Prompt": Triple_Prompt
}
NODE_DISPLAY_NAME_MAPPINGS = {
"Triple_Prompt": "🐐 Triple Prompt"
}
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui_goat_nodes"
description = "Nodes to level up your workflows performance and streamline specific functions."
version = "1.0.0"
version = "1.1.0"
license = {file = "LICENSE"}
dependencies = []