API Docs for:
Show:

LGraphNode Class

Base Class for all the node type classes

Methods

addConnection

(
  • name
  • type
  • pos
  • direction
)

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 x,y

    position of the connection inside the node

  • direction String

    if is input or output

addInput

(
  • name
  • type
  • extra_info
)

add a new input slot to use in this node

Parameters:

  • name String
  • type String

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

  • extra_info Object

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

addInputs

(
  • array
)

add several new input slots in this node

Parameters:

  • array Array

    of triplets like [[name,type,extra_info],[...]]

addOutput

(
  • name
  • type
  • extra_info
)

add a new output slot to use in this node

Parameters:

  • name String
  • type String

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

  • extra_info Object

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

addOutputs

(
  • array
)

add a new output slot to use in this node

Parameters:

  • array Array

    of triplets like [[name,type,extra_info],[...]]

collapse

()

Collapse the node to make it smaller on the canvas

computeSize

(
  • minHeight
)
Number

computes the size of a node according to its inputs and output slots

Parameters:

  • minHeight Number

Returns:

Number:

the total size

configure

()

configure a node from an object containing the serialized info

connect

(
  • slot
  • node
  • target_slot
)
Boolean

connect this node output to the input of another node

Parameters:

  • slot Number_or_string

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

  • node LGraphNode

    the target node

  • target_slot Number_or_string

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

Returns:

Boolean:

if it was connected succesfully

disconnectInput

(
  • slot
)
Boolean

disconnect one input

Parameters:

  • slot Number_or_string

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

Returns:

Boolean:

if it was disconnected succesfully

disconnectOutput

(
  • slot
  • target_node
)
Boolean

disconnect one output to an specific node

Parameters:

  • slot Number_or_string

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

  • target_node LGraphNode

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

Returns:

Boolean:

if it was disconnected succesfully

findInputSlot

(
  • name
)
Number

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

Parameters:

  • name String

    the name of the slot

Returns:

Number:

the slot (-1 if not found)

findOutputSlot

(
  • name
)
Number

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

Parameters:

  • name String

    the name of the slot

Returns:

Number:

the slot (-1 if not found)

getBounding

() Float32Array4

returns the bounding of the object, used for rendering purposes

Returns:

Float32Array4:

the total size

getConnectionPos

(
  • is_input
  • slot
)
x,y

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

  • slot Number_or_string

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

Returns:

x,y:

the position

getInputData

(
  • slot
)

retrieves the input data from one slot

Parameters:

  • slot Number

Returns:

:

data

getInputInfo

(
  • slot
)
Object

tells you info about an input connection (which node, type, etc)

Parameters:

  • slot Number

Returns:

Object:

getOutputInfo

(
  • slot
)
Object

tells you info about an output connection (which node, type, etc)

Parameters:

  • slot Number

Returns:

Object:

getOutputNodes

(
  • slot
)
Array

retrieves all the nodes connected to this output slot

Parameters:

  • slot Number

Returns:

Array:

getTitle

()

get the title string

isInputConnected

(
  • slot
)
Boolean

tells you if there is a connection in one input slot

Parameters:

  • slot Number

Returns:

Boolean:

isOutputConnected

(
  • slot
)
Boolean

tells you if there is a connection in one output slot

Parameters:

  • slot Number

Returns:

Boolean:

isPointInsideNode

(
  • x
  • y
)
Boolean

checks if a point is inside the shape of a node

Parameters:

  • x Number
  • y Number

Returns:

Boolean:

pin

()

Forces the node to do not move or realign on Z

removeInput

(
  • slot
)

remove an existing input slot

Parameters:

  • slot Number

removeOutput

(
  • slot
)

remove an existing output slot

Parameters:

  • slot Number

serialize

()

serialize the content

setOutputData

(
  • slot
  • data
)

sets the output data

Parameters:

  • slot Number
  • data

toString

()

serialize and stringify