diff --git a/README.md b/README.md index 40e2fc6..d23987d 100644 --- a/README.md +++ b/README.md @@ -175,7 +175,7 @@ Note, you can right-click on a bunch of the rgthree-comfy nodes and select `🛟 ## Power Primitive -> A single node that can output primitives (STRING, INT, FLOAT, BOOL). If connecting an input, it will cast/convert the primitive input to the desired output. +> A single node that can output primitives (STRING, INT, FLOAT, BOOLEAN). If connecting an input, it will cast/convert the primitive input to the desired output. >
> â„šī¸ More Information > @@ -192,7 +192,7 @@ Note, you can right-click on a bunch of the rgthree-comfy nodes and select `🛟 >
> â„šī¸ More Information > -> - Evaluate almost any kind of input and more, and choose your output from INT, FLOAT, STRING, or BOOL. +> - Evaluate almost any kind of input and more, and choose your output from INT, FLOAT, STRING, or BOOLEAN. > - Connect some nodes and do simply math operations like `a + b` or `ceil(1 / 2)`. > - Or do more advanced things, like input an image, and get the width like `a.shape[2]`. > - Even more powerful, you can target nodes in the prompt that's sent to the backend. For instance; if you have a Power Lora Loader node at id #5, and want to get a comma-delimited list of the enabled loras, you could enter: diff --git a/py/power_primitive.py b/py/power_primitive.py index 09f7b4d..c8deea1 100644 --- a/py/power_primitive.py +++ b/py/power_primitive.py @@ -43,6 +43,11 @@ output_to_type = { 'cast': lambda x: int(cast_to_float(x)), 'null': 0, }, + 'BOOLEAN': { + 'cast': cast_to_bool, + 'null': False, + }, + # This can be removed soon, there was a bug where this should have been BOOLEAN 'BOOL': { 'cast': cast_to_bool, 'null': False, diff --git a/py/power_puter.py b/py/power_puter.py index c47fa37..e494dd2 100644 --- a/py/power_puter.py +++ b/py/power_puter.py @@ -230,7 +230,10 @@ class RgthreePowerPuter: value = int(value) elif output == 'FLOAT': value = float(value) - elif output == 'BOOL': + # Accidentally defined "BOOL" when should have been "BOOLEAN." + # TODO: Can prob get rid of BOOl after a bit when UIs would be updated from sending + # BOOL incorrectly. + elif output in ('BOOL', 'BOOLEAN'): value = bool(value) elif output == 'STRING': if isinstance(value, (dict, list)): diff --git a/pyproject.toml b/pyproject.toml index 5c229af..4434d06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "rgthree-comfy" description = "Making ComfyUI more comfortable." -version = "1.0.2506222201" +version = "1.0.2506222249" license = { file = "LICENSE" } dependencies = [] diff --git a/src_web/comfyui/power_primitive.ts b/src_web/comfyui/power_primitive.ts index c3f0ef6..f4d7dd3 100644 --- a/src_web/comfyui/power_primitive.ts +++ b/src_web/comfyui/power_primitive.ts @@ -24,7 +24,7 @@ const PRIMITIVES = { // "STRING (multiline)": "STRING", INT: "INT", FLOAT: "FLOAT", - BOOL: "BOOL", + BOOLEAN: "BOOLEAN", }; class RgthreePowerPrimitive extends RgthreeBaseServerNode { @@ -65,6 +65,10 @@ class RgthreePowerPrimitive extends RgthreeBaseServerNode { */ override configure(info: ISerialisedNode): void { super.configure(info); + // Update BOOL to BOOLEAN due to a bug using BOOL instead of BOOLEAN. + if (this.outputTypeWidget.value === 'BOOL') { + this.outputTypeWidget.value = 'BOOLEAN'; + } setTimeout(() => { this.setTypedData(); }); @@ -157,7 +161,7 @@ class RgthreePowerPrimitive extends RgthreeBaseServerNode { value = Number(value); value = value == null || isNaN(value) ? 0 : value; newWidget.value = value; - } else if (type === "BOOL") { + } else if (type === "BOOLEAN") { newWidget = this.addWidget("toggle", name, !!(value ?? true), undefined, { on: "true", off: "false", diff --git a/src_web/comfyui/power_puter.ts b/src_web/comfyui/power_puter.ts index 83c6af4..8b2df61 100644 --- a/src_web/comfyui/power_puter.ts +++ b/src_web/comfyui/power_puter.ts @@ -7,6 +7,7 @@ import type { } from "@comfyorg/litegraph"; import type {ComfyNodeDef} from "typings/comfy.js"; import type {CanvasMouseEvent} from "@comfyorg/litegraph/dist/types/events.js"; +import type {ISerialisedNode} from "@comfyorg/litegraph/dist/types/serialisation.js"; import {app} from "scripts/app.js"; import {RgthreeBaseServerNode} from "./base_node.js"; @@ -26,7 +27,7 @@ import {rgthree} from "./rgthree.js"; const ALPHABET = "abcdefghijklmnopqrstuv".split(""); -const OUTPUT_TYPES = ["STRING", "INT", "FLOAT", "BOOL", "*"]; +const OUTPUT_TYPES = ["STRING", "INT", "FLOAT", "BOOLEAN", "*"]; class RgthreePowerPuter extends RgthreeBaseServerNode { static override title = NodeTypesString.POWER_PUTER; @@ -44,6 +45,16 @@ class RgthreePowerPuter extends RgthreeBaseServerNode { this.addInitialWidgets(); } + // /** + // * We need to patch in the configure to fix a bug where Power Puter was using BOOL instead of + // * BOOLEAN. + // */ + // override configure(info: ISerialisedNode): void { + // super.configure(info); + // // Update BOOL to BOOLEAN due to a bug using BOOL instead of BOOLEAN. + // this.outputTypeWidget + // } + static override setUp(comfyClass: LGraphNodeConstructor, nodeData: ComfyNodeDef) { RgthreeBaseServerNode.registerForOverride(comfyClass, nodeData, NODE_CLASS); } @@ -112,7 +123,7 @@ class RgthreePowerPuter extends RgthreeBaseServerNode {