-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is no ComfyUI_NAI-mod node #1
Comments
i've had to disable this node because it kept doing that making my workflosws slower every time as it stacks. in the custom node folder, there is a folder named CSV which has these files in them but it's not reading these files for me so it's basically useless for me sadly. needs to be patched. my issue is that it's not reading my new directory and not looking for these files where it's installed opposed to some arbitrary fixed position potentially. |
ComfyUI-Universal-Styler/naistyler_nodes.py Line 151 in cb64097
the path is coded with windows backslash, if you are running it on linux, it will go error. ComfyUI-Universal-Styler/naistyler_nodes.py Line 106 in cb64097
and the hardcoded path on error message is not the same as actual seeking file path. |
Solution found on reddit in post: ---------------QUOTE:----------------------- Modify "ComfyUI-NAI-styler" in "naistyler_nodes.py" to "ComfyUI-Universal-Styler" Search and replace... should be 4 entries restart comfyui - solved ;-) |
thanks, i did the same but my folder name was "ComfyUI-Universal-Styler" instead of "ComfyUI_NAI-mod" |
I had to clone and rename whole folder "ComfyUI-Universal-Styler" to "ComfyUI-NAI-styler" |
Instead of copying the folder you can make a link to it from the command prompt to fool windows 10/11 into thinking there is a duplicate. Open cmd at that location and type this: mklink /j ComfyUI-NAI-styler ComfyUI-Universal-Styler That is the windows equivalent of the Linux/Mac version of symlinks: ln -s ComfyUI-Universal-Styler ComfyUI-NAI-styler |
Ha, you are right. I am using Junctions occasionally, but it didn't come to my mind in this case. Thanks! |
This worked for me, thank you!! |
Hi guys, nice to see you get it fixed.. i am actualy working on a ew custom node package, and this specific node will be included with some major update. thanks |
This was huge. Thank you, solved the problem instantly. |
Hi guys i'm answering now because i found out about it only recently, but you DONT NEED this. i don't know why comfyui when you are missing the nodes gives you an error that you are missing this copied repo instead of the original ComfyUI-Custom-Scripts to sum everything up, you don't need either ComfyUI-Universal-Styler nor ComfyUI-NAI-styler, uninstall them, and install ComfyUI-Custom-Scripts and there you have it. every node that needed ComfyUI-Universal-Styler now works without any problem. pythongosssss/ComfyUI-Custom-Scripts#338 (i'm trying my best to edit the message without putting too much hate speech) |
Thank you so much dude!! |
Here is fix all the paths and class names were jumbled. Replace the code in naistyler_nodes.py with the one below. import os
import re
import folder_paths
from pathlib import Path
# DEBUG pathlib (to replace folder_path from OS)
print(Path.cwd())
print("############################################")
BASE_DIR = Path.cwd()
DATAPATH = BASE_DIR.joinpath("custom_nodes", "ComfyUI-Universal-Styler", "CSV")
print(DATAPATH)
print("############################################")
my_database = [str(file) for file in DATAPATH.glob("*.csv")]
print(my_database)
print("############################################")
################
# Show Text v0.3 ##########################################################################
################
class ShowText:
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"text": ("STRING", {"forceInput": True}),
},
"hidden": {
"unique_id": "UNIQUE_ID",
"extra_pnginfo": "EXTRA_PNGINFO",
},
}
INPUT_IS_LIST = True
RETURN_TYPES = ("STRING",)
FUNCTION = "notify"
OUTPUT_NODE = True
OUTPUT_IS_LIST = (True,)
CATEGORY = "✴️ Universal NAI Nodes"
def notify(self, text, unique_id=None, extra_pnginfo=None):
if unique_id is not None and extra_pnginfo is not None:
if not isinstance(extra_pnginfo, list):
print("Error: extra_pnginfo is not a list")
elif (
not isinstance(extra_pnginfo[0], dict)
or "workflow" not in extra_pnginfo[0]
):
print("Error: extra_pnginfo[0] is not a dict or missing 'workflow' key")
else:
workflow = extra_pnginfo[0]["workflow"]
node = next(
(x for x in workflow["nodes"] if str(x["id"]) == str(unique_id[0])),
None,
)
if node:
node["widgets_values"] = [text]
return {"ui": {"text": text}, "result": (text,)}
################
# Nai Styler Complex CSV Loader v0.3 ##########################################################################
################
class NaiStylerComplexCSVLoader:
@staticmethod
def load_naistyles_csv(naistyles_path: str):
"""Loads naistyles CSV file, ignoring the first row (header)."""
naistyles = {"Error loading naistyles.csv, check the console": ["", ""]}
if not os.path.exists(naistyles_path):
print(f"""Error. No naistyles.csv found. Put your naistyles.csv in the custom_nodes/ComfyUI-Universal-Styler/CSV directory of ComfyUI. Then press "Refresh".
Your current root directory is: {folder_paths.base_path}
""")
return naistyles
try:
with open(naistyles_path, "r", encoding="utf-8") as f:
naistyles = [[x.replace('"', '').replace('\n', '') for x in re.split(',(?=(?:[^"]*"[^"]*")*[^"]*$)', line)] for line in f.readlines()[1:]]
naistyles = {x[0]: [x[1], x[2]] for x in naistyles}
except Exception as e:
print(f"""Error loading naistyles.csv. Make sure it is in the custom_nodes/ComfyUI-Universal-Styler/CSV directory of ComfyUI. Then press "Refresh".
Your current root directory is: {folder_paths.base_path}
Error: {e}
""")
return naistyles
@classmethod
def INPUT_TYPES(cls):
cls.naistyles_csv = cls.load_naistyles_csv(os.path.join(folder_paths.base_path, "custom_nodes", "ComfyUI-Universal-Styler", "CSV", "naistyles.csv"))
return {
"required": {
"naistyles": (list(cls.naistyles_csv.keys()),),
},
}
RETURN_TYPES = ("STRING",)
FUNCTION = "execute"
CATEGORY = "✴️ Universal NAI Nodes"
def execute(self, naistyles):
return (self.naistyles_csv[naistyles][0],)
################
# Nai Styler v0.1 ##########################################################################
################
class NaiStyler:
"""A custom node for styling."""
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"clip": ("CLIP",),
"mute": (["On", "Off"],),
"mix": ("INT", {
"default": 50,
"min": 0,
"max": 100,
"step": 1,
"display": "slider"
}),
"float_field": ("FLOAT", {
"default": 0.5,
"min": 0.0,
"max": 1.0,
"step": 0.01,
"round": 0.001,
"display": "slider"
}),
"string_field": ("STRING", {
"multiline": True,
"default": "Define Object"
}),
"string_field2": ("STRING", {
"multiline": True,
"default": "Define Background"
}),
},
}
RETURN_TYPES = ("CONDITIONING", "STRING", "STRING", "INT")
RETURN_NAMES = ("Compiled prompt", "Value", "Value2", "mix")
FUNCTION = "test"
CATEGORY = "✴️ Universal NAI Nodes"
def test(self, string_field, string_field2, mix, float_field, mute):
if mute == "On":
print(f"""Your input contains:
string_field: {string_field}
int_field: {mix}
float_field: {float_field}
""")
################
# Concatenate Fields v0.1 ##########################################################################
################
class ConcatenateFields:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"text1": ("STRING", {"multiline": False, "default": "Hello"}),
"text2": ("STRING", {"multiline": False, "default": "World"}),
}
}
RETURN_TYPES = ("STRING",)
FUNCTION = "concatenate_text"
CATEGORY = "✴️ Universal NAI Nodes"
def concatenate_text(self, text1, text2):
return (text1 + " " + text2,)
################
# Node Class and Display Name Mappings ##########################################################################
################
NODE_CLASS_MAPPINGS = {
"ShowText": ShowText,
"NaiStylerComplexCSVLoader": NaiStylerComplexCSVLoader,
"NaiStyler": NaiStyler,
"ConcatenateFields": ConcatenateFields,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"ShowText": "✴️ U-NAI Get Text",
"NaiStylerComplexCSVLoader": "✴️ U-NAI Styles Launcher",
"NaiStyler": "✴️ U-NAI Styler - v0.2.1",
"ConcatenateFields": "✴️ U-NAI Fields Concatenate",
} |
The aforementioned node is nowhere to be found?
ComfyUI-Universal-Styler/naistyler_nodes.py
Line 106 in cb64097
See the conversation there comfyanonymous/ComfyUI#3463
The text was updated successfully, but these errors were encountered: