From 6c65ba3e559a1de4c8fe74f11f4525d7db6557da Mon Sep 17 00:00:00 2001 From: Palazzini Luca Date: Wed, 11 Sep 2024 20:09:34 +0200 Subject: [PATCH] Update max ID to match connected conditionings --- web/visual_area_prompt.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/visual_area_prompt.js b/web/visual_area_prompt.js index 79b56a6..1b2c41b 100644 --- a/web/visual_area_prompt.js +++ b/web/visual_area_prompt.js @@ -39,8 +39,8 @@ app.registerExtension({ // Set properties for the elements this.setProperty("area_values", []); // Add base controls for conditionings + // FIXME: Currently node gets no values for idx 0, as it runs only when it returns to idx 0 addNumberInput(this, "id", 0, (value, _, node) => { - console.log(node.properties["area_values"]); this.index = value; if (!node.properties["area_values"][this.index]) { node.properties["area_values"][this.index] = []; @@ -65,7 +65,7 @@ app.registerExtension({ const strValue = node.properties["area_values"][this.index][4]; node.properties["area_values"][this.index][4] = strValue ? strValue : 1.0; node.widgets[5].value = strValue ? strValue : 1.0; - }, { min: 0, max: 10, step: 10, precision: 0 }); + }, { min: 0, max: 0, step: 10, precision: 0 }); // x value input, has index 0 addNumberInput(this, "x", 0.0, (value, _, node) => { node.properties["area_values"][this.index][0] = value; @@ -154,6 +154,8 @@ app.registerExtension({ // Add last input to fix the removed ones this.addInput(_PREFIX, _TYPE); } + // Set ID widget max to correct value + this.widgets[0].options.max = (dynamicInputs.length - 1) >= 0 ? (dynamicInputs.length - 1) : 0; // Return node this?.graph?.setDirtyCanvas(true); return me;