Struct GraphEdit

GraphEdit is an area capable of showing various GraphNodes. It manages connection events between them.

struct GraphEdit ;

GraphEdit manages the showing of GraphNodes it contains, as well as connections and disconnections between them. Signals are sent for each of these two events. Disconnection between GraphNode slots is disabled by default. It is greatly advised to enable low-processor usage mode (see OS.lowProcessorUsageMode) when using GraphEdits.

Properties

NameTypeDescription
rightDisconnects[get, set] boolIf true, enables disconnection of existing connections in the GraphEdit by dragging the right end.
scrollOffset[get, set] Vector2The scroll offset.
snapDistance[get, set] longThe snapping distance in pixels.
useSnap[get, set] boolIf true, enables snapping.
zoom[get, set] doubleThe current zoom value.

Methods

NameDescription
_connectionsLayerDraw
_graphNodeMoved
_graphNodeRaised
_guiInput
_scrollMoved
_snapToggled
_snapValueChanged
_topLayerDraw
_topLayerInput
_updateScrollOffset
_zoomMinus
_zoomPlus
_zoomReset
addValidConnectionType Makes possible the connection between two different slot types. The type is defined with the GraphNode.setSlot method.
addValidLeftDisconnectType Makes possible to disconnect nodes when dragging from the slot at the left if it has the specified type.
addValidRightDisconnectType Makes possible to disconnect nodes when dragging from the slot at the right if it has the specified type.
clearConnections Removes all connections between nodes.
connectNode Create a connection between the from_port slot of the from GraphNode and the to_port slot of the to GraphNode. If the connection already exists, no connection is created.
disconnectNode Removes the connection between the from_port slot of the from GraphNode and the to_port slot of the to GraphNode. If the connection does not exist, no connection is removed.
getConnectionList Returns an Array containing the list of connections. A connection consists in a structure of the form { from_port: 0, from: "GraphNode name 0", to_port: 1, to: "GraphNode name 1" }.
getScrollOfs
getSnap
getZoom
getZoomHbox Gets the HBoxContainer that contains the zooming and grid snap controls in the top left of the graph.
isNodeConnected Returns true if the from_port slot of the from GraphNode is connected to the to_port slot of the to GraphNode.
isRightDisconnectsEnabled
isUsingSnap
isValidConnectionType Returns whether it's possible to connect slots of the specified types.
removeValidConnectionType Makes it not possible to connect between two different slot types. The type is defined with the GraphNode.setSlot method.
removeValidLeftDisconnectType Removes the possibility to disconnect nodes when dragging from the slot at the left if it has the specified type.
removeValidRightDisconnectType Removes the possibility to disconnect nodes when dragging from the slot at the right if it has the specified type.
setConnectionActivity Sets the coloration of the connection between from's from_port and to's to_port with the color provided in the activity theme property.
setRightDisconnects
setScrollOfs
setSelected Sets the specified node as the one selected.
setSnap
setUseSnap
setZoom