diff options
Diffstat (limited to 'editor/connections_dialog.h')
-rw-r--r-- | editor/connections_dialog.h | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h index 7e39d7d904..a4ed68b44e 100644 --- a/editor/connections_dialog.h +++ b/editor/connections_dialog.h @@ -53,6 +53,36 @@ class ConnectDialog : public ConfirmationDialog { GDCLASS(ConnectDialog, ConfirmationDialog); +public: + struct ConnectionData { + Node *source = nullptr; + Node *target = nullptr; + StringName signal; + StringName method; + uint32_t flags = 0; + Vector<Variant> binds; + + ConnectionData() { + } + ConnectionData(const Connection &p_connection) { + source = Object::cast_to<Node>(p_connection.signal.get_object()); + signal = p_connection.signal.get_name(); + target = Object::cast_to<Node>(p_connection.callable.get_object()); + method = p_connection.callable.get_method(); + flags = p_connection.flags; + binds = p_connection.binds; + } + operator Connection() { + Connection c; + c.signal = ::Signal(source, signal); + c.callable = Callable(target, method); + c.flags = flags; + c.binds = binds; + return c; + } + }; + +private: Label *connect_to_label; LineEdit *from_signal; Node *source; @@ -98,7 +128,7 @@ public: bool get_oneshot() const; bool is_editing() const; - void init(Connection c, bool bEdit = false); + void init(ConnectionData c, bool bEdit = false); void popup_dialog(const String &p_for_signal); ConnectDialog(); @@ -144,7 +174,7 @@ class ConnectionsDock : public VBoxContainer { Map<StringName, Map<StringName, String> > descr_cache; void _make_or_edit_connection(); - void _connect(Connection cToMake); + void _connect(ConnectDialog::ConnectionData cToMake); void _disconnect(TreeItem &item); void _disconnect_all(); @@ -153,7 +183,7 @@ class ConnectionsDock : public VBoxContainer { bool _is_item_signal(TreeItem &item); void _open_connection_dialog(TreeItem &item); - void _open_connection_dialog(Connection cToEdit); + void _open_connection_dialog(ConnectDialog::ConnectionData cToEdit); void _go_to_script(TreeItem &item); void _handle_signal_menu_option(int option); |