Added pipeSDXL Loader and KSampler, Class

refactoring
This commit is contained in:
TinyTerra
2023-08-24 23:24:41 +10:00
parent 89afa567d8
commit f835f0f852
6 changed files with 1305 additions and 975 deletions
+36 -3
View File
@@ -1,8 +1,10 @@
# tinyterraNodes
A selection of custom nodes for [ComfyUI](https://github.com/comfyanonymous/ComfyUI).
![tinyterra_trueHRFix](workflows/tinyterra_trueHRFix.png)
![tinyterra_xyPlot](workflows/tinyterra_xyPlot.png)
![tinyterra_pipeSDXL](workflows/tinyterra_pipeSDXL.png)
![tinyterra_trueHRFix](workflows/tinyterra_trueHRFix.png)
![tinyterra_trueHRFix](workflows/tinyterra_trueHRFix.png)
## Installation
Navigate to the **_ComfyUI/custom_nodes_** directory with cmd, and run:
@@ -28,11 +30,16 @@ Navigate to the **_ComfyUI/custom_nodes_** directory with cmd, and run:
*Enabled by default*
+ <details><summary>Adds 'Node Dimensions (ttN)' to the node right-click context menu</summary> Allows setting specific node Width and Height values as long as they are above the minimum size for the given node.
+ <details><summary>Adds 'Default BG Color (ttN)' to the node right-click context menu</summary> Allows setting specific default background color for every node added.
+ <details><summary>Adds 'Show Execution Order (ttN)' to the node right-click context menu</summary> Toggles execution order flags on node corners.
+ <details><summary>Adds support for 'ctrl + arrow key' Node movement</summary> This aligns the node(s) to the set ComfyUI grid spacing size and move the node in the direction of the arrow key by the grid spacing value. Holding shift in addition will move the node by the grid spacing size * 10.
+ <details><summary>Adds 'Reload Node (ttN)' to the node right-click context menu</summary> Creates a new instance of the node with the same position, size, color and title (will disconnect any IO wires). It attempts to retain set widget values which is useful for replacing nodes when a node/widget update occurs </details>
+ <details><summary>Adds 'Slot Type Color (ttN)' to the Link right-click context menu</summary> Opens a color picker dialog menu to update the color of the selected link type. </details>
+ <details><summary>Adds 'Link Border (ttN)' to the Link right-click context menu</summary> Toggles link line border. </details>
+ <details><summary>Adds 'Link Shadow (ttN)' to the Link right-click context menu</summary> Toggles link line shadow. </details>
+ <details><summary>Adds 'Link Style (ttN)' to the Link right-click context menu</summary> Sets the default link line type. </details>
**Save image prefix parsing**
+ Add date/time info to filenames by using: %date:yyyy-MM-dd-hh-mm-ss%
@@ -77,7 +84,7 @@ Combination of Efficiency Loader and Advanced CLIP Text Encode with an additiona
(Modified from [Efficiency Nodes](https://github.com/LucianoCirino/efficiency-nodes-comfyui) and [QOLS_Omar92](https://github.com/omar92/ComfyUI-QualityOfLifeSuit_Omar92))
Combination of Efficiency Loader and Advanced CLIP Text Encode with an additional pipe output
+ _**Inputs -** pipe, (optional pipe overrides), script, (Lora, model strength, clip strength), (upscale method, factor, crop), sampler state, steps, cfg, sampler name, scheduler, denoise, (image output [None, Preview, Save]), Save_Prefix_
+ _**Inputs -** pipe, (optional pipe overrides), xyplot, (Lora, model strength, clip strength), (upscale method, factor, crop), sampler state, steps, cfg, sampler name, scheduler, denoise, (image output [None, Preview, Save]), Save_Prefix, seed_
+ _**Outputs -** pipe, model, conditioning, conditioning, samples, vae, clip, image, seed_
Old node layout:
@@ -88,6 +95,32 @@ With pipeLoader and pipeKSampler:
<img src="https://github.com/TinyTerra/ComfyUI_tinyterraNodes/assets/115619949/c806c2e3-2efb-44cb-bdf0-3fbc20251456" width="50%">
</details>
<details>
<summary>pipeKSamplerAdvanced</summary>
Combination of Efficiency Loader and Advanced CLIP Text Encode with an additional pipe output
+ _**Inputs -** pipe, (optional pipe overrides), xyplot, (Lora, model strength, clip strength), (upscale method, factor, crop), sampler state, steps, cfg, sampler name, scheduler, starts_at_step, return_with_leftover_noise, (image output [None, Preview, Save]), Save_Prefix_
+ _**Outputs -** pipe, model, conditioning, conditioning, samples, vae, clip, image, seed_
</details>
<details>
<summary>pipeLoaderSDXL</summary>
SDXL Loader and Advanced CLIP Text Encode with an additional pipe output
+ _**Inputs -** model, vae, clip skip, (lora1, modelstrength clipstrength), (Lora2, modelstrength clipstrength), model, vae, clip skip, (lora1, modelstrength clipstrength), (Lora2, modelstrength clipstrength), (positive prompt, token normalization, weight interpretation), (negative prompt, token normalization, weight interpretation), (latent width, height), batch size, seed_
+ _**Outputs -** sdxlpipe, model, conditioning, conditioning, vae, model, conditioning, conditioning, vae, samples, clip, seed_
</details>
<details>
<summary>pipeKSamplerSDXL</summary>
SDXL Sampler (base and refiner in one) and Advanced CLIP Text Encode with an additional pipe output
+ _**Inputs -** sdxlpipe, (optional pipe overrides), (upscale method, factor, crop), sampler state, base_steps, refiner_steps cfg, sampler name, scheduler, (image output [None, Preview, Save]), Save_Prefix, seed_
+ _**Outputs -** pipe, model, conditioning, conditioning, vae, model, conditioning, conditioning, vae, samples, clip, image, seed_
</details>
<details>
<summary>pipeIN</summary>
+10 -7
View File
@@ -19,10 +19,6 @@ optionValues = {
"enable_interface": ('true', 'false'),
"enable_dynamic_widgets": ('true', 'false'),
"enable_dev_nodes": ('true', 'false'),
"default_node_bg_color": ('default', 'red', 'brown', 'green', 'blue', 'pale_blue', 'cyan', 'purple', 'yellow', 'black'),
"pipe_line": "HEX Color Code (pipe_line link color)",
"int": "HEX Color Code (int link color)",
"xyplot": "HEX Color Code (xyplot link color)",
}
def get_config():
@@ -137,12 +133,19 @@ except ImportError:
print("\033[92m[ttNodes] \033[0;31mREMBG is not installed. Attempting to install...\033[0m")
p = subprocess.Popen([sys.executable, "-m", "pip", "install", "rembg[gpu]"])
p.wait()
print("\033[92m[ttNodes] REMBG Installed!\033[0m")
print("\033[92m[ttNodes] REMBG[GPU] Installed!\033[0m")
config_write("ttNodes", "install_rembg", 'Installed successfully')
except:
config_write("ttNodes", "install_rembg", 'Failed to install')
print("\033[92m[ttNodes] \033[0;31mFailed to install REMBG.\033[0m")
try:
print("\033[92m[ttNodes] \033[0;31mREMBG[GPU] failed to install. Attempting to install REMBG...\033[0m")
p = subprocess.Popen([sys.executable, "-m", "pip", "install", "rembg"])
p.wait()
print("\033[92m[ttNodes] REMBG Installed!\033[0m")
config_write("ttNodes", "install_rembg", 'Installed successfully')
except:
config_write("ttNodes", "install_rembg", 'Failed to install')
print("\033[92m[ttNodes] \033[0;31mFailed to install REMBG.\033[0m")
# --------- WEB ---------- #
web_extension_path = os.path.join(comfy_path, "web", "extensions", "tinyterraNodes")
+21 -1
View File
@@ -60,6 +60,24 @@ function widgetLogic(node, widget) {
toggleWidget(node, findWidgetByName(node, 'lora3_clip_strength'), true)
}
}
if (widget.name === 'refiner_lora1_name') {
if (widget.value === "None") {
toggleWidget(node, findWidgetByName(node, 'refiner_lora1_model_strength'))
toggleWidget(node, findWidgetByName(node, 'refiner_lora1_clip_strength'))
} else {
toggleWidget(node, findWidgetByName(node, 'refiner_lora1_model_strength'), true)
toggleWidget(node, findWidgetByName(node, 'refiner_lora1_clip_strength'), true)
}
}
if (widget.name === 'refiner_lora2_name') {
if (widget.value === "None") {
toggleWidget(node, findWidgetByName(node, 'refiner_lora2_model_strength'))
toggleWidget(node, findWidgetByName(node, 'refiner_lora2_clip_strength'))
} else {
toggleWidget(node, findWidgetByName(node, 'refiner_lora2_model_strength'), true)
toggleWidget(node, findWidgetByName(node, 'refiner_lora2_clip_strength'), true)
}
}
if (widget.name === 'rescale_after_model') {
if (widget.value === false) {
toggleWidget(node, findWidgetByName(node, 'rescale_method'))
@@ -140,7 +158,7 @@ function widgetLogic(node, widget) {
}
}
const getSetWidgets = ['rescale_after_model', 'rescale', 'image_output', 'lora_name', 'lora1_name', 'lora2_name', 'lora3_name', 'upscale_method', 'image_output', 'add_noise']
const getSetWidgets = ['rescale_after_model', 'rescale', 'image_output', 'lora_name', 'lora1_name', 'lora2_name', 'lora3_name', 'refiner_lora1_name', 'refiner_lora2_name', 'upscale_method', 'image_output', 'add_noise']
function getSetters(node) {
if (node.widgets)
@@ -171,8 +189,10 @@ app.registerExtension({
nodeCreated(node) {
if (node.getTitle() == "hiresfixScale" ||
node.getTitle() == "pipeLoader" ||
node.getTitle() == "pipeLoaderSDXL" ||
node.getTitle() == "pipeKSampler" ||
node.getTitle() == "pipeKSamplerAdvanced" ||
node.getTitle() == "pipeKSamplerSDXL" ||
node.getTitle() == "imageRemBG" ||
node.getTitle() == "imageOutput") {
getSetters(node)
+2
View File
@@ -1,11 +1,13 @@
import { app } from "/scripts/app.js";
const customPipeLineLink = "#7737AA"
const customPipeLineSDXLLink = "#0DC52B"
const customIntLink = "#29699C"
const customXYPlotLink = "#74DA5D"
var customLinkColors = JSON.parse(localStorage.getItem('Comfy.Settings.ttN.customLinkColors')) || {};
if (!customLinkColors["PIPE_LINE"] || !LGraphCanvas.link_type_colors["PIPE_LINE"]) {customLinkColors["PIPE_LINE"] = customPipeLineLink;}
if (!customLinkColors["PIPE_LINE_SDXL"] || !LGraphCanvas.link_type_colors["PIPE_LINE_SDXL"]) {customLinkColors["PIPE_LINE_SDXL"] = customPipeLineSDXLLink;}
if (!customLinkColors["INT"] || !LGraphCanvas.link_type_colors["INT"]) {customLinkColors["INT"] = customIntLink;}
if (!customLinkColors["XYPLOT"] || !LGraphCanvas.link_type_colors["XYPLOT"]) {customLinkColors["XYPLOT"] = customXYPlotLink;}
+1208 -964
View File
File diff suppressed because it is too large Load Diff
+28
View File
@@ -25,6 +25,32 @@ class ttN_debugInput:
print(f"{key}: {value}")
return tuple()
class ttN_compareInput:
@classmethod
def INPUT_TYPES(s):
return {"required": {"console_title": ("STRING", {"default": "ttN INPUT COMPARE"}),},
"optional": {"debug": ("", {"default": None}),
"debug2": ("", {"default": None}),}
}
RETURN_TYPES = tuple()
RETURN_NAMES = tuple()
FUNCTION = "debug"
CATEGORY = "ttN/dev"
OUTPUT_NODE = True
def debug(_, **kwargs):
values = []
for key, value in kwargs.items():
if key == "console_title":
print(value)
else:
print(f"{key}: {value}")
values.append(value)
return tuple()
class ttN_busIN:
@classmethod
def INPUT_TYPES(s):
@@ -86,6 +112,7 @@ class ttN_seedDebug:
NODE_CLASS_MAPPINGS = {
"ttN debugInput": ttN_debugInput,
"ttN compareInput": ttN_compareInput,
"ttN busIN": ttN_busIN,
"ttN busOUT": ttN_busOUT,
"ttN seedDebug": ttN_seedDebug,
@@ -94,6 +121,7 @@ NODE_CLASS_MAPPINGS = {
NODE_DISPLAY_NAME_MAPPINGS = {
"ttN debugInput": "debugInput",
"ttN compareInput": "compareInput",
"ttN busIN": "busIN",
"ttN busOUT": "busOUT",
"ttN seedDebug": "seedDebug",