Add files via upload
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 GTSuya Studio
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 GTSuya Studio
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# ComfyUI-GTSuya-Nodes
|
||||
|
||||
A set of custom nodes for ComfyUI - focused on wildcards utilities
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from .gtsuya_nodes import *
|
||||
|
||||
# A dictionary that contains all nodes you want to export with their names
|
||||
# NOTE: names should be globally unique
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"Simple Wildcards": SimpleWildcards,
|
||||
}
|
||||
|
||||
__all__ = ['NODE_CLASS_MAPPINGS']
|
||||
|
||||
THIS_DIR=os.path.dirname(os.path.abspath(__file__))
|
||||
DIR_PY=os.path.abspath(f'{THIS_DIR}/py')
|
||||
DIR_WEB_JS=os.path.abspath(f'{THIS_DIR}/../../web/extensions/gtsuya_nodes')
|
||||
|
||||
print("gtsuya_nodes loading")
|
||||
@@ -0,0 +1,63 @@
|
||||
import nodes
|
||||
import os
|
||||
import shutil
|
||||
import glob
|
||||
import re
|
||||
import random
|
||||
|
||||
"""
|
||||
|
||||
A set of custom nodes for ComfyUI - focused on wildcards utilities
|
||||
By GTSuya Studio
|
||||
|
||||
Copyright (c) 2023
|
||||
|
||||
"""
|
||||
|
||||
MANIFEST = {
|
||||
"name": "GTSuyaNodes",
|
||||
"version": (0,0,1),
|
||||
"author": "GTSuya Studio",
|
||||
"project": "",
|
||||
"description": " A set of custom nodes for ComfyUI - focused on wildcards utilities",
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
||||
|
||||
class SimpleWildcards:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"text": ("STRING", {"multiline": True}),
|
||||
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("text",)
|
||||
FUNCTION = "get_text"
|
||||
CATEGORY = "gtsuya/wildcards"
|
||||
|
||||
def get_text(self, text, seed):
|
||||
wildcards_path = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))+'\\wildcards'
|
||||
wildcards = re.findall('__(.*?)__', text)
|
||||
for wildcard in wildcards :
|
||||
if os.path.isfile(wildcards_path+'\\'+wildcard+'.txt'):
|
||||
lines = open(wildcards_path+'\\'+wildcard+'.txt').read().splitlines()
|
||||
print(lines)
|
||||
if not lines:
|
||||
myline = ""
|
||||
else:
|
||||
myline = random.choice(lines).lower()
|
||||
print(myline)
|
||||
text = text.replace('__'+wildcard+'__',myline)
|
||||
|
||||
return (text,seed)
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
||||
|
||||
# A dictionary that contains the friendly/humanly readable titles for the nodes
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"SimpleWildcards": "Simple Wildcards",
|
||||
}
|
||||
Reference in New Issue
Block a user