Skip to content

Commit

Permalink
Merge pull request #36426 from akien-mga/calling-all-stations
Browse files Browse the repository at this point in the history
Signals: Port connect calls to use callable_mp
  • Loading branch information
akien-mga authored Feb 28, 2020
2 parents a439131 + 32ccf30 commit 324e5a6
Show file tree
Hide file tree
Showing 194 changed files with 2,066 additions and 3,574 deletions.
4 changes: 3 additions & 1 deletion core/callable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ ObjectID Callable::get_object_id() const {
}
}
StringName Callable::get_method() const {
ERR_FAIL_COND_V(is_custom(), StringName());
ERR_FAIL_COND_V_MSG(is_custom(), StringName(),
vformat("Can't get method on CallableCustom \"%s\".", operator String()));
return method;
}

uint32_t Callable::hash() const {
if (is_custom()) {
return custom->hash();
Expand Down
25 changes: 10 additions & 15 deletions core/io/multiplayer_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,22 +149,22 @@ void MultiplayerAPI::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_pee
"Supplied NetworkedMultiplayerPeer must be connecting or connected.");

if (network_peer.is_valid()) {
network_peer->disconnect_compat("peer_connected", this, "_add_peer");
network_peer->disconnect_compat("peer_disconnected", this, "_del_peer");
network_peer->disconnect_compat("connection_succeeded", this, "_connected_to_server");
network_peer->disconnect_compat("connection_failed", this, "_connection_failed");
network_peer->disconnect_compat("server_disconnected", this, "_server_disconnected");
network_peer->disconnect("peer_connected", callable_mp(this, &MultiplayerAPI::_add_peer));
network_peer->disconnect("peer_disconnected", callable_mp(this, &MultiplayerAPI::_del_peer));
network_peer->disconnect("connection_succeeded", callable_mp(this, &MultiplayerAPI::_connected_to_server));
network_peer->disconnect("connection_failed", callable_mp(this, &MultiplayerAPI::_connection_failed));
network_peer->disconnect("server_disconnected", callable_mp(this, &MultiplayerAPI::_server_disconnected));
clear();
}

network_peer = p_peer;

if (network_peer.is_valid()) {
network_peer->connect_compat("peer_connected", this, "_add_peer");
network_peer->connect_compat("peer_disconnected", this, "_del_peer");
network_peer->connect_compat("connection_succeeded", this, "_connected_to_server");
network_peer->connect_compat("connection_failed", this, "_connection_failed");
network_peer->connect_compat("server_disconnected", this, "_server_disconnected");
network_peer->connect("peer_connected", callable_mp(this, &MultiplayerAPI::_add_peer));
network_peer->connect("peer_disconnected", callable_mp(this, &MultiplayerAPI::_del_peer));
network_peer->connect("connection_succeeded", callable_mp(this, &MultiplayerAPI::_connected_to_server));
network_peer->connect("connection_failed", callable_mp(this, &MultiplayerAPI::_connection_failed));
network_peer->connect("server_disconnected", callable_mp(this, &MultiplayerAPI::_server_disconnected));
}
}

Expand Down Expand Up @@ -1317,15 +1317,10 @@ void MultiplayerAPI::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_network_unique_id"), &MultiplayerAPI::get_network_unique_id);
ClassDB::bind_method(D_METHOD("is_network_server"), &MultiplayerAPI::is_network_server);
ClassDB::bind_method(D_METHOD("get_rpc_sender_id"), &MultiplayerAPI::get_rpc_sender_id);
ClassDB::bind_method(D_METHOD("_add_peer", "id"), &MultiplayerAPI::_add_peer);
ClassDB::bind_method(D_METHOD("_del_peer", "id"), &MultiplayerAPI::_del_peer);
ClassDB::bind_method(D_METHOD("set_network_peer", "peer"), &MultiplayerAPI::set_network_peer);
ClassDB::bind_method(D_METHOD("poll"), &MultiplayerAPI::poll);
ClassDB::bind_method(D_METHOD("clear"), &MultiplayerAPI::clear);

ClassDB::bind_method(D_METHOD("_connected_to_server"), &MultiplayerAPI::_connected_to_server);
ClassDB::bind_method(D_METHOD("_connection_failed"), &MultiplayerAPI::_connection_failed);
ClassDB::bind_method(D_METHOD("_server_disconnected"), &MultiplayerAPI::_server_disconnected);
ClassDB::bind_method(D_METHOD("get_network_connected_peers"), &MultiplayerAPI::get_network_connected_peers);
ClassDB::bind_method(D_METHOD("set_refuse_new_network_connections", "refuse"), &MultiplayerAPI::set_refuse_new_network_connections);
ClassDB::bind_method(D_METHOD("is_refusing_new_network_connections"), &MultiplayerAPI::is_refusing_new_network_connections);
Expand Down
9 changes: 3 additions & 6 deletions editor/animation_bezier_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ void AnimationBezierTrackEdit::set_undo_redo(UndoRedo *p_undo_redo) {

void AnimationBezierTrackEdit::set_timeline(AnimationTimelineEdit *p_timeline) {
timeline = p_timeline;
timeline->connect_compat("zoom_changed", this, "_zoom_changed");
timeline->connect("zoom_changed", callable_mp(this, &AnimationBezierTrackEdit::_zoom_changed));
}
void AnimationBezierTrackEdit::set_editor(AnimationTrackEditor *p_editor) {
editor = p_editor;
Expand Down Expand Up @@ -1141,10 +1141,7 @@ void AnimationBezierTrackEdit::set_block_animation_update_ptr(bool *p_block_ptr)

void AnimationBezierTrackEdit::_bind_methods() {

ClassDB::bind_method("_zoom_changed", &AnimationBezierTrackEdit::_zoom_changed);
ClassDB::bind_method("_menu_selected", &AnimationBezierTrackEdit::_menu_selected);
ClassDB::bind_method("_gui_input", &AnimationBezierTrackEdit::_gui_input);
ClassDB::bind_method("_play_position_draw", &AnimationBezierTrackEdit::_play_position_draw);

ClassDB::bind_method("_clear_selection", &AnimationBezierTrackEdit::_clear_selection);
ClassDB::bind_method("_clear_selection_for_anim", &AnimationBezierTrackEdit::_clear_selection_for_anim);
Expand Down Expand Up @@ -1184,7 +1181,7 @@ AnimationBezierTrackEdit::AnimationBezierTrackEdit() {
play_position->set_mouse_filter(MOUSE_FILTER_PASS);
add_child(play_position);
play_position->set_anchors_and_margins_preset(PRESET_WIDE);
play_position->connect_compat("draw", this, "_play_position_draw");
play_position->connect("draw", callable_mp(this, &AnimationBezierTrackEdit::_play_position_draw));
set_focus_mode(FOCUS_CLICK);

v_scroll = 0;
Expand All @@ -1198,7 +1195,7 @@ AnimationBezierTrackEdit::AnimationBezierTrackEdit() {

menu = memnew(PopupMenu);
add_child(menu);
menu->connect_compat("id_pressed", this, "_menu_selected");
menu->connect("id_pressed", callable_mp(this, &AnimationBezierTrackEdit::_menu_selected));

//set_mouse_filter(MOUSE_FILTER_PASS); //scroll has to work too for selection
}
Loading

0 comments on commit 324e5a6

Please sign in to comment.