An editor for graph-like structures, using [GraphNode]s. [GraphEdit] provides tools for creation, manipulation, and display of various graphs. Its main purpose in the engine is to power the visual programming systems, such as visual shaders, but it is also available for use in user projects. [GraphEdit] by itself is only an empty container, representing an infinite grid where [GraphNode]s can be placed. Each [GraphNode] represents a node in the graph, a single unit of data in the connected scheme. [GraphEdit], in turn, helps to control various interactions with nodes and between nodes. When the user attempts to connect, disconnect, or delete a [GraphNode], a signal is emitted in the [GraphEdit], but no action is taken by default. It is the responsibility of the programmer utilizing this control to implement the necessary logic to determine how each request should be handled. [b]Performance:[/b] It is greatly advised to enable low-processor usage mode (see [member OS.low_processor_usage_mode]) when using GraphEdits. Virtual method which can be overridden to customize how connections are drawn. Returns whether the [param mouse_position] is in the input hot zone. By default, a hot zone is a [Rect2] positioned such that its center is at [param in_node].[method GraphNode.get_input_port_position]([param in_port]) (For output's case, call [method GraphNode.get_output_port_position] instead). The hot zone's width is twice the Theme Property [code]port_grab_distance_horizontal[/code], and its height is twice the [code]port_grab_distance_vertical[/code]. Below is a sample code to help get started: [codeblock] func _is_in_input_hotzone(in_node, in_port, mouse_position): var port_size: Vector2 = Vector2(get_theme_constant("port_grab_distance_horizontal"), get_theme_constant("port_grab_distance_vertical")) var port_pos: Vector2 = in_node.get_position() + in_node.get_input_port_position(in_port) - port_size / 2 var rect = Rect2(port_pos, port_size) return rect.has_point(mouse_position) [/codeblock] Returns whether the [param mouse_position] is in the output hot zone. For more information on hot zones, see [method _is_in_input_hotzone]. Below is a sample code to help get started: [codeblock] func _is_in_output_hotzone(in_node, in_port, mouse_position): var port_size: Vector2 = Vector2(get_theme_constant("port_grab_distance_horizontal"), get_theme_constant("port_grab_distance_vertical")) var port_pos: Vector2 = in_node.get_position() + in_node.get_output_port_position(in_port) - port_size / 2 var rect = Rect2(port_pos, port_size) return rect.has_point(mouse_position) [/codeblock] This virtual method can be used to insert additional error detection while the user is dragging a connection over a valid port. Return [code]true[/code] if the connection is indeed valid or return [code]false[/code] if the connection is impossible. If the connection is impossible, no snapping to the port and thus no connection request to that port will happen. In this example a connection to same node is suppressed: [codeblocks] [gdscript] func _is_node_hover_valid(from, from_port, to, to_port): return from != to [/gdscript] [csharp] public override bool _IsNodeHoverValid(StringName fromNode, int fromPort, StringName toNode, int toPort) { return fromNode != toNode; } [/csharp] [/codeblocks] Allows the connection between two different port types. The port type is defined individually for the left and the right port of each slot with the [method GraphNode.set_slot] method. See also [method is_valid_connection_type] and [method remove_valid_connection_type]. Allows to disconnect nodes when dragging from the left port of the [GraphNode]'s slot if it has the specified type. See also [method remove_valid_left_disconnect_type]. Allows to disconnect nodes when dragging from the right port of the [GraphNode]'s slot if it has the specified type. See also [method remove_valid_right_disconnect_type]. Rearranges selected nodes in a layout with minimum crossings between connections and uniform horizontal and vertical gap between nodes. Removes all connections between nodes. Create a connection between the [param from_port] of the [param from_node] [GraphNode] and the [param to_port] of the [param to_node] [GraphNode]. If the connection already exists, no connection is created. Removes the connection between the [param from_port] of the [param from_node] [GraphNode] and the [param to_port] of the [param to_node] [GraphNode]. If the connection does not exist, no connection is removed. Ends the creation of the current connection. In other words, if you are dragging a connection you can use this method to abort the process and remove the line that followed your cursor. This is best used together with [signal connection_drag_started] and [signal connection_drag_ended] to add custom behavior like node addition through shortcuts. [b]Note:[/b] This method suppresses any other connection request signals apart from [signal connection_drag_ended]. Returns the points which would make up a connection between [param from_node] and [param to_node]. Returns an Array containing the list of connections. A connection consists in a structure of the form [code]{ from_port: 0, from: "GraphNode name 0", to_port: 1, to: "GraphNode name 1" }[/code]. Gets the [HBoxContainer] that contains the zooming and grid snap controls in the top left of the graph. You can use this method to reposition the toolbar or to add your own custom controls to it. [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member CanvasItem.visible] property. Returns [code]true[/code] if the [param from_port] of the [param from_node] [GraphNode] is connected to the [param to_port] of the [param to_node] [GraphNode]. Returns whether it's possible to make a connection between two different port types. The port type is defined individually for the left and the right port of each slot with the [method GraphNode.set_slot] method. See also [method add_valid_connection_type] and [method remove_valid_connection_type]. Disallows the connection between two different port types previously allowed by [method add_valid_connection_type]. The port type is defined individually for the left and the right port of each slot with the [method GraphNode.set_slot] method. See also [method is_valid_connection_type]. Disallows to disconnect nodes when dragging from the left port of the [GraphNode]'s slot if it has the specified type. Use this to disable disconnection previously allowed with [method add_valid_left_disconnect_type]. Disallows to disconnect nodes when dragging from the right port of the [GraphNode]'s slot if it has the specified type. Use this to disable disconnection previously allowed with [method add_valid_right_disconnect_type]. Sets the coloration of the connection between [param from_node]'s [param from_port] and [param to_node]'s [param to_port] with the color provided in the [theme_item activity] theme property. Sets the specified [param node] as the one selected. If [code]true[/code], the lines between nodes will use antialiasing. The curvature of the lines between the nodes. 0 results in straight lines. The thickness of the lines between the nodes. If [code]true[/code], the minimap is visible. The opacity of the minimap rectangle. The size of the minimap rectangle. The map itself is based on the size of the grid area and is scaled to fit this rectangle. Defines the control scheme for panning with mouse wheel. If [code]true[/code], enables disconnection of existing connections in the GraphEdit by dragging the right end. The scroll offset. If [code]true[/code], the button to automatically arrange graph nodes is visible. If [code]true[/code], the grid is visible. If [code]true[/code], buttons that allow to configure grid and snapping options are visible. If [code]true[/code], the menu toolbar is visible. If [code]true[/code], the button to toggle the minimap is visible. If [code]true[/code], buttons that allow to change and reset the zoom level are visible. If [code]true[/code], the label with the current zoom level is visible. The zoom level is displayed in percents. The snapping distance in pixels, also determines the grid line distance. If [code]true[/code], enables snapping. The current zoom value. The upper zoom limit. The lower zoom limit. The step of each zoom level. Emitted at the beginning of a GraphNode movement. Emitted at the end of a connection drag. Emitted at the beginning of a connection drag. Emitted when user drags a connection from an input port into the empty space of the graph. Emitted to the GraphEdit when the connection between the [param from_port] of the [param from_node] [GraphNode] and the [param to_port] of the [param to_node] [GraphNode] is attempted to be created. Emitted when user drags a connection from an output port into the empty space of the graph. Emitted when the user presses [kbd]Ctrl + C[/kbd]. Emitted when attempting to remove a GraphNode from the GraphEdit. Provides a list of node names to be removed (all selected nodes, excluding nodes without closing button). Emitted to the GraphEdit when the connection between [param from_port] of [param from_node] [GraphNode] and [param to_port] of [param to_node] [GraphNode] is attempted to be removed. Emitted when a GraphNode is attempted to be duplicated in the GraphEdit. Emitted at the end of a GraphNode movement. Emitted when a GraphNode is selected. Emitted when the user presses [kbd]Ctrl + V[/kbd]. Emitted when a popup is requested. Happens on right-clicking in the GraphEdit. [param position] is the position of the mouse pointer when the signal is sent. Emitted when the scroll offset is changed by the user. It will not be emitted when changed in code. [kbd]Mouse Wheel[/kbd] will zoom, [kbd]Ctrl + Mouse Wheel[/kbd] will move the view. [kbd]Mouse Wheel[/kbd] will move the view, [kbd]Ctrl + Mouse Wheel[/kbd] will zoom. Color of major grid lines. Color of minor grid lines. The fill color of the selection rectangle. The outline color of the selection rectangle. The horizontal range within which a port can be grabbed (inner side). The horizontal range within which a port can be grabbed (outer side). The icon for the grid toggle button. The icon for the layout button for auto-arranging the graph. The icon for the minimap toggle button. The icon for the snapping toggle button. The icon for the zoom in button. The icon for the zoom out button. The icon for the zoom reset button. The background drawn under the grid.