Initial commit

This commit is contained in:
noembryo
2023-11-01 17:08:37 +02:00
parent 756ed1961a
commit 632ca15463
3 changed files with 56 additions and 7 deletions
+47
View File
@@ -0,0 +1,47 @@
## General
<!-- ![kohighlights128w](https://user-images.githubusercontent.com/24675403/234561476-97283ff8-5437-49cd-b4c5-3929886cf182.png) -->
[![made-with-python][Python]](https://www.python.org/)
<!-- [![Generic badge][OS]][ReleaseLink] -->
[![License: MIT][MIT]](LICENSE)
<!-- [![GitHub release][Release]][ReleaseLink] -->
<!-- [![Github all releases][TotalDown]][ReleaseLink] -->
<!-- [![Github Releases (by Release)][VersionDown]][ReleaseLink] -->
**PromptTermList** (1-6) are some nodes that help with the creation of Prompts inside [ComfyUI](https://github.com/comfyanonymous/ComfyUI).
### Screenshots
<p align="center">
<a href="https://raw.githubusercontent.com/noembryo/ComfyUI-noEmbryo/master/stuff/Screen1.png">
<img src="https://raw.githubusercontent.com/noembryo/ComfyUI-noEmbryo/master/stuff/Screen1.png" height="180"></a>
</p>
## Usage
Everyone of the 6 nodes have a different `json` file that stores its Prompt Terms in "label"/"value" pairs.
The "label" part is what we see at the node's dropdown menu, and the "value" part is what it produces at its `Term` output when we run a generation job.
These `json` files are located inside the `TermLists` directory, in the node's folder.
There are two ways to add a new term.
* From within ComfyUI, connect a text box to the node's `text` input.
Write the "label"/"value" part in the box using the following format:
label=bla blabla
value=blabla bla blabla blab
Enable the `store_input` switch.
Run a generation job.
* Manually, open the `json` file and add/remove/change entries.
Of course we must be very careful with this, to keep the `json` format of labels/values (with the appropriate commas), otherwise the file will not be parsed.
This `text` input is also useful if we want to manually add something *after* our term, or as the *only* term if we select the `None` label.
## Installation
* cd to `ComfyUI\custom_nodes`
* git clone https://github.com/noembryo/ComfyUI-noEmbryo.git
* Restart ComfyUI
[Python]:https://img.shields.io/badge/Made%20with-Python-1f425f.svg
[MIT]:https://img.shields.io/badge/License-MIT-green.svg
+2 -1
View File
@@ -4,11 +4,12 @@
@nickname: noEmbryo
@description: Some useful nodes.
"""
import json
import os, io
from os.path import isfile, join, isdir
from .terms_node import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS, LISTS_PATH
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS, LISTS_PATH
os.makedirs(LISTS_PATH) if not isdir(LISTS_PATH) else None
for i in range(len(NODE_CLASS_MAPPINGS)):
+7 -6
View File
@@ -1,15 +1,15 @@
import io
import json
# from os import walk
from os.path import realpath, join
from pprint import pprint
MANIFEST = {"name": "noEmbryo Nodes",
"version": (0,0,1),
"version": (0,0,1,0),
"author": "noEmbryo",
"project": "https://github.com/noembryo/ComfyUI-noEmbryo",
"description": "Nodes for ComfyUI",
}
__author__ = "noEmbryo"
__version__ = "0.0.1.0"
LISTS_PATH = realpath("./custom_nodes/ComfyUI-noEmbryo/TermLists/")
@@ -47,11 +47,12 @@ class PromptTermList:
list_path = join(LISTS_PATH, "TermList{}.json".format(cls.idx))
cls.load_data_from_json(list_path)
term_list = [i[0] for i in cls.data_labels]
return {"required": {"text": ("STRING", {"forceInput": True}),
return {"required": {
"term_list": (term_list,),
},
"optional":
{"store_input": ("BOOLEAN", {"default": False,
{"text": ("STRING", {"forceInput": True}),
"store_input": ("BOOLEAN", {"default": False,
"label_on": True,
"label_off": False},),
},
@@ -93,7 +94,7 @@ class PromptTermList:
CATEGORY = "conditioning/Term Nodes"
FUNCTION = "run"
def run(self, text, term_list, store_input):
def run(self, term_list, store_input, text=None):
selected = term_list[:len(term_list)]
text_out = ""
for i in self.data_labels: