From 732e67d75aa8caebff86fb7f95fb3fb71f3b7b0c Mon Sep 17 00:00:00 2001 From: Luis Quesada Date: Thu, 16 May 2024 18:21:25 +0200 Subject: [PATCH] Fix so that unneeded fields are also hidden on node creation --- js/showcontrol.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/js/showcontrol.js b/js/showcontrol.js index 38d6e7c..ca6f931 100644 --- a/js/showcontrol.js +++ b/js/showcontrol.js @@ -3,7 +3,7 @@ import { app } from "../../scripts/app.js"; // Some fragments of this code are from https://github.com/LucianoCirino/efficiency-nodes-comfyui function inpaintCropHandler(node) { - if (node.type != "InpaintCrop") { + if (node.comfyClass != "InpaintCrop") { return; } toggleWidget(node, findWidgetByName(node, "force_size")); @@ -56,14 +56,13 @@ function toggleWidget(node, widget, show = false, suffix = "") { app.registerExtension({ name: "inpaint-cropandstitch.showcontrol", nodeCreated(node) { + inpaintCropHandler(node); for (const w of node.widgets || []) { let widgetValue = w.value; // Store the original descriptor if it exists let originalDescriptor = Object.getOwnPropertyDescriptor(w, 'value'); - inpaintCropHandler(node); - Object.defineProperty(w, 'value', { get() { // If there's an original getter, use it. Otherwise, return widgetValue.