Add support for LiteGraph to convert to classes (#334)

* Add support for LiteGraph to convert to classes

* Fix large context menu search regression

* Remove debug code

* Fix regression from rename & prototype change

* Fix super() calls to match LGraphNode
This commit is contained in:
filtered
2024-08-11 23:46:54 +10:00
committed by GitHub
parent 0f3b58b610
commit e2141a81e2
7 changed files with 49 additions and 37 deletions

View File

@@ -1,8 +1,8 @@
import { ComfyWidgets, addValueControlWidgets } from '../../scripts/widgets'
import { app } from '../../scripts/app'
import { applyTextReplacements } from '../../scripts/utils'
import { LiteGraph } from '@comfyorg/litegraph'
import type { LGraphNode, INodeInputSlot, IWidget } from '@comfyorg/litegraph'
import { LiteGraph, LGraphNode } from '@comfyorg/litegraph'
import type { INodeInputSlot, IWidget } from '@comfyorg/litegraph'
const CONVERTED_TYPE = 'converted-widget'
const VALID_TYPES = ['STRING', 'combo', 'number', 'toggle', 'BOOLEAN']
@@ -13,11 +13,12 @@ const TARGET = Symbol() // Used for reroutes to specify the real target widget
interface PrimitiveNode extends LGraphNode {}
const replacePropertyName = 'Run widget replace on values'
class PrimitiveNode {
class PrimitiveNode extends LGraphNode {
controlValues: any[]
lastType: string
static category: string
constructor() {
constructor(title?: string) {
super(title)
this.addOutput('connect to widget input', '*')
this.serialize_widgets = true
this.isVirtualNode = true