mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-01 22:09:55 +00:00
Add pp.addNodeOnGraph to simplify adding node on canvas (#239)
This commit is contained in:
@@ -36,7 +36,12 @@ import { StorageLocation } from '@/types/settingTypes'
|
||||
import '@comfyorg/litegraph/css/litegraph.css'
|
||||
import '../assets/css/style.css'
|
||||
import { ExtensionManager } from '@/types/extensionTypes'
|
||||
import { SYSTEM_NODE_DEFS, useNodeDefStore } from '@/stores/nodeDefStore'
|
||||
import {
|
||||
ComfyNodeDefImpl,
|
||||
SYSTEM_NODE_DEFS,
|
||||
useNodeDefStore
|
||||
} from '@/stores/nodeDefStore'
|
||||
import { Vector2 } from '@comfyorg/litegraph'
|
||||
|
||||
export const ANIM_PREVIEW_WIDGET = '$$comfy_animation_preview'
|
||||
|
||||
@@ -2933,6 +2938,19 @@ export class ComfyApp {
|
||||
this.lastExecutionError = null
|
||||
this.runningNodeId = null
|
||||
}
|
||||
|
||||
addNodeOnGraph(
|
||||
nodeDef: ComfyNodeDef | ComfyNodeDefImpl,
|
||||
options: Record<string, any> = {}
|
||||
): LGraphNode {
|
||||
const node = LiteGraph.createNode(
|
||||
nodeDef.name,
|
||||
nodeDef.display_name,
|
||||
options
|
||||
)
|
||||
this.graph.add(node)
|
||||
return node
|
||||
}
|
||||
}
|
||||
|
||||
export const app = new ComfyApp()
|
||||
|
||||
Reference in New Issue
Block a user