This commit is contained in:
Chris
2026-04-20 12:25:30 +10:00
parent 85c650056d
commit 048448779d
3 changed files with 7 additions and 21 deletions
View File
+6 -20
View File
@@ -3,7 +3,7 @@ import { api } from "../../scripts/api.js";
import { create } from "./utils.js";
import { popup, remove_preview } from "./popup.js";
import { graph_id_to_tab } from "./weak_map.js";
import { graph_id_to_tab } from "./graph_map.js";
import { Log } from "./log.js";
const FILTER_TYPES = ["Image Filter","Text Image Filter","Text Image Filter with Extras","Mask Image Filter"]
@@ -107,37 +107,23 @@ app.registerExtension({
}
}
if (FILTER_TYPES.includes(nodeType.comfyClass )) {
const onNodeCreated = nodeType.prototype.onNodeCreated;
nodeType.prototype.onNodeCreated = function () {
const configure = nodeType.prototype.configure;
nodeType.prototype.configure = function () {
configure?.apply(this, arguments) // configure sets the widget values, then we change them
set_graph_id_widget(this)
if (this.type == 'Mask Image Filter') remove_preview(this.id)
return onNodeCreated ? onNodeCreated.apply(this, arguments) : undefined;
}
}
},
afterConfigureGraph() {
setTimeout( afterConfigure, 100 )
link_to_tab(3)
}
afterConfigureGraph() { link_to_tab(3) }
})
function afterConfigure() {
app.graph.nodes.forEach( (node) => {
if (FILTER_TYPES.includes(node.type)) {
set_graph_id_widget(node)
}
set_graph_id_widget(node)
if (node.type == 'Mask Image Filter') remove_preview(node.id)
}
)
}
function set_graph_id_widget(node) {
const graph_id_widget = node.widgets?.find((n)=>n.name=='graph_id')
if (graph_id_widget) {
graph_id_widget.hidden = true
graph_id_widget.value = `${app.graph.id}` // app.graph.id is unique per tab, regardless of subgraph
graph_id_widget.value = `${app.graph.id}`
graph_id_widget.computeSize = () => [0,0]
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { mask_editor_listen_for_cancel, mask_editor_showing, hide_mask_editor, p
import { Log } from "./log.js";
import { create } from "./utils.js";
import { FloatingWindow } from "./floating_window.js";
import { graph_id_to_tab } from "./weak_map.js";
import { graph_id_to_tab } from "./graph_map.js";
//const EXTENSION_NODES = ["Image Filter", "Text Image Filter", "Mask Image Filter", "Text Image Filter with Extras",]
const POPUP_NODES = ["Image Filter", "Text Image Filter", "Text Image Filter with Extras",]