Expose a few GraphEdit methods to script languages

This commit is contained in:
George Marques 2018-01-30 22:09:41 -02:00
parent 20a52aa39d
commit b80bc73a17
No known key found for this signature in database
GPG Key ID: 046BD46A3201E43D
2 changed files with 86 additions and 0 deletions

View File

@ -12,6 +12,42 @@
<demos> <demos>
</demos> </demos>
<methods> <methods>
<method name="add_valid_connection_type">
<return type="void">
</return>
<argument index="0" name="from_type" type="int">
</argument>
<argument index="1" name="to_type" type="int">
</argument>
<description>
Makes possible the connection between two different slot types. The type is defined with the [method GraphNode.set_slot] method.
</description>
</method>
<method name="add_valid_left_disconnect_type">
<return type="void">
</return>
<argument index="0" name="type" type="int">
</argument>
<description>
Makes possible to disconnect nodes when dragging from the slot at the left if it has the specified type.
</description>
</method>
<method name="add_valid_right_disconnect_type">
<return type="void">
</return>
<argument index="0" name="type" type="int">
</argument>
<description>
Makes possible to disconnect nodes when dragging from the slot at the right if it has the specified type.
</description>
</method>
<method name="clear_connections">
<return type="void">
</return>
<description>
Remove all connections between nodes.
</description>
</method>
<method name="connect_node"> <method name="connect_node">
<return type="int" enum="Error"> <return type="int" enum="Error">
</return> </return>
@ -64,12 +100,53 @@
Return true if the 'from_port' slot of 'from' GraphNode is connected to the 'to_port' slot of 'to' GraphNode. Return true if the 'from_port' slot of 'from' GraphNode is connected to the 'to_port' slot of 'to' GraphNode.
</description> </description>
</method> </method>
<method name="is_valid_connection_type" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="from_type" type="int">
</argument>
<argument index="1" name="to_type" type="int">
</argument>
<description>
Returns whether it's possible to connect slots of the specified types.
</description>
</method>
<method name="remove_valid_connection_type">
<return type="void">
</return>
<argument index="0" name="from_type" type="int">
</argument>
<argument index="1" name="to_type" type="int">
</argument>
<description>
Makes it not possible to connect between two different slot types. The type is defined with the [method GraphNode.set_slot] method.
</description>
</method>
<method name="remove_valid_left_disconnect_type">
<return type="void">
</return>
<argument index="0" name="type" type="int">
</argument>
<description>
Removes the possibility to disconnect nodes when dragging from the slot at the left if it has the specified type.
</description>
</method>
<method name="remove_valid_right_disconnect_type">
<return type="void">
</return>
<argument index="0" name="type" type="int">
</argument>
<description>
Removes the possibility to disconnect nodes when dragging from the slot at the right if it has the specified type.
</description>
</method>
<method name="set_selected"> <method name="set_selected">
<return type="void"> <return type="void">
</return> </return>
<argument index="0" name="node" type="Node"> <argument index="0" name="node" type="Node">
</argument> </argument>
<description> <description>
Sets the specified [code]node[/code] as the one selected.
</description> </description>
</method> </method>
</methods> </methods>

View File

@ -1147,9 +1147,18 @@ void GraphEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_node_connected", "from", "from_port", "to", "to_port"), &GraphEdit::is_node_connected); ClassDB::bind_method(D_METHOD("is_node_connected", "from", "from_port", "to", "to_port"), &GraphEdit::is_node_connected);
ClassDB::bind_method(D_METHOD("disconnect_node", "from", "from_port", "to", "to_port"), &GraphEdit::disconnect_node); ClassDB::bind_method(D_METHOD("disconnect_node", "from", "from_port", "to", "to_port"), &GraphEdit::disconnect_node);
ClassDB::bind_method(D_METHOD("get_connection_list"), &GraphEdit::_get_connection_list); ClassDB::bind_method(D_METHOD("get_connection_list"), &GraphEdit::_get_connection_list);
ClassDB::bind_method(D_METHOD("clear_connections"), &GraphEdit::clear_connections);
ClassDB::bind_method(D_METHOD("get_scroll_ofs"), &GraphEdit::get_scroll_ofs); ClassDB::bind_method(D_METHOD("get_scroll_ofs"), &GraphEdit::get_scroll_ofs);
ClassDB::bind_method(D_METHOD("set_scroll_ofs", "ofs"), &GraphEdit::set_scroll_ofs); ClassDB::bind_method(D_METHOD("set_scroll_ofs", "ofs"), &GraphEdit::set_scroll_ofs);
ClassDB::bind_method(D_METHOD("add_valid_right_disconnect_type", "type"), &GraphEdit::add_valid_right_disconnect_type);
ClassDB::bind_method(D_METHOD("remove_valid_right_disconnect_type", "type"), &GraphEdit::remove_valid_right_disconnect_type);
ClassDB::bind_method(D_METHOD("add_valid_left_disconnect_type", "type"), &GraphEdit::add_valid_left_disconnect_type);
ClassDB::bind_method(D_METHOD("remove_valid_left_disconnect_type", "type"), &GraphEdit::remove_valid_left_disconnect_type);
ClassDB::bind_method(D_METHOD("add_valid_connection_type", "from_type", "to_type"), &GraphEdit::add_valid_connection_type);
ClassDB::bind_method(D_METHOD("remove_valid_connection_type", "from_type", "to_type"), &GraphEdit::remove_valid_connection_type);
ClassDB::bind_method(D_METHOD("is_valid_connection_type", "from_type", "to_type"), &GraphEdit::is_valid_connection_type);
ClassDB::bind_method(D_METHOD("set_zoom", "p_zoom"), &GraphEdit::set_zoom); ClassDB::bind_method(D_METHOD("set_zoom", "p_zoom"), &GraphEdit::set_zoom);
ClassDB::bind_method(D_METHOD("get_zoom"), &GraphEdit::get_zoom); ClassDB::bind_method(D_METHOD("get_zoom"), &GraphEdit::get_zoom);