Update max ID to match connected conditionings

This commit is contained in:
Palazzini Luca
2024-09-11 20:09:34 +02:00
parent a2cbb5aee7
commit 6c65ba3e55
+4 -2
View File
@@ -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;