GraphEdit
Inherits: Control < CanvasItem < Node < Object GraphEdit is an area capable of showing various GraphNodes. It manages connection events between them.
Description
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. OS.low_processor_usage_mode) when using GraphEdits.
Properties
Methods
Theme Properties
Signals
- _begin_node_move ( ) Emitted at the beginning of a GraphNode movement.
- _end_node_move ( ) Emitted at the end of a GraphNode movement.
- connection_from_empty ( String to, int to_slot, Vector2 release_position ) Emitted when user dragging connection from input port into empty space of the graph.
- connection_request ( String from, int from_slot, String to, int to_slot )
from_slotslot of thefromGraphNode and theto_slotslot of thetoGraphNode is attempted to be created.
- connection_to_empty ( String from, int from_slot, Vector2 release_position ) Emitted when user dragging connection from output port into empty space of the graph.
- copy_nodes_request ( )
Ctrl + C.
- delete_nodes_request ( Array nodes ) Emitted when a GraphNode is attempted to be removed from the GraphEdit. Provides a list of node names to be removed (all selected nodes, excluding nodes without closing button).
- disconnection_request ( String from, int from_slot, String to, int to_slot )
from_slotslot offromGraphNode andto_slotslot oftoGraphNode is attempted to be removed.
- duplicate_nodes_request ( ) Emitted when a GraphNode is attempted to be duplicated in the GraphEdit.
- node_selected ( Node node ) Emitted when a GraphNode is selected.
- node_unselected ( Node node )
- paste_nodes_request ( )
Ctrl + V.
- popup_request ( Vector2 position )
positionis the position of the mouse pointer when the signal is sent.
- scroll_offset_changed ( Vector2 ofs )
Emitted when the scroll offset is changed by the user. It will not be emitted when changed in code.
Property Descriptions
- bool minimap_enabled
true, the minimap is visible.
- float minimap_opacity The opacity of the minimap rectangle.
- Vector2 minimap_size 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.
- bool right_disconnects
true, enables disconnection of existing connections in the GraphEdit by dragging the right end.
- Vector2 scroll_offset The scroll offset.
- bool show_zoom_label
true, makes a label with the current zoom level visible. The zoom value is displayed in percents.
- int snap_distance The snapping distance in pixels.
- bool use_snap
true, enables snapping.
- float zoom The current zoom value.
- float zoom_max The upper zoom limit.
- float zoom_min The lower zoom limit.
- float zoom_step
The step of each zoom level.
Method Descriptions
- add_valid_connection_type ( int from_type, int to_type ) GraphNode.set_slot method.
- add_valid_left_disconnect_type ( int type ) Makes possible to disconnect nodes when dragging from the slot at the left if it has the specified type.
- add_valid_right_disconnect_type ( int type ) Makes possible to disconnect nodes when dragging from the slot at the right if it has the specified type.
- clear_connections ( ) Removes all connections between nodes.
- Error connect_node ( String from, int from_port, String to, int to_port )
from_portslot of thefromGraphNode and theto_portslot of thetoGraphNode. If the connection already exists, no connection is created.
- disconnect_node ( String from, int from_port, String to, int to_port )
from_portslot of thefromGraphNode and theto_portslot of thetoGraphNode. If the connection does not exist, no connection is removed.
- Array get_connection_list ( ) const
{ from_port: 0, from: "GraphNode name 0", to_port: 1, to: "GraphNode name 1" }.
- HBoxContainer get_zoom_hbox ( ) 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. Warning: 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 CanvasItem.visible property.
- bool is_node_connected ( String from, int from_port, String to, int to_port )
trueif thefrom_portslot of thefromGraphNode is connected to theto_portslot of thetoGraphNode.
- bool is_valid_connection_type ( int from_type, int to_type ) const Returns whether it’s possible to connect slots of the specified types.
- remove_valid_connection_type ( int from_type, int to_type ) GraphNode.set_slot method.
- remove_valid_left_disconnect_type ( int type ) Removes the possibility to disconnect nodes when dragging from the slot at the left if it has the specified type.
- remove_valid_right_disconnect_type ( int type ) Removes the possibility to disconnect nodes when dragging from the slot at the right if it has the specified type.
- set_connection_activity ( String from, int from_port, String to, int to_port, float amount )
from‘sfrom_portandto‘sto_portwith the color provided in theactivitytheme property.
- Color grid_major Color of major grid lines.
- Color grid_minor Color of minor grid lines.
- Color selection_fill The fill color of the selection rectangle.
- Color selection_stroke The outline color of the selection rectangle.
- int bezier_len_neg
- int bezier_len_pos
- int port_grab_distance_horizontal The horizontal range within which a port can be grabbed (on both sides).
- int port_grab_distance_vertical The vertical range within which a port can be grabbed (on both sides).
- Texture minimap
- Texture minus The icon for the zoom out button.
- Texture more The icon for the zoom in button.
- Texture reset The icon for the zoom reset button.
- Texture snap The icon for the snap toggle button.
- StyleBox bg The background drawn under the grid.
