Merge pull request #64573 from KoBeWi/signal_name_plagiarism

Add "Copy Name" option to signal menu
This commit is contained in:
Rémi Verschelde 2022-08-26 00:00:44 +02:00 committed by GitHub
commit f3c906757c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -840,6 +840,9 @@ void ConnectionsDock::_handle_signal_menu_option(int p_option) {
disconnect_all_dialog->set_text(vformat(TTR("Are you sure you want to remove all connections from the \"%s\" signal?"), signal_name));
disconnect_all_dialog->popup_centered();
} break;
case COPY_NAME: {
DisplayServer::get_singleton()->clipboard_set(item->get_metadata(0).operator Dictionary()["name"]);
} break;
}
}
@ -1164,6 +1167,7 @@ ConnectionsDock::ConnectionsDock() {
signal_menu->connect("id_pressed", callable_mp(this, &ConnectionsDock::_handle_signal_menu_option));
signal_menu->add_item(TTR("Connect..."), CONNECT);
signal_menu->add_item(TTR("Disconnect All"), DISCONNECT_ALL);
signal_menu->add_item(TTR("Copy Name"), COPY_NAME);
slot_menu = memnew(PopupMenu);
add_child(slot_menu);

View file

@ -177,13 +177,14 @@ class ConnectionsDock : public VBoxContainer {
//Right-click Pop-up Menu Options.
enum SignalMenuOption {
CONNECT,
DISCONNECT_ALL
DISCONNECT_ALL,
COPY_NAME,
};
enum SlotMenuOption {
EDIT,
GO_TO_SCRIPT,
DISCONNECT
DISCONNECT,
};
Node *selected_node = nullptr;