From a908e12d23c820b916900f9d9ce2d5ecd507f3a2 Mon Sep 17 00:00:00 2001 From: Jake D <122334950+jwd-dev@users.noreply.github.com> Date: Sat, 15 Apr 2023 18:18:19 -0400 Subject: [PATCH 1/5] Update nodes.py with new Note node --- nodes.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nodes.py b/nodes.py index 6468ac6b..d49c830e 100644 --- a/nodes.py +++ b/nodes.py @@ -510,6 +510,14 @@ class EmptyLatentImage: return ({"samples":latent}, ) +class Note: + @classmethod + def INPUT_TYPES(s): + return {"required": {"text": ("STRING", {"multiline": True})}} + + CATEGORY = "other" + RETURN_TYPES = () + class LatentUpscale: upscale_methods = ["nearest-exact", "bilinear", "area"] @@ -1072,6 +1080,7 @@ NODE_CLASS_MAPPINGS = { "VAEEncodeForInpaint": VAEEncodeForInpaint, "VAELoader": VAELoader, "EmptyLatentImage": EmptyLatentImage, + "Note": Note, "LatentUpscale": LatentUpscale, "SaveImage": SaveImage, "PreviewImage": PreviewImage, @@ -1138,6 +1147,7 @@ NODE_DISPLAY_NAME_MAPPINGS = { "LatentFlip": "Flip Latent", "LatentCrop": "Crop Latent", "EmptyLatentImage": "Empty Latent Image", + "Note": "Note", "LatentUpscale": "Upscale Latent", "LatentComposite": "Latent Composite", # Image From 6c35ea505efbeb78ffe3c6bfc6b63e68f4290561 Mon Sep 17 00:00:00 2001 From: Jake D <122334950+jwd-dev@users.noreply.github.com> Date: Sat, 15 Apr 2023 19:48:24 -0400 Subject: [PATCH 2/5] reverting changes --- nodes.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/nodes.py b/nodes.py index d49c830e..6468ac6b 100644 --- a/nodes.py +++ b/nodes.py @@ -510,14 +510,6 @@ class EmptyLatentImage: return ({"samples":latent}, ) -class Note: - @classmethod - def INPUT_TYPES(s): - return {"required": {"text": ("STRING", {"multiline": True})}} - - CATEGORY = "other" - RETURN_TYPES = () - class LatentUpscale: upscale_methods = ["nearest-exact", "bilinear", "area"] @@ -1080,7 +1072,6 @@ NODE_CLASS_MAPPINGS = { "VAEEncodeForInpaint": VAEEncodeForInpaint, "VAELoader": VAELoader, "EmptyLatentImage": EmptyLatentImage, - "Note": Note, "LatentUpscale": LatentUpscale, "SaveImage": SaveImage, "PreviewImage": PreviewImage, @@ -1147,7 +1138,6 @@ NODE_DISPLAY_NAME_MAPPINGS = { "LatentFlip": "Flip Latent", "LatentCrop": "Crop Latent", "EmptyLatentImage": "Empty Latent Image", - "Note": "Note", "LatentUpscale": "Upscale Latent", "LatentComposite": "Latent Composite", # Image From 9587ea90c82998abc73387aab594ec7217f6d50a Mon Sep 17 00:00:00 2001 From: Jake D <122334950+jwd-dev@users.noreply.github.com> Date: Sat, 15 Apr 2023 19:50:05 -0400 Subject: [PATCH 3/5] Create noteNode.js --- web/extensions/core/noteNode.js | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 web/extensions/core/noteNode.js diff --git a/web/extensions/core/noteNode.js b/web/extensions/core/noteNode.js new file mode 100644 index 00000000..12428773 --- /dev/null +++ b/web/extensions/core/noteNode.js @@ -0,0 +1,38 @@ +import {app} from "../../scripts/app.js"; +import {ComfyWidgets} from "../../scripts/widgets.js"; +// Node that add notes to your project + +app.registerExtension({ + name: "Comfy.NoteNode", + registerCustomNodes() { + class NoteNode { + color=LGraphCanvas.node_colors.yellow.color; + bgcolor=LGraphCanvas.node_colors.yellow.bgcolor; + groupcolor = LGraphCanvas.node_colors.yellow.groupcolor; + constructor() { + if (!this.properties) { + this.properties = {}; + } + + ComfyWidgets.STRING(this, "", ["", {multiline: true}], app) + // This node is purely frontend and does not impact the resulting prompt so should not be serialized + this.isVirtualNode = true; + } + + + } + + // Load default visibility + + LiteGraph.registerNodeType( + "Note", + Object.assign(NoteNode, { + title_mode: LiteGraph.NORMAL_TITLE, + title: "Note", + collapsable: true, + }) + ); + + NoteNode.category = "utils"; + }, +}); From fb61c75e392ae0a3813955d56fb5aceecacff2e4 Mon Sep 17 00:00:00 2001 From: jwd-dev Date: Sat, 15 Apr 2023 19:58:46 -0400 Subject: [PATCH 4/5] default text property incase we need one. --- web/extensions/core/noteNode.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/extensions/core/noteNode.js b/web/extensions/core/noteNode.js index 12428773..1412d437 100644 --- a/web/extensions/core/noteNode.js +++ b/web/extensions/core/noteNode.js @@ -12,9 +12,10 @@ app.registerExtension({ constructor() { if (!this.properties) { this.properties = {}; + this.properties.text=""; } - ComfyWidgets.STRING(this, "", ["", {multiline: true}], app) + ComfyWidgets.STRING(this, "", ["", {default:this.properties.text, multiline: true}], app) // This node is purely frontend and does not impact the resulting prompt so should not be serialized this.isVirtualNode = true; } From 8cd170f40daa635ad17c29fab12296cb5936df69 Mon Sep 17 00:00:00 2001 From: jwd-dev Date: Sat, 15 Apr 2023 20:16:28 -0400 Subject: [PATCH 5/5] node serialization --- web/extensions/core/noteNode.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/extensions/core/noteNode.js b/web/extensions/core/noteNode.js index 1412d437..8d89054e 100644 --- a/web/extensions/core/noteNode.js +++ b/web/extensions/core/noteNode.js @@ -16,8 +16,10 @@ app.registerExtension({ } ComfyWidgets.STRING(this, "", ["", {default:this.properties.text, multiline: true}], app) - // This node is purely frontend and does not impact the resulting prompt so should not be serialized + + this.serialize_widgets = true; this.isVirtualNode = true; + }