summaryrefslogtreecommitdiff
path: root/doc/classes/GraphEdit.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/GraphEdit.xml')
-rw-r--r--doc/classes/GraphEdit.xml58
1 files changed, 58 insertions, 0 deletions
diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml
index 76b255e273..be6d9e07c3 100644
--- a/doc/classes/GraphEdit.xml
+++ b/doc/classes/GraphEdit.xml
@@ -18,6 +18,43 @@
Virtual method which can be overridden to customize how connections are drawn.
</description>
</method>
+ <method name="_is_in_input_hotzone" qualifiers="virtual">
+ <return type="bool" />
+ <argument index="0" name="graph_node" type="Object" />
+ <argument index="1" name="slot_index" type="int" />
+ <argument index="2" name="mouse_position" type="Vector2" />
+ <description>
+ Returns whether the [code]mouse_position[/code] is in the input hot zone.
+ By default, a hot zone is a [Rect2] positioned such that its center is at [code]graph_node[/code].[method GraphNode.get_connection_input_position]([code]slot_index[/code]) (For output's case, call [method GraphNode.get_connection_output_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(graph_node, slot_index, mouse_position):
+ var slot_size : Vector2 = Vector2(get_theme_constant("port_grab_distance_horizontal"), get_theme_constant("port_grab_distance_vertical"))
+ var slot_pos : Vector2 = graph_node.get_position() + graph_node.get_connection_input_position(slot_index) - slot_size / 2
+ var rect = Rect2(slot_pos, slot_size)
+
+ return rect.has_point(mouse_position)
+ [/codeblock]
+ </description>
+ </method>
+ <method name="_is_in_output_hotzone" qualifiers="virtual">
+ <return type="bool" />
+ <argument index="0" name="graph_node" type="Object" />
+ <argument index="1" name="slot_index" type="int" />
+ <argument index="2" name="mouse_position" type="Vector2" />
+ <description>
+ Returns whether the [code]mouse_position[/code] 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(graph_node, slot_index, mouse_position):
+ var slot_size : Vector2 = Vector2(get_theme_constant("port_grab_distance_horizontal"), get_theme_constant("port_grab_distance_vertical"))
+ var slot_pos : Vector2 = graph_node.get_position() + graph_node.get_connection_output_position(slot_index) - slot_size / 2
+ var rect = Rect2(slot_pos, slot_size)
+
+ return rect.has_point(mouse_position)
+ [/codeblock]
+ </description>
+ </method>
<method name="add_valid_connection_type">
<return type="void" />
<argument index="0" name="from_type" type="int" />
@@ -72,6 +109,14 @@
Removes the connection between the [code]from_port[/code] slot of the [code]from[/code] GraphNode and the [code]to_port[/code] slot of the [code]to[/code] GraphNode. If the connection does not exist, no connection is removed.
</description>
</method>
+ <method name="force_connection_drag_end">
+ <return type="void" />
+ <description>
+ 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_begun] 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].
+ </description>
+ </method>
<method name="get_connection_line">
<return type="PackedVector2Array" />
<argument index="0" name="from" type="Vector2" />
@@ -204,6 +249,19 @@
Emitted at the beginning of a GraphNode movement.
</description>
</signal>
+ <signal name="connection_drag_begun">
+ <argument index="0" name="from" type="String" />
+ <argument index="1" name="slot" type="String" />
+ <argument index="2" name="is_output" type="bool" />
+ <description>
+ Emitted at the beginning of a connection drag.
+ </description>
+ </signal>
+ <signal name="connection_drag_ended">
+ <description>
+ Emitted at the end of a connection drag.
+ </description>
+ </signal>
<signal name="connection_from_empty">
<argument index="0" name="to" type="StringName" />
<argument index="1" name="to_slot" type="int" />