From d0185402b52018f4ccea9039471010a70e61c247 Mon Sep 17 00:00:00 2001 From: Danil Alexeev Date: Tue, 4 Jan 2022 20:24:43 +0300 Subject: [PATCH] Add Default Callback Name editor setting Adds the "interface/editors/default_signal_callback_name" editor setting, which allows you to specify the format of the default callback name in the Signal Connection Dialog. --- editor/connections_dialog.cpp | 258 ++++++++++++++++++---------------- editor/connections_dialog.h | 26 ++-- 2 files changed, 152 insertions(+), 132 deletions(-) diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 8f4b677929b..0edbb182e10 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -340,7 +340,7 @@ bool ConnectDialog::get_oneshot() const { * Returns true if ConnectDialog is being used to edit an existing connection. */ bool ConnectDialog::is_editing() const { - return bEditMode; + return edit_mode; } /* @@ -348,35 +348,35 @@ bool ConnectDialog::is_editing() const { * If creating a connection from scratch, sensible defaults are used. * If editing an existing connection, previous data is retained. */ -void ConnectDialog::init(ConnectionData c, bool bEdit) { +void ConnectDialog::init(ConnectionData p_cd, bool p_edit) { set_hide_on_ok(false); - source = static_cast(c.source); - signal = c.signal; + source = static_cast(p_cd.source); + signal = p_cd.signal; tree->set_selected(nullptr); tree->set_marked(source, true); - if (c.target) { - set_dst_node(static_cast(c.target)); - set_dst_method(c.method); + if (p_cd.target) { + set_dst_node(static_cast(p_cd.target)); + set_dst_method(p_cd.method); } _update_ok_enabled(); - bool bDeferred = (c.flags & CONNECT_DEFERRED) == CONNECT_DEFERRED; - bool bOneshot = (c.flags & CONNECT_ONESHOT) == CONNECT_ONESHOT; + bool b_deferred = (p_cd.flags & CONNECT_DEFERRED) == CONNECT_DEFERRED; + bool b_oneshot = (p_cd.flags & CONNECT_ONESHOT) == CONNECT_ONESHOT; - deferred->set_pressed(bDeferred); - oneshot->set_pressed(bOneshot); - unbind_count->set_value(c.unbinds); - _unbind_count_changed(c.unbinds); + deferred->set_pressed(b_deferred); + oneshot->set_pressed(b_oneshot); + unbind_count->set_value(p_cd.unbinds); + _unbind_count_changed(p_cd.unbinds); cdbinds->params.clear(); - cdbinds->params = c.binds; + cdbinds->params = p_cd.binds; cdbinds->notify_changed(); - bEditMode = bEdit; + edit_mode = p_edit; } void ConnectDialog::popup_dialog(const String &p_for_signal) { @@ -546,7 +546,7 @@ Control *ConnectionsDockTree::make_custom_tooltip(const String &p_text) const { String text = TTR("Signal:") + " [u][b]" + p_text.get_slice("::", 0) + "[/b][/u]"; text += p_text.get_slice("::", 1).strip_edges() + "\n"; text += p_text.get_slice("::", 2).strip_edges(); - help_bit->call_deferred(SNAME("set_text"), text); //hack so it uses proper theme once inside scene + help_bit->call_deferred(SNAME("set_text"), text); // Hack so it uses proper theme once inside scene. return help_bit; } @@ -569,32 +569,32 @@ void ConnectionsDock::_make_or_edit_connection() { ERR_FAIL_COND(!it); NodePath dst_path = connect_dialog->get_dst_path(); - Node *target = selectedNode->get_node(dst_path); + Node *target = selected_node->get_node(dst_path); ERR_FAIL_COND(!target); - ConnectDialog::ConnectionData connection; - connection.source = connect_dialog->get_source(); - connection.target = target; - connection.signal = connect_dialog->get_signal_name(); - connection.method = connect_dialog->get_dst_method_name(); - connection.unbinds = connect_dialog->get_unbinds(); - if (connection.unbinds == 0) { - connection.binds = connect_dialog->get_binds(); + ConnectDialog::ConnectionData cd; + cd.source = connect_dialog->get_source(); + cd.target = target; + cd.signal = connect_dialog->get_signal_name(); + cd.method = connect_dialog->get_dst_method_name(); + cd.unbinds = connect_dialog->get_unbinds(); + if (cd.unbinds == 0) { + cd.binds = connect_dialog->get_binds(); } - bool defer = connect_dialog->get_deferred(); - bool oshot = connect_dialog->get_oneshot(); - connection.flags = CONNECT_PERSIST | (defer ? CONNECT_DEFERRED : 0) | (oshot ? CONNECT_ONESHOT : 0); + bool b_deferred = connect_dialog->get_deferred(); + bool b_oneshot = connect_dialog->get_oneshot(); + cd.flags = CONNECT_PERSIST | (b_deferred ? CONNECT_DEFERRED : 0) | (b_oneshot ? CONNECT_ONESHOT : 0); // Conditions to add function: must have a script and must not have the method already // (in the class, the script itself, or inherited). bool add_script_function = false; Ref