webhooks for dyanmic widget changes updated

This commit is contained in:
Alexander G. Morano
2025-05-04 18:33:42 -04:00
parent d8badc5320
commit ca52e98b6c
6 changed files with 21 additions and 13 deletions
+3 -2
View File
@@ -1,7 +1,7 @@
/**/
import { app } from "../../../scripts/app.js"
import { widgetHookControl, widgetHookAB } from "../util.js"
import { widgetHookControl, widgetHookValue } from "../util.js"
const _id = "LERP (JOV) 🔰"
@@ -17,7 +17,8 @@ app.registerExtension({
const me = onNodeCreated?.apply(this);
const alpha = this.widgets.find(w => w.name == 'ALPHA');
widgetHookControl(this, 'TYPE', alpha, true);
widgetHookAB(this, 'TYPE', false);
widgetHookValue(this, 'TYPE', 'AA');
widgetHookValue(this, 'TYPE', 'BB');
return me;
}
return nodeType;
@@ -1,7 +1,7 @@
/**/
import { app } from "../../../scripts/app.js"
import { widgetHookAB } from "../util.js"
import { widgetHookValue } from "../util.js"
const _id = "OP BINARY (JOV) 🌟"
@@ -15,7 +15,8 @@ app.registerExtension({
const onNodeCreated = nodeType.prototype.onNodeCreated
nodeType.prototype.onNodeCreated = function () {
const me = onNodeCreated?.apply(this);
widgetHookAB(this, '❓');
widgetHookValue(this, 'TYPE', 'AA');
widgetHookValue(this, 'TYPE', 'BB');
return me;
}
+9 -2
View File
@@ -1,7 +1,7 @@
/**/
import { app } from "../../../scripts/app.js"
import { TypeSlotEvent, TypeSlot, nodeFitHeight } from "../util.js"
import { TypeSlotEvent, TypeSlot, nodeFitHeight, widgetHookValue } from "../util.js"
const _id = "OP UNARY (JOV) 🎲"
@@ -13,6 +13,13 @@ app.registerExtension({
return;
}
const onNodeCreated = nodeType.prototype.onNodeCreated
nodeType.prototype.onNodeCreated = function () {
const me = onNodeCreated?.apply(this);
widgetHookValue(this, 'TYPE', 'AA');
return me;
}
/*
const onConnectionsChange = nodeType.prototype.onConnectionsChange
nodeType.prototype.onConnectionsChange = function (slotType, slot_idx, event, link_info, node_slot) {
const me = onConnectionsChange?.apply(this, arguments);
@@ -41,7 +48,7 @@ app.registerExtension({
nodeFitHeight(this);
return me;
}
*/
return nodeType;
}
})
+1 -1
View File
@@ -8,7 +8,7 @@ import { flashBackgroundColor } from '../fun.js'
const _id1 = "QUEUE (JOV) 🗃";
const _id2 = "QUEUE TOO (JOV) 🗃";
const _prefix = '🦄';
const _prefix = '❔';
const EVENT_JOVI_PING = "jovi-queue-ping";
const EVENT_JOVI_DONE = "jovi-queue-done";
+3 -2
View File
@@ -1,7 +1,7 @@
/**/
import { app } from "../../../scripts/app.js"
import { widgetHookAB, nodeFitHeight} from "../util.js"
import { widgetHookValue, nodeFitHeight} from "../util.js"
const _id = "VALUE (JOV) 🧬"
@@ -21,7 +21,8 @@ app.registerExtension({
this.outputs[3].type = "*";
this.outputs[4].type = "*";
const ab_data = widgetHookAB(this, 'TYPE');
const ab_data = widgetHookValue(this, 'TYPE', 'AA');
widgetHookValue(this, 'TYPE', 'BB');
const oldCallback = ab_data.callback;
ab_data.callback = () => {
+2 -4
View File
@@ -111,10 +111,9 @@ export function widgetOutputHookType(node, control_key, match_output=0) {
/*
* matchFloatSize forces the target to be float[n] based on its type size
*/
export function widgetHookAB(node, control_key, output_type_match=true) {
export function widgetHookValue(node, control_key, child_key, output_type_match=true) {
const AA = node.widgets.find(w => w.name == 'AA');
const BB = node.widgets.find(w => w.name == 'BB');
const AA = node.widgets.find(w => w.name == child_key);
const combo = node.widgets.find(w => w.name == control_key);
if (combo === undefined) {
@@ -122,7 +121,6 @@ export function widgetHookAB(node, control_key, output_type_match=true) {
}
widgetHookControl(node, control_key, AA);
widgetHookControl(node, control_key, BB);
if (output_type_match) {
widgetOutputHookType(node, control_key);
}