From f8863c5cb2c57299b346e3d6a9b0b647f4936389 Mon Sep 17 00:00:00 2001 From: Filipe Date: Tue, 4 Apr 2023 19:06:33 -0300 Subject: [PATCH 1/2] Add TextWildcards --- TextWildcards.py | 33 +++++++++++++++++++++++++++++++++ __init__.py | 1 + 2 files changed, 34 insertions(+) create mode 100644 TextWildcards.py diff --git a/TextWildcards.py b/TextWildcards.py new file mode 100644 index 0000000..f941a93 --- /dev/null +++ b/TextWildcards.py @@ -0,0 +1,33 @@ +import os, glob, sys +import random +import re +import os +if __name__ == os.path.splitext(os.path.basename(__file__))[0] or __name__ =='__main__': + from ConsoleColor import print, console + from wildcards import wildcards +else: + from .ConsoleColor import print, console + from .wildcards import wildcards + + +class TextWildcards: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "text": ("STRING", {"multiline": True}), + "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}), + + } + } + RETURN_TYPES = ("STRING",) + FUNCTION = "encode" + + CATEGORY = "utils" + + def encode(self, seed, text): + random.seed(seed) + print(f"[green]text : [/green]",text) + r=wildcards.run(text) + print(f"[green]result : [/green]",r) + return ([r], ) \ No newline at end of file diff --git a/__init__.py b/__init__.py index f292f5e..657078c 100644 --- a/__init__.py +++ b/__init__.py @@ -70,6 +70,7 @@ if not md.startswith("custom_nodes."): add("VAELoaderDecode") add("SimpleSampler",["SimpleSampler","SimpleSamplerVAE"]) add("SaveImageSimple") + add("TextWildcards") #add("test") console.rule(" init end ", style="bold green") \ No newline at end of file From 1e7442625b543648915ab400226c6080270be7ba Mon Sep 17 00:00:00 2001 From: Filipe Date: Tue, 4 Apr 2023 19:26:02 -0300 Subject: [PATCH 2/2] Add suport for WAS text utils nodes --- TextWildcards.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TextWildcards.py b/TextWildcards.py index f941a93..18a4ef7 100644 --- a/TextWildcards.py +++ b/TextWildcards.py @@ -20,7 +20,7 @@ class TextWildcards: } } - RETURN_TYPES = ("STRING",) + RETURN_TYPES = ("STRING","ASCII") FUNCTION = "encode" CATEGORY = "utils" @@ -30,4 +30,4 @@ class TextWildcards: print(f"[green]text : [/green]",text) r=wildcards.run(text) print(f"[green]result : [/green]",r) - return ([r], ) \ No newline at end of file + return ([r, r], ) \ No newline at end of file