Hierarchy (view full)

Constructors

Properties

Accessors

Methods

actionDo addConnection addCustomWidget addInput addOnExecutedOutput addOnTriggerInput addOutput addProperty addWidget alignToGrid captureInput changeMode clearTriggeredSlot clone collapse computeSize configure connect connectByTypeInput connectByTypeOutput disconnectInput disconnectOutput doExecute findInputSlotByName findInputSlotByType findInputSlotIndexByName findInputSlotIndexByType findOutputSlotByName findOutputSlotByType findOutputSlotIndexByName findOutputSlotIndexByType findSlotByType fitSize getBounding getConnectionPos getExtraLinkOptions? getExtraMenuOptions? getInputData getInputDataByName getInputDataType getInputInfo getInputLink getInputNode getInputOrProperty getInputSlotProperty getInputSlotsConnectedTo getMenuOptions? getOptionalSlots getOutputData getOutputInfo getOutputLinks getOutputNodes getOutputSlotConnectedTo getOutputSlotProperty getPropertyInfo getRootGraph getSlotInPosition getSlotMenuOptions? getTitle is isAnyOutputConnected isInputConnected isOutputConnected isPointInside isShowingTitle iterateAllLinks iterateInputInfo iterateOutputInfo iterateParentSubgraphNodes loadImage localToScreen moveInput moveOutput onAction? onAddPropertyToPanel? onAdded? onAfterExecuteNode onBeforeConnectInput? onBounding? onConfigure? onConnectInput? onConnectOutput? onConnectionsChange? onDblClick? onDeselected? onDrawBackground? onDrawCollapsed? onDrawForeground? onDrawTitle? onDrawTitleBar? onDrawTitleBox? onDrawTitleText? onDropData? onDropFile? onDropItem? onExecute? onGetPropertyInfo? onInputAdded? onInputClick? onInputDblClick? onInputRemoved? onJSPropertyChanged? onKey? onKeyDown? onKeyUp? onMenuNodeInputs? onMenuNodeOutputs? onMouseDown? onMouseEnter? onMouseLeave? onMouseMove? onMouseUp? onNodeCreated? onNodeOptionalInputAdd? onNodeOptionalOutputAdd? onOutputAdded? onOutputClick? onOutputDblClick? onOutputRemoved? onPropertyChanged? onReassignID? onRemoved? onResize onSelected? onSerialize? onShowCustomPanelInfo? onSlotPropertyChanged? onWidgetChanged? pin removeInput removeOnExecuteOutput removeOnTriggerInput removeOutput removeWidget removeWidgetByIndex removeWidgetByName serialize setDirtyCanvas setInputDataType setInputSlotProperty setOutputData setOutputDataType setOutputSlotProperty setProperty setSize setWidgetHidden syncDomAnchors toString trace trigger triggerSlot updateOutputData?

Constructors

Properties

_collapsed_width?: number
_level: number
_relative_id: NodeID = null
action_call: string = null
action_triggered: number = 0

the nFrames it will be used (-- each step), means "how old" is the event

bgcolor: string
block_delete: boolean = false
boxcolor: string
category: string
class: (new () => LGraphNode)

Type declaration

clip_area: boolean

if you render outside the node, it will be clipped

clonable: boolean = true
collapsable: boolean = true
color: string
connections: INodeConnection[]
console: string[] = []
desc: string = ""
disposed: Disposable = ...
dom_anchors: {
    bottom_center?: HTMLElement;
    bottom_left?: HTMLElement;
    bottom_right?: HTMLElement;
    middle_center?: HTMLElement;
    middle_left?: HTMLElement;
    middle_right?: HTMLElement;
    top_center?: HTMLElement;
    top_left?: HTMLElement;
    top_right?: HTMLElement;
} = {}

Type declaration

  • Optional bottom_center?: HTMLElement
  • Optional bottom_left?: HTMLElement
  • Optional bottom_right?: HTMLElement
  • Optional middle_center?: HTMLElement
  • Optional middle_left?: HTMLElement
  • Optional middle_right?: HTMLElement
  • Optional top_center?: HTMLElement
  • Optional top_left?: HTMLElement
  • Optional top_right?: HTMLElement
