fix bug of nodes use the mtb's ComfyUI web extention

This commit is contained in:
chflame163
2024-02-21 16:43:52 +08:00
parent 8f5cad6756
commit d484f3e5d1
3 changed files with 26 additions and 251 deletions
+2 -15
View File
@@ -27,15 +27,6 @@ app.registerExtension({
name: 'mtb.Debug',
async beforeRegisterNodeDef(nodeType, nodeData, app) {
if (nodeData.name === 'Debug (mtb)') {
const onNodeCreated = nodeType.prototype.onNodeCreated
nodeType.prototype.onNodeCreated = function () {
const r = onNodeCreated
? onNodeCreated.apply(this, arguments)
: undefined
this.addInput(`anything_1`, '*')
return r
}
const onConnectionsChange = nodeType.prototype.onConnectionsChange
nodeType.prototype.onConnectionsChange = function (
type,
@@ -75,14 +66,11 @@ app.registerExtension({
// const pos = this.widgets.findIndex((w) => w.name === "anything_1");
// if (pos !== -1) {
for (let i = 0; i < this.widgets.length; i++) {
if (this.widgets[i].name !== 'output_to_console') {
this.widgets[i].onRemoved?.()
}
this.widgets[i].onRemoved?.()
}
this.widgets.length = 1
this.widgets.length = 0
}
let widgetI = 1
if (message.text) {
for (const txt of message.text) {
const w = this.addCustomWidget(
@@ -112,7 +100,6 @@ app.registerExtension({
if (this.widgets[y].canvas) {
this.widgets[y].canvas.remove()
}
shared.cleanupNode(this)
this.widgets[y].onRemoved?.()
}
}