Revert "Add support for LiteGraph to convert to classes (#334)" (#386)

This reverts commit e2141a81e2.
This commit is contained in:
Chenlei Hu
2024-08-12 09:19:10 -04:00
committed by GitHub
parent d9df0328c5
commit d607f6c7f7
7 changed files with 37 additions and 49 deletions

View File

@@ -1986,15 +1986,8 @@ export class ComfyApp {
async registerNodeDef(nodeId: string, nodeData: ComfyNodeDef) {
const self = this
const node = class ComfyNode extends LGraphNode {
static comfyClass? = nodeData.name
// TODO: change to "title?" once litegraph.d.ts has been updated
static title = nodeData.display_name || nodeData.name
static nodeData? = nodeData
static category?: string
constructor(title?: string) {
super(title)
const node = Object.assign(
function ComfyNode() {
var inputs = nodeData['input']['required']
if (nodeData['input']['optional'] != undefined) {
inputs = Object.assign(
@@ -2060,9 +2053,13 @@ export class ComfyApp {
this.serialize_widgets = true
app.#invokeExtensionsAsync('nodeCreated', this)
},
{
title: nodeData.display_name || nodeData.name,
comfyClass: nodeData.name,
nodeData
}
}
// @ts-expect-error
)
node.prototype.comfyClass = nodeData.name
this.#addNodeContextMenuHandler(node)
@@ -2070,7 +2067,9 @@ export class ComfyApp {
this.#addNodeKeyHandler(node)
await this.#invokeExtensionsAsync('beforeRegisterNodeDef', node, nodeData)
// @ts-expect-error
LiteGraph.registerNodeType(nodeId, node)
// @ts-expect-error
node.category = nodeData.category
}

View File

@@ -254,6 +254,7 @@ export function addDomClippingSetting(): void {
})
}
//@ts-ignore
LGraphNode.prototype.addDOMWidget = function (
name: string,
type: string,