events: EventEmitter<{
    added: (() => void);
    changeMode: ((mode, before) => void);
    deselected: (() => void);
    drop: ((e) => void);
    dropFile: ((file) => void);
    execute: (() => void);
    keyDown: ((e) => void);
    keyUp: ((e) => void);
    mouseEnter: ((e) => void);
    mouseLeave: ((e) => void);
    mouseMove: ((e) => void);
    mouseUp: ((e) => void);
    nodeOptionalInputAdd: ((slot) => void);
    nodeOptionalOutputAdd: ((slot) => void);
    propertyChanged: ((k, v, prev_v) => void);
    removed: ((options?) => void);
    resize: ((size) => void);
    selected: (() => void);
    widgetChanged: ((widget, value, old) => void);
}> = ...

Type declaration

  • added: (() => void)
      • (): void
      • Returns void

  • changeMode: ((mode, before) => void)
  • deselected: (() => void)
      • (): void
      • Returns void

  • drop: ((e) => void)
      • (e): void
      • Parameters

        • e: DragEvent

        Returns void

  • dropFile: ((file) => void)
      • (file): void
      • Parameters

        • file: File

        Returns void

  • execute: (() => void)
      • (): void
      • Returns void

  • keyDown: ((e) => void)
      • (e): void
      • Parameters

        • e: KeyboardEvent

        Returns void

  • keyUp: ((e) => void)
      • (e): void
      • Parameters

        • e: KeyboardEvent

        Returns void

  • mouseEnter: ((e) => void)
  • mouseLeave: ((e) => void)
  • mouseMove: ((e) => void)
  • mouseUp: ((e) => void)
  • nodeOptionalInputAdd: ((slot) => void)
  • nodeOptionalOutputAdd: ((slot) => void)
  • propertyChanged: ((k, v, prev_v) => void)
      • (k, v, prev_v): void
      • Parameters

        • k: string
        • v: any
        • prev_v: any

        Returns void

  • removed: ((options?) => void)
  • resize: ((size) => void)
      • (size): void
      • Parameters

        Returns void

  • selected: (() => void)
      • (): void
      • Returns void

  • widgetChanged: ((widget, value, old) => void)
      • (widget, value, old): void
      • Parameters

        • widget: IWidget<any, any>
        • value: any
        • old: any

        Returns void

exec_version: number = 0
execute_triggered: number = 0

the nFrames it will be used (-- each step), means "how old" is the event

flags: Partial<{
    collapsed: boolean;
    pinned: boolean;
    skip_repeated_outputs: boolean;
}> = {}

Type declaration

  • collapsed: boolean
  • pinned: boolean
  • skip_repeated_outputs: boolean
graph: LGraph
graph_version: number
has_errors?: boolean

if true, the node will show the bgcolor as 'red'

hide_in_node_lists: boolean = false
highlight: {
    color: string;
    enabled: boolean;
    width: number;
} = ...

highlight draw in drawNodeHighlight

Type declaration

  • color: string
  • enabled: boolean
  • width: number
horizontal: boolean

slots are distributed horizontally

id: NodeID
ignore_remove: boolean = false
inputs: INodeInputSlot[]
is_selected: boolean
last_errors: any[] = null
last_execution_error: any = null
last_serialization?: SerializedLGraphNode<LGraphNode> = null
mode?: NodeMode

Used in LGraphCanvas.onMenuNodeMode

mouseOver: boolean
order: number
outputs: INodeOutputSlot[]
pos: Vector2 = ...
priority: number = 0

computeExecutionOrder sorts by priority first, then order if priorities are the same

progress: {
    current: number;
    message: string;
    running: boolean;
    total: number;
} = ...

progress draw in drawNodeHighlight

Type declaration

  • current: number
  • message: string
  • running: boolean
  • total: number
properties: Record<string, any>
properties_info: IProperty[]
redraw_on_mouse: boolean
removable: boolean = true
resizable: boolean

if set to false it wont be resizable with the mouse

serialize_widgets: boolean = false
shape: number = BuiltInSlotShape.ROUND_SHAPE
size: Vector2
skip_subgraph_button: boolean = false
subgraph: LGraph = null
title: string
titleMode: TitleMode = TitleMode.NORMAL_TITLE
type: string
widgets: IWidget<any, any>[]
widgets_start_y: number

