diff --git a/__init__.py b/__init__.py index 0a739662..4ae1c465 100644 --- a/__init__.py +++ b/__init__.py @@ -557,7 +557,7 @@ def new_add_routes(self): from .nodes.Clipseg import CLIPSeg,CombineMasks from .nodes.ChatGPT import ChatGPTNode,ShowTextForGPT,CharacterInText from .nodes.Audio import GamePal,SpeechRecognition,SpeechSynthesis -from .nodes.Utils import TESTNODE_,AppInfo,IntNumber,FloatSlider,TextInput,ColorInput,FontInput,TextToNumber,DynamicDelayProcessor,LimitNumber,SwitchByIndex,MultiplicationNode +from .nodes.Utils import CreateSeedNode,TESTNODE_,AppInfo,IntNumber,FloatSlider,TextInput,ColorInput,FontInput,TextToNumber,DynamicDelayProcessor,LimitNumber,SwitchByIndex,MultiplicationNode from .nodes.Mask import OutlineMask,FeatheredMask @@ -617,7 +617,8 @@ def new_add_routes(self): "SwitchByIndex":SwitchByIndex, "LimitNumber":LimitNumber, "OutlineMask":OutlineMask, - "JoinWithDelimiter":JoinWithDelimiter + "JoinWithDelimiter":JoinWithDelimiter, + "Seed_":CreateSeedNode # "LaMaInpainting":LaMaInpainting # "GamePal":GamePal } diff --git a/nodes/ImageNode.py b/nodes/ImageNode.py index bc899fc3..7e0e8f78 100644 --- a/nodes/ImageNode.py +++ b/nodes/ImageNode.py @@ -13,7 +13,13 @@ import math from .Watcher import FolderWatcher +class AnyType(str): + """A special class that is always equal in not equal comparisons. Credit to pythongosssss""" + def __ne__(self, __value: object) -> bool: + return False + +any_type = AnyType("*") FONT_PATH= os.path.abspath(os.path.join(os.path.dirname(__file__),'../assets/王汉宗颜楷体繁.ttf')) @@ -1250,6 +1256,9 @@ def INPUT_TYPES(s): return {"required": { "url": ("STRING",{"multiline": True,"default": "https://","dynamicPrompts": False}), }, + "optional":{ + "seed": (any_type, {"default": 0, "min": 0, "max": 0xffffffffffffffff}), + } } RETURN_TYPES = ("IMAGE","MASK",) @@ -1266,7 +1275,7 @@ def INPUT_TYPES(s): global urls_image urls_image={} - def run(self,url): + def run(self,url,seed=0): global urls_image print(urls_image) def filter_http_urls(urls): diff --git a/nodes/Utils.py b/nodes/Utils.py index 52bd6cca..a6ebf8d2 100644 --- a/nodes/Utils.py +++ b/nodes/Utils.py @@ -712,3 +712,28 @@ def run(self,ANY): result = list_stats.count_types(ANY) return {"ui": {"data": result,"type":[str(type(ANY[0]))]}, "result": (ANY,)} + + + +class CreateSeedNode: + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}), + } + } + + RETURN_TYPES = ("INT",) + RETURN_NAMES = ("seed",) + + OUTPUT_NODE = True + FUNCTION = "run" + + CATEGORY = "♾️Mixlab/Utils" + + def run(self, seed): + return (seed,) \ No newline at end of file