diff --git a/__init__.py b/__init__.py index 4d30a5c..ca07963 100644 --- a/__init__.py +++ b/__init__.py @@ -10,6 +10,8 @@ NODE_CLASS_MAPPINGS = { "Endless Nodes Six Input Text Switch": EndlessNode_SixTextInputSwitch, "Endless Nodes Six Integer IO Switch": EndlessNode_SixIntIOSwitch, "Endless Nodes Six Integer IO Widget": EndlessNode_SixIntIOWidget, + "Endless Nodes Parameteriizer": EndlessNode_XLParameterizer, + "Endless Nodes Parameterizer & Prompts": EndlessNode_XLParameterizerPrompt, } __all__ = ['NODE_CLASS_MAPPINGS'] diff --git a/endless_nodes.py b/endless_nodes.py index 58c53e1..cf84b43 100644 --- a/endless_nodes.py +++ b/endless_nodes.py @@ -1,10 +1,15 @@ +""" +@author: Endless Sea of Stars +@title: Endless Nodes +@nickname: Endless Nodes +@description: A small set of nodes I created for various numerical and text inputs. +""" #-------------------------------------- # Endless Sea of Stars Custom Node Collection #https://github.com/tusharbhutt/Endless-Nodes # # - import torch import numpy as np import os @@ -71,12 +76,6 @@ class EndlessNode_SixTextInputSwitch: #-------------------------------------- ##Six Integer Input and Output via connectors -""" -@author: Endless Sea of Stars -@title: Endless-SixIntIO -@nickname: Endless -@description: Six Int Inputs and Output -""" class EndlessNode_SixIntIOSwitch: def __init__(self): @@ -151,7 +150,70 @@ class EndlessNode_SixIntIOWidget: def six_int_widget(self,int1,int2,int3,int4,int5,int6): return(int1,int2,int3,int4,int5,int6) +#Text Encode Combo Box +class EndlessNode_XLParameterizerPrompt: + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "base_width": ("INT", {"default": 1024, "min": 64, "max": 8192, "step": 16}), + "base_height": ("INT", {"default": 1024, "min": 64, "max": 8192, "step": 16}), + "base_crop_w": ("INT", {"default": 0, "min": 0, "max": 1024, "step": 8}), + "base_crop_h": ("INT", {"default": 0, "min": 0, "max": 1024, "step": 8}), + "base_target_w": ("INT", {"default": 1024, "min": 64, "max": 8192, "step": 16}), + "base_target_h": ("INT", {"default": 1024, "min": 64, "max": 8192, "step": 16}), + "refiner_width": ("INT", {"default": 1024, "min": 64, "max": 8192, "step": 16}), + "refiner_height": ("INT", {"default": 1024, "min": 64, "max": 8192, "step": 16}), + "refiner_ascore": ("FLOAT", {"default": 6, "min": 0, "max": 0xffffffffffffffff}), + }, + "optional": { + "endless_text_g": ("STRING", {"default": "Main Prompt", "multiline": True}), + "endless_text_l": ("STRING", {"default": "Supporting Words", "multiline": True}), + } + } + RETURN_TYPES = ("INT","INT","INT","INT","INT","INT","INT","INT","FLOAT","STRING","STRING",) + RETURN_NAMES = ("Base Width","Base Height","Base Cropped Width","Base Cropped Height","Base Target Width","Base Target Height","Refiner Width","Refiner Height","Refiner Aesthetic Score","Base/Refiner Main Prompt","Base Support Prompt",) + FUNCTION = "ParameterizerPrompt" + + CATEGORY="Endless" + + + def ParameterizerPrompt(self,base_width,base_height,base_crop_w,base_crop_h,base_target_w,base_target_h,refiner_width,refiner_height,refiner_ascore,endless_text_g,endless_text_1): + return(base_width,base_height,base_crop_w,base_crop_h,base_target_w,base_target_h,refiner_width,refiner_height,refiner_ascore,endless_text_g,endless_text_1) + +class EndlessNode_XLParameterizer: + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "base_width": ("INT", {"default": 1024, "min": 64, "max": 8192, "step": 16}), + "base_height": ("INT", {"default": 1024, "min": 64, "max": 8192, "step": 16}), + "base_crop_w": ("INT", {"default": 0, "min": 0, "max": 8192, "step": 16}), + "base_crop_h": ("INT", {"default": 0, "min": 0, "max": 8192, "step": 16}), + "base_target_w": ("INT", {"default": 1024, "min": 64, "max": 8192, "step": 16}), + "base_target_h": ("INT", {"default": 1024, "min": 64, "max": 8192, "step": 16}), + "refiner_width": ("INT", {"default": 1024, "min": 64, "max": 8192, "step": 16}), + "refiner_height": ("INT", {"default": 1024, "min": 64, "max": 8192, "step": 16}), + "refiner_ascore": ("FLOAT", {"default": 6, "min": 0, "max": 0xffffffffffffffff}), + } + } + RETURN_TYPES = ("INT","INT","INT","INT","INT","INT","INT","INT","FLOAT",) + RETURN_NAMES = ("Base Width","Base Height","Base Cropped Width","Base Cropped Height","Base Target Width","Base Target Height","Refiner Width","Refiner Height","Refiner Aesthetic Score",) + FUNCTION = "Parameterizer" + + CATEGORY="Endless" + + + def Parameterizer(self,base_width,base_height,base_crop_w,base_crop_h,base_target_w,base_target_h,refiner_width,refiner_height,refiner_ascore): + return(base_width,base_height,base_crop_w,base_crop_h,base_target_w,base_target_h,refiner_width,refiner_height,refiner_ascore) + # FUTURE NODE IDEAS @@ -172,6 +234,4 @@ class EndlessNode_SixIntIOWidget: # # ComfyUI Interface for the basic ideas of what nodes I wanted # -# https://github.com/comfyanonymous/ComfyUI - - +# https://github.com/comfyanonymous/ComfyUI \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..4fc1792 --- /dev/null +++ b/readme.md @@ -0,0 +1,55 @@ +# Endless-Nodes +Some basic custom nodes for the ComfyUI user interface for Stable Diffusion. + +When using the [ComfyUI](https://github.com/comfyanonymous/ComfyUI) interface for [Stable Diffusion](https://github.com/Stability-AI/stablediffusion), I sometimes find that the standard nodes and the many, many, many custom nodes out there don't work the way I want them to, or how I think they do. + +Rightly or wrongly, I am pretending to teach myself a bit of Python to get some nodes up and running to do what I'd like. There are no promises that these nodes will work for you or that I will maintain them. Feel free to do with them as you wish, according to the license model. + +## Install + +Navigate to your /ComfyUI/custom_nodes/ folder + +In Windows, you can then right-click to start a command prompt and type: + +`git clone https://github.com/tusharbhutt/Endless-Nodes` + +## Node List + +### Six Text Input Switch +Allows the user to select between six text inputs and uses a slider to make the selection. Useful for multiple inputs for prompt creation + + +![sixtext](./img/sixtext.png) + + +### Six Integer Input to Six Integer Output +I've seen a fair number of 3-, 4-, or more way text input and outputs, I wanted to do something for numbers as well. Use it as you wish. + +![sixintconnect](./img/sixintconnect.png) + +### Six Integer Widget +As above, but with widgets for entry instead of connectors + +![sixintwidget](./img/sixintwidget.png) + +## Usage License and Restrictions + +See GPL Licensing V3 for usage. You may modify this code as long as you keep the credits for this repository and for those noted in the credit section below. **YOU ARE EXPRESSLY FORBIDDEN FROM USING THIS NODE TO CREATE ANY IMAGES OR ARTWORK THAT VIOLATES THE STABLE DIFFUSION USAGE NOTES [HERE](https://huggingface.co/stabilityai/stable-diffusion-2#misuse-malicious-use-and-out-of-scope-use) AND [HERE](https://huggingface.co/stabilityai/stable-diffusion-2#misuse-and-malicious-use).** + +For example, don't be a mouth-breathing dick who creates fake celebrity nudes or sexual content of **anyone, even** if you have their consent + +The author expressly disclaims any liability for any images you create using these nodes. + +## Disclaimer + +These nodes may or may not be maintained. They work on my system, but may not on yours. + +## Credits + +[Comfyroll Custom Nodes](https://github.com/RockOfFire/ComfyUI_Comfyroll_CustomNode) for the overall node code layout, coding snippets, and inspiration for the text input and number switches + + + [WLSH Nodes](https://github.com/wallish77/wlsh_nodes) for some coding for the Integer Widget + + +[ComfyUI](https://github.com/comfyanonymous/ComfyUI) Interface for the basic ideas of what nodes I wanted