widgets start at y distance from the top of the node

widgets_up: boolean

If set to true widgets do not start after the slots

widgets_values?: any[]
MAX_CONSOLE: number = 100
title: string
title_color: string
type: string
widgets_up: boolean

Accessors

Methods

  • add an special connection to this node (used for special kinds of graphs)

    Parameters

    • name: string
    • type: string

      string defining the input type ("vec3","number",...)

    • pos: Vector2

      position of the connection inside the node

    • direction: string

      if is input or output

    Returns INodeConnection

  • add a new input slot to use in this node

    Parameters

    • name: string
    • type: SlotType = BuiltInSlotType.DEFAULT

      string defining the input type ("vec3","number",...), it its a generic one use 0

    • Optional extra_info: Partial<INodeInputSlot>

      this can be used to have special properties of an input (label, color, position, etc)

    Returns INodeInputSlot

  • add a new property to this node

    Parameters

    • name: string
    • default_value: any
    • Optional type: string

      string defining the output type ("vec3","number",...)

    • Optional extra_info: Partial<IPropertyInfo>

      this can be used to have special properties of the property (like values, etc)

    Returns IProperty

  • clears the trigger slot animation

    Parameters

    • slot: number

      the index of the output slot

    • Optional link_id: LinkID

      in case you want to trigger and specific output link in a slot

    Returns void

  • connect this node output to the input of another node

    Type Parameters

    • T = any

    Parameters

    • slot: string | number

      (could be the number of the slot or the string with the name of the slot)

    • targetNode: LGraphNode

      the target node

    • targetSlot: string | number

      the input slot of the target node (could be the number of the slot or the string with the name of the slot, or -1 to connect a trigger)

    Returns T

    the linkInfo is created, otherwise null

  • connect this node output to the input of another node BY TYPE

    Parameters

    • slot: SlotNameOrIndex

      (could be the number of the slot or the string with the name of the slot)

    • targetNode: LGraphNode
    • targetSlotType: SlotType
    • optsIn: {
          createEventInCase?: boolean;
          firstFreeIfOutputGeneralInCase?: boolean;
          generalTypeInCase?: boolean;
      } = {}
      • Optional createEventInCase?: boolean
      • Optional firstFreeIfOutputGeneralInCase?: boolean
      • Optional generalTypeInCase?: boolean

    Returns any

    the link_info is created, otherwise null

    Method

    connectByType

  • connect this node input to the output of another node BY TYPE

    Parameters

    • slot: SlotNameOrIndex

      (could be the number of the slot or the string with the name of the slot)

    • sourceNode: LGraphNode
    • sourceSlotType: SlotType
    • optsIn: {
          createEventInCase?: boolean;
          firstFreeIfOutputGeneralInCase?: boolean;
          generalTypeInCase?: boolean;
      } = {}
      • Optional createEventInCase?: boolean
      • Optional firstFreeIfOutputGeneralInCase?: boolean
      • Optional generalTypeInCase?: boolean

    Returns any

    the link_info is created, otherwise null

    Method

    connectByType

  • disconnect one input

    Parameters

    • slot: SlotNameOrIndex

      (could be the number of the slot or the string with the name of the slot)

    • options: {
          doProcessChange?: boolean;
      } = {}
      • Optional doProcessChange?: boolean

    Returns boolean

    if it was disconnected successfully

  • disconnect one output to an specific node

    Parameters

    • slot: SlotNameOrIndex

      (could be the number of the slot or the string with the name of the slot)

    • Optional targetNode: LGraphNode

      the target node to which this slot is connected [Optional, if not targetNode is specified all nodes will be disconnected]

    • Optional options: object

    Returns boolean

    if it was disconnected successfully

  • returns the input slot with a given name (used for dynamic slots), -1 if not found

    Parameters

    • Optional name: string

      the name of the slot

    • onlyFree: boolean = false
    • Optional typesNotAccepted: SlotType[]

    Returns number

    the slot (-1 if not found)

  • findSlotByType for INPUTS

    Parameters

    • type: SlotType
    • preferFreeSlot: boolean = false
    • doNotUseOccupied: boolean = false

    Returns number

  • returns the output slot with a given name (used for dynamic slots), -1 if not found

    Parameters

    • Optional name: string

      the name of the slot

    • onlyFree: boolean = false
    • Optional typesNotAccepted: SlotType[]

    Returns number

    the slot (-1 if not found)

  • findSlotByType for OUTPUTS

    Parameters

    • type: SlotType
    • preferFreeSlot: boolean = false
    • doNotUseOccupied: boolean = false

    Returns number

  • returns the output (or input) slot with a given type, -1 if not found

    Type Parameters

    Parameters

    • input: boolean

      uise inputs instead of outputs

    • type: SlotType

      the type of the slot

    • returnObj: boolean
    • preferFreeSlot: boolean = false

      if we want a free slot (if not found, will return the first of the type anyway)

    • doNotUseOccupied: boolean = false

    Returns number | T

    the slot (-1 if not found)

    Method

    findSlotByType

  • returns the bounding of the object, used for rendering purposes

    Parameters

    • Optional out: Float32Array

    Returns Float32Array

    [x, y, width, height]

  • returns the center of a connection point in canvas coords

    Parameters

    • is_input: boolean

      true if if a input slot, false if it is an output

    • slotNumber: number
    • out: Vector2 = ...

      a place to store the output, to free garbage

    • ignore_collapsed: boolean = false

    Returns Vector2

    the position

  • Retrieves the input data (data traveling through the connection) from one slot

    Type Parameters

    • T = any

    Parameters

    • slot: number
    • Optional force_update: boolean

      if set to true it will force the connected node of this slot to output data into this link

    Returns T

    data or if it is not connected returns undefined

  • Retrieves the input data from one slot using its name instead of slot number

    Type Parameters

    • T = any

    Parameters

    • slot_name: string
    • Optional force_update: boolean

      if set to true it will force the connected node of this slot to output data into this link

    Returns T

    data or if it is not connected returns null

  • returns the value of an input with this name, otherwise checks if there is a property with that name

    Type Parameters

    • T = any

    Parameters

    • name: string

    Returns T

  • checks if a point is inside the shape of a node

    Parameters

    • x: number
    • y: number
    • margin: number = 0
    • skipTitle: boolean = false

    Returns boolean

  • when added to graph (warning: this is called BEFORE the node is configured when loading) Called by LGraph.add

    Parameters

    Returns void

  • Called just before connection (or disconnect - if input is linked). A convenient place to switch to another input, or create new one. This allow for ability to automatically add slots if needed

    Parameters

    • inputIndex: number

    Returns number

    selected input slot index, can differ from parameter value

  • if returns false the incoming connection will be canceled Called by LGraph.connect

    Parameters

    • inputIndex: number

      target input slot number

    • outputType: SlotType

      type of output slot

    • outputSlot: INodeOutputSlot

      output slot object

    • outputNode: LGraphNode

      node containing the output

    • outputIndex: number

      index of output slot

    Returns boolean

  • if returns false the incoming connection will be canceled Called by LGraph.connect

    Parameters

    • outputIndex: number

      target output slot number

    • inputType: SlotType

      type of input slot

    • inputSlot: INodeInputSlot

      input slot object

    • inputNode: LGraphNode

      node containing the input

    • inputIndex: number

      index of input slot

    Returns boolean

  • Parameters

    • ctx: CanvasRenderingContext2D
    • graphCanvas: LGraphCanvas
    • title_height: number
    • size: Vector2
    • scale: number
    • font: string
    • selected: boolean

    Returns boolean

  • Called when the node's title or other JS property changes

    Parameters

    • property: string
    • value: any
    • Optional prevValue: any

    Returns boolean | void

  • if returns false, will abort the LGraphNode.setProperty Called when a property is changed

    Parameters

    • property: string
    • value: any
    • Optional prevValue: any

    Returns boolean | void

  • Forces to redraw or the main canvas (LGraphNode) or the bg canvas (links)

    Parameters

    • fg: boolean
    • bg: boolean = false

    Returns void

  • Triggers an slot event in this node

    Parameters

    • slot: number

      the index of the output slot

    • Optional param: any
    • Optional link_id: LinkID

      in case you want to trigger and specific output link in a slot

    • options: LActionOptions = {}

    Returns void