LGraphNode Class
Base Class for all the node type classes
Item Index
Methods
- addConnection
- addInput
- addInputs
- addOutput
- addOutputs
- addProperty
- collapse
- computeSize
- configure
- connect
- disconnectInput
- disconnectOutput
- findInputSlot
- findOutputSlot
- getBounding
- getConnectionPos
- getInputData
- getInputInfo
- getInputNode
- getOutputInfo
- getOutputNodes
- getSlotInPosition
- getTitle
- isInputConnected
- isOutputConnected
- isPointInsideNode
- pin
- removeInput
- removeOutput
- serialize
- setOutputData
- toString
- trigger
Methods
addConnection
-
name -
type -
pos -
direction
add an special connection to this node (used for special kinds of graphs)
Parameters:
-
nameString -
typeStringstring defining the input type ("vec3","number",...)
-
posx,yposition of the connection inside the node
-
directionStringif is input or output
addInput
-
name -
type -
extra_info
add a new input slot to use in this node
Parameters:
-
nameString -
typeStringstring defining the input type ("vec3","number",...), it its a generic one use 0
-
extra_infoObjectthis 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:
-
arrayArrayof triplets like [[name,type,extra_info],[...]]
addOutput
-
name -
type -
extra_info
add a new output slot to use in this node
Parameters:
-
nameString -
typeStringstring defining the output type ("vec3","number",...)
-
extra_infoObjectthis can be used to have special properties of an output (label, special color, position, etc)
addOutputs
-
array
add a new output slot to use in this node
Parameters:
-
arrayArrayof triplets like [[name,type,extra_info],[...]]
addProperty
-
name -
default_value -
type -
extra_info
add a new property to this node
Parameters:
-
nameString -
default_value -
typeStringstring defining the output type ("vec3","number",...)
-
extra_infoObjectthis can be used to have special properties of the property (like values, etc)
collapse
()
Collapse the node to make it smaller on the canvas
computeSize
-
minHeight
computes the size of a node according to its inputs and output slots
Parameters:
-
minHeightNumber
Returns:
the total size
configure
()
configure a node from an object containing the serialized info
connect
-
slot -
node -
target_slot
connect this node output to the input of another node
Parameters:
-
slotNumber_or_string(could be the number of the slot or the string with the name of the slot)
-
nodeLGraphNodethe target node
-
target_slotNumber_or_stringthe 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:
if it was connected succesfully
disconnectInput
-
slot
disconnect one input
Parameters:
-
slotNumber_or_string(could be the number of the slot or the string with the name of the slot)
Returns:
if it was disconnected succesfully
disconnectOutput
-
slot -
target_node
disconnect one output to an specific node
Parameters:
-
slotNumber_or_string(could be the number of the slot or the string with the name of the slot)
-
target_nodeLGraphNodethe target node to which this slot is connected [Optional, if not target_node is specified all nodes will be disconnected]
Returns:
if it was disconnected succesfully
findInputSlot
-
name
returns the input slot with a given name (used for dynamic slots), -1 if not found
Parameters:
-
nameStringthe name of the slot
Returns:
the slot (-1 if not found)
findOutputSlot
-
name
returns the output slot with a given name (used for dynamic slots), -1 if not found
Parameters:
-
nameStringthe name of the slot
Returns:
the slot (-1 if not found)
getBounding
()
Float32Array4
returns the bounding of the object, used for rendering purposes
Returns:
the total size
getConnectionPos
-
is_input -
slot
returns the center of a connection point in canvas coords
Parameters:
-
is_inputBooleantrue if if a input slot, false if it is an output
-
slotNumber_or_string(could be the number of the slot or the string with the name of the slot)
Returns:
the position
getInputData
-
slot
retrieves the input data (data traveling through the connection) from one slot
Parameters:
-
slotNumber
Returns:
data or if it is not connected returns undefined
getInputInfo
-
slot
tells you info about an input connection (which node, type, etc)
Parameters:
-
slotNumber
Returns:
object or null
getInputNode
-
slot
returns the node connected in the input slot
Parameters:
-
slotNumber
Returns:
node or null
getOutputInfo
-
slot
tells you info about an output connection (which node, type, etc)
Parameters:
-
slotNumber
Returns:
object or null
getOutputNodes
-
slot
retrieves all the nodes connected to this output slot
Parameters:
-
slotNumber
Returns:
getSlotInPosition
-
x -
y
checks if a point is inside a node slot, and returns info about which slot
Parameters:
-
xNumber -
yNumber
Returns:
if found the object contains { input|output: slot object, slot: number, link_pos: [x,y] }
getTitle
()
get the title string
isInputConnected
-
slot
tells you if there is a connection in one input slot
Parameters:
-
slotNumber
Returns:
isOutputConnected
-
slot
tells you if there is a connection in one output slot
Parameters:
-
slotNumber
Returns:
isPointInsideNode
-
x -
y
checks if a point is inside the shape of a node
Parameters:
-
xNumber -
yNumber
Returns:
pin
()
Forces the node to do not move or realign on Z
removeInput
-
slot
remove an existing input slot
Parameters:
-
slotNumber
removeOutput
-
slot
remove an existing output slot
Parameters:
-
slotNumber
serialize
()
serialize the content
setOutputData
-
slot -
data
sets the output data
Parameters:
-
slotNumber -
data
toString
()
serialize and stringify
trigger
-
event -
param
Triggers an event in this node, this will trigger any output with the same name
Parameters:
-
eventStringname ( "on_play", ... ) if action is equivalent to false then the event is send to all
-
param
