diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-02-21 18:28:45 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-02-28 14:24:09 +0100 |
commit | 01afc442c73661df677c2b93f4037a21992ee45b (patch) | |
tree | 9a5b0b68cb022873ba31929fe6a785ddf5c0555c /modules/visual_script | |
parent | a439131c2b06b3d452e5be13530b6d2caa72c1aa (diff) |
Signals: Port connect calls to use callable_mp
Remove now unnecessary bindings of signal callbacks in the public API.
There might be some false positives that need rebinding if they were
meant to be public.
No regular expressions were harmed in the making of this commit.
(Nah, just kidding.)
Diffstat (limited to 'modules/visual_script')
-rw-r--r-- | modules/visual_script/visual_script.cpp | 8 | ||||
-rw-r--r-- | modules/visual_script/visual_script_editor.cpp | 162 | ||||
-rw-r--r-- | modules/visual_script/visual_script_nodes.cpp | 4 | ||||
-rw-r--r-- | modules/visual_script/visual_script_property_selector.cpp | 15 |
4 files changed, 63 insertions, 126 deletions
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 5036840413..b05200b7de 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -198,7 +198,7 @@ void VisualScript::remove_function(const StringName &p_name) { for (Map<int, Function::NodeData>::Element *E = functions[p_name].nodes.front(); E; E = E->next()) { - E->get().node->disconnect_compat("ports_changed", this, "_node_ports_changed"); + E->get().node->disconnect("ports_changed", callable_mp(this, &VisualScript::_node_ports_changed)); E->get().node->scripts_used.erase(this); } @@ -340,7 +340,7 @@ void VisualScript::add_node(const StringName &p_func, int p_id, const Ref<Visual nd.pos = p_pos; Ref<VisualScriptNode> vsn = p_node; - vsn->connect_compat("ports_changed", this, "_node_ports_changed", varray(p_id)); + vsn->connect("ports_changed", callable_mp(this, &VisualScript::_node_ports_changed), varray(p_id)); vsn->scripts_used.insert(this); vsn->validate_input_default_values(); // Validate when fully loaded @@ -389,7 +389,7 @@ void VisualScript::remove_node(const StringName &p_func, int p_id) { func.function_id = -1; //revert to invalid } - func.nodes[p_id].node->disconnect_compat("ports_changed", this, "_node_ports_changed"); + func.nodes[p_id].node->disconnect("ports_changed", callable_mp(this, &VisualScript::_node_ports_changed)); func.nodes[p_id].node->scripts_used.erase(this); func.nodes.erase(p_id); @@ -1373,8 +1373,6 @@ Dictionary VisualScript::_get_data() const { void VisualScript::_bind_methods() { - ClassDB::bind_method(D_METHOD("_node_ports_changed"), &VisualScript::_node_ports_changed); - ClassDB::bind_method(D_METHOD("add_function", "name"), &VisualScript::add_function); ClassDB::bind_method(D_METHOD("has_function", "name"), &VisualScript::has_function); ClassDB::bind_method(D_METHOD("remove_function", "name"), &VisualScript::remove_function); diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 0bbef066a4..8259e5eb9a 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -560,8 +560,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) { gnode->set_meta("__vnode", node); gnode->set_name(itos(E->get())); - gnode->connect_compat("dragged", this, "_node_moved", varray(E->get())); - gnode->connect_compat("close_request", this, "_remove_node", varray(E->get()), CONNECT_DEFERRED); + gnode->connect("dragged", callable_mp(this, &VisualScriptEditor::_node_moved), varray(E->get())); + gnode->connect("close_request", callable_mp(this, &VisualScriptEditor::_remove_node), varray(E->get()), CONNECT_DEFERRED); if (E->get() != script->get_function_node_id(F->get())) { //function can't be erased @@ -579,7 +579,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { Button *btn = memnew(Button); btn->set_text(TTR("Add Input Port")); hbnc->add_child(btn); - btn->connect_compat("pressed", this, "_add_input_port", varray(E->get()), CONNECT_DEFERRED); + btn->connect("pressed", callable_mp(this, &VisualScriptEditor::_add_input_port), varray(E->get()), CONNECT_DEFERRED); } if (nd_list->is_output_port_editable()) { if (nd_list->is_input_port_editable()) @@ -588,7 +588,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { Button *btn = memnew(Button); btn->set_text(TTR("Add Output Port")); hbnc->add_child(btn); - btn->connect_compat("pressed", this, "_add_output_port", varray(E->get()), CONNECT_DEFERRED); + btn->connect("pressed", callable_mp(this, &VisualScriptEditor::_add_output_port), varray(E->get()), CONNECT_DEFERRED); } gnode->add_child(hbnc); } else if (Object::cast_to<VisualScriptExpression>(node.ptr())) { @@ -598,7 +598,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { line_edit->set_expand_to_text_length(true); line_edit->add_font_override("font", get_font("source", "EditorFonts")); gnode->add_child(line_edit); - line_edit->connect_compat("text_changed", this, "_expression_text_changed", varray(E->get())); + line_edit->connect("text_changed", callable_mp(this, &VisualScriptEditor::_expression_text_changed), varray(E->get())); } else { String text = node->get_text(); if (!text.empty()) { @@ -614,7 +614,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { gnode->set_comment(true); gnode->set_resizable(true); gnode->set_custom_minimum_size(vsc->get_size() * EDSCALE); - gnode->connect_compat("resize_request", this, "_comment_node_resized", varray(E->get())); + gnode->connect("resize_request", callable_mp(this, &VisualScriptEditor::_comment_node_resized), varray(E->get())); } if (node_styles.has(node->get_category())) { @@ -732,8 +732,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) { name_box->set_custom_minimum_size(Size2(60 * EDSCALE, 0)); name_box->set_text(left_name); name_box->set_expand_to_text_length(true); - name_box->connect_compat("resized", this, "_update_node_size", varray(E->get())); - name_box->connect_compat("focus_exited", this, "_port_name_focus_out", varray(name_box, E->get(), i, true)); + name_box->connect("resized", callable_mp(this, &VisualScriptEditor::_update_node_size), varray(E->get())); + name_box->connect("focus_exited", callable_mp(this, &VisualScriptEditor::_port_name_focus_out), varray(name_box, E->get(), i, true)); } else { hbc->add_child(memnew(Label(left_name))); } @@ -746,13 +746,13 @@ void VisualScriptEditor::_update_graph(int p_only_id) { opbtn->select(left_type); opbtn->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); hbc->add_child(opbtn); - opbtn->connect_compat("item_selected", this, "_change_port_type", varray(E->get(), i, true), CONNECT_DEFERRED); + opbtn->connect("item_selected", callable_mp(this, &VisualScriptEditor::_change_port_type), varray(E->get(), i, true), CONNECT_DEFERRED); } Button *rmbtn = memnew(Button); rmbtn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons")); hbc->add_child(rmbtn); - rmbtn->connect_compat("pressed", this, "_remove_input_port", varray(E->get(), i), CONNECT_DEFERRED); + rmbtn->connect("pressed", callable_mp(this, &VisualScriptEditor::_remove_input_port), varray(E->get(), i), CONNECT_DEFERRED); } else { hbc->add_child(memnew(Label(left_name))); } @@ -772,7 +772,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { if (left_type == Variant::COLOR) { button->set_custom_minimum_size(Size2(30, 0) * EDSCALE); - button->connect_compat("draw", this, "_draw_color_over_button", varray(button, value)); + button->connect("draw", callable_mp(this, &VisualScriptEditor::_draw_color_over_button), varray(button, value)); } else if (left_type == Variant::OBJECT && Ref<Resource>(value).is_valid()) { Ref<Resource> res = value; @@ -788,7 +788,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { button->set_text(value); } - button->connect_compat("pressed", this, "_default_value_edited", varray(button, E->get(), i)); + button->connect("pressed", callable_mp(this, &VisualScriptEditor::_default_value_edited), varray(button, E->get(), i)); hbc2->add_child(button); } } else { @@ -814,7 +814,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { Button *rmbtn = memnew(Button); rmbtn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons")); hbc->add_child(rmbtn); - rmbtn->connect_compat("pressed", this, "_remove_output_port", varray(E->get(), i), CONNECT_DEFERRED); + rmbtn->connect("pressed", callable_mp(this, &VisualScriptEditor::_remove_output_port), varray(E->get(), i), CONNECT_DEFERRED); if (nd_list->is_output_port_type_editable()) { OptionButton *opbtn = memnew(OptionButton); @@ -824,7 +824,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { opbtn->select(right_type); opbtn->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); hbc->add_child(opbtn); - opbtn->connect_compat("item_selected", this, "_change_port_type", varray(E->get(), i, false), CONNECT_DEFERRED); + opbtn->connect("item_selected", callable_mp(this, &VisualScriptEditor::_change_port_type), varray(E->get(), i, false), CONNECT_DEFERRED); } if (nd_list->is_output_port_name_editable()) { @@ -833,8 +833,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) { name_box->set_custom_minimum_size(Size2(60 * EDSCALE, 0)); name_box->set_text(right_name); name_box->set_expand_to_text_length(true); - name_box->connect_compat("resized", this, "_update_node_size", varray(E->get())); - name_box->connect_compat("focus_exited", this, "_port_name_focus_out", varray(name_box, E->get(), i, false)); + name_box->connect("resized", callable_mp(this, &VisualScriptEditor::_update_node_size), varray(E->get())); + name_box->connect("focus_exited", callable_mp(this, &VisualScriptEditor::_port_name_focus_out), varray(name_box, E->get(), i, false)); } else { hbc->add_child(memnew(Label(right_name))); } @@ -1237,7 +1237,7 @@ void VisualScriptEditor::_add_func_input() { LineEdit *name_box = memnew(LineEdit); name_box->set_h_size_flags(SIZE_EXPAND_FILL); name_box->set_text("input"); - name_box->connect_compat("focus_entered", this, "_deselect_input_names"); + name_box->connect("focus_entered", callable_mp(this, &VisualScriptEditor::_deselect_input_names)); hbox->add_child(name_box); Label *type_label = memnew(Label); @@ -1264,7 +1264,7 @@ void VisualScriptEditor::_add_func_input() { func_input_vbox->add_child(hbox); hbox->set_meta("id", hbox->get_position_in_parent()); - delete_button->connect_compat("pressed", this, "_remove_func_input", varray(hbox)); + delete_button->connect("pressed", callable_mp(this, &VisualScriptEditor::_remove_func_input), varray(hbox)); name_box->select_all(); name_box->grab_focus(); @@ -2420,7 +2420,7 @@ void VisualScriptEditor::set_edited_resource(const RES &p_res) { variable_editor->script = script; variable_editor->undo_redo = undo_redo; - script->connect_compat("node_ports_changed", this, "_node_ports_changed"); + script->connect("node_ports_changed", callable_mp(this, &VisualScriptEditor::_node_ports_changed)); default_func = script->get_default_func(); @@ -3916,8 +3916,8 @@ void VisualScriptEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { - variable_editor->connect_compat("changed", this, "_update_members"); - signal_editor->connect_compat("changed", this, "_update_members"); + variable_editor->connect("changed", callable_mp(this, &VisualScriptEditor::_update_members)); + signal_editor->connect("changed", callable_mp(this, &VisualScriptEditor::_update_members)); [[fallthrough]]; } case NOTIFICATION_THEME_CHANGED: { @@ -4613,77 +4613,23 @@ void VisualScriptEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter void VisualScriptEditor::_bind_methods() { - ClassDB::bind_method("_member_button", &VisualScriptEditor::_member_button); - ClassDB::bind_method("_member_edited", &VisualScriptEditor::_member_edited); - ClassDB::bind_method("_member_selected", &VisualScriptEditor::_member_selected); - ClassDB::bind_method("_update_members", &VisualScriptEditor::_update_members); - ClassDB::bind_method("_members_gui_input", &VisualScriptEditor::_members_gui_input); - ClassDB::bind_method("_member_rmb_selected", &VisualScriptEditor::_member_rmb_selected); - ClassDB::bind_method("_member_option", &VisualScriptEditor::_member_option); - ClassDB::bind_method("_fn_name_box_input", &VisualScriptEditor::_fn_name_box_input); - - ClassDB::bind_method("_change_base_type", &VisualScriptEditor::_change_base_type); - ClassDB::bind_method("_change_base_type_callback", &VisualScriptEditor::_change_base_type_callback); - ClassDB::bind_method("_toggle_tool_script", &VisualScriptEditor::_toggle_tool_script); - ClassDB::bind_method("_node_selected", &VisualScriptEditor::_node_selected); - ClassDB::bind_method("_node_moved", &VisualScriptEditor::_node_moved); ClassDB::bind_method("_move_node", &VisualScriptEditor::_move_node); - ClassDB::bind_method("_begin_node_move", &VisualScriptEditor::_begin_node_move); - ClassDB::bind_method("_end_node_move", &VisualScriptEditor::_end_node_move); - ClassDB::bind_method("_remove_node", &VisualScriptEditor::_remove_node); ClassDB::bind_method("_update_graph", &VisualScriptEditor::_update_graph, DEFVAL(-1)); - ClassDB::bind_method("_node_ports_changed", &VisualScriptEditor::_node_ports_changed); - - ClassDB::bind_method("_create_function_dialog", &VisualScriptEditor::_create_function_dialog); - ClassDB::bind_method("_create_function", &VisualScriptEditor::_create_function); - ClassDB::bind_method("_add_node_dialog", &VisualScriptEditor::_add_node_dialog); - ClassDB::bind_method("_add_func_input", &VisualScriptEditor::_add_func_input); - ClassDB::bind_method("_remove_func_input", &VisualScriptEditor::_remove_func_input); - ClassDB::bind_method("_deselect_input_names", &VisualScriptEditor::_deselect_input_names); - - ClassDB::bind_method("_default_value_edited", &VisualScriptEditor::_default_value_edited); - ClassDB::bind_method("_default_value_changed", &VisualScriptEditor::_default_value_changed); - ClassDB::bind_method("_menu_option", &VisualScriptEditor::_menu_option); - ClassDB::bind_method("_graph_ofs_changed", &VisualScriptEditor::_graph_ofs_changed); + ClassDB::bind_method("_center_on_node", &VisualScriptEditor::_center_on_node); - ClassDB::bind_method("_comment_node_resized", &VisualScriptEditor::_comment_node_resized); ClassDB::bind_method("_button_resource_previewed", &VisualScriptEditor::_button_resource_previewed); ClassDB::bind_method("_port_action_menu", &VisualScriptEditor::_port_action_menu); - ClassDB::bind_method("_selected_connect_node", &VisualScriptEditor::_selected_connect_node); - ClassDB::bind_method("_selected_new_virtual_method", &VisualScriptEditor::_selected_new_virtual_method); - ClassDB::bind_method("_cancel_connect_node", &VisualScriptEditor::_cancel_connect_node); ClassDB::bind_method("_create_new_node_from_name", &VisualScriptEditor::_create_new_node_from_name); - ClassDB::bind_method("_expression_text_changed", &VisualScriptEditor::_expression_text_changed); - ClassDB::bind_method("_add_input_port", &VisualScriptEditor::_add_input_port); - ClassDB::bind_method("_add_output_port", &VisualScriptEditor::_add_output_port); - ClassDB::bind_method("_remove_input_port", &VisualScriptEditor::_remove_input_port); - ClassDB::bind_method("_remove_output_port", &VisualScriptEditor::_remove_output_port); - ClassDB::bind_method("_change_port_type", &VisualScriptEditor::_change_port_type); - ClassDB::bind_method("_update_node_size", &VisualScriptEditor::_update_node_size); - ClassDB::bind_method("_port_name_focus_out", &VisualScriptEditor::_port_name_focus_out); ClassDB::bind_method("get_drag_data_fw", &VisualScriptEditor::get_drag_data_fw); ClassDB::bind_method("can_drop_data_fw", &VisualScriptEditor::can_drop_data_fw); ClassDB::bind_method("drop_data_fw", &VisualScriptEditor::drop_data_fw); ClassDB::bind_method("_input", &VisualScriptEditor::_input); - ClassDB::bind_method("_graph_gui_input", &VisualScriptEditor::_graph_gui_input); - - ClassDB::bind_method("_on_nodes_delete", &VisualScriptEditor::_on_nodes_delete); - ClassDB::bind_method("_on_nodes_duplicate", &VisualScriptEditor::_on_nodes_duplicate); - - ClassDB::bind_method("_hide_timer", &VisualScriptEditor::_hide_timer); - - ClassDB::bind_method("_graph_connected", &VisualScriptEditor::_graph_connected); - ClassDB::bind_method("_graph_disconnected", &VisualScriptEditor::_graph_disconnected); - ClassDB::bind_method("_graph_connect_to_empty", &VisualScriptEditor::_graph_connect_to_empty); ClassDB::bind_method("_update_graph_connections", &VisualScriptEditor::_update_graph_connections); - ClassDB::bind_method("_selected_method", &VisualScriptEditor::_selected_method); - ClassDB::bind_method("_draw_color_over_button", &VisualScriptEditor::_draw_color_over_button); - ClassDB::bind_method("_generic_search", &VisualScriptEditor::_generic_search); } @@ -4709,7 +4655,7 @@ VisualScriptEditor::VisualScriptEditor() { edit_menu->get_popup()->add_separator(); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/create_function"), EDIT_CREATE_FUNCTION); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("visual_script_editor/refresh_nodes"), REFRESH_GRAPH); - edit_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + edit_menu->get_popup()->connect("id_pressed", callable_mp(this, &VisualScriptEditor::_menu_option)); members_section = memnew(VBoxContainer); // Add but wait until done setting up this. @@ -4719,7 +4665,7 @@ VisualScriptEditor::VisualScriptEditor() { CheckButton *tool_script_check = memnew(CheckButton); tool_script_check->set_text(TTR("Make Tool:")); members_section->add_child(tool_script_check); - tool_script_check->connect_compat("pressed", this, "_toggle_tool_script"); + tool_script_check->connect("pressed", callable_mp(this, &VisualScriptEditor::_toggle_tool_script)); /// Members /// @@ -4727,11 +4673,11 @@ VisualScriptEditor::VisualScriptEditor() { members_section->add_margin_child(TTR("Members:"), members, true); members->set_custom_minimum_size(Size2(0, 50 * EDSCALE)); members->set_hide_root(true); - members->connect_compat("button_pressed", this, "_member_button"); - members->connect_compat("item_edited", this, "_member_edited"); - members->connect_compat("cell_selected", this, "_member_selected", varray(), CONNECT_DEFERRED); - members->connect_compat("gui_input", this, "_members_gui_input"); - members->connect_compat("item_rmb_selected", this, "_member_rmb_selected"); + members->connect("button_pressed", callable_mp(this, &VisualScriptEditor::_member_button)); + members->connect("item_edited", callable_mp(this, &VisualScriptEditor::_member_edited)); + members->connect("cell_selected", callable_mp(this, &VisualScriptEditor::_member_selected), varray(), CONNECT_DEFERRED); + members->connect("gui_input", callable_mp(this, &VisualScriptEditor::_members_gui_input)); + members->connect("item_rmb_selected", callable_mp(this, &VisualScriptEditor::_member_rmb_selected)); members->set_allow_rmb_select(true); members->set_allow_reselect(true); members->set_hide_folding(true); @@ -4739,13 +4685,13 @@ VisualScriptEditor::VisualScriptEditor() { member_popup = memnew(PopupMenu); add_child(member_popup); - member_popup->connect_compat("id_pressed", this, "_member_option"); + member_popup->connect("id_pressed", callable_mp(this, &VisualScriptEditor::_member_option)); function_name_edit = memnew(PopupDialog); function_name_box = memnew(LineEdit); function_name_edit->add_child(function_name_box); function_name_edit->set_h_size_flags(SIZE_EXPAND); - function_name_box->connect_compat("gui_input", this, "_fn_name_box_input"); + function_name_box->connect("gui_input", callable_mp(this, &VisualScriptEditor::_fn_name_box_input)); function_name_box->set_expand_to_text_length(true); add_child(function_name_edit); @@ -4755,15 +4701,15 @@ VisualScriptEditor::VisualScriptEditor() { add_child(graph); graph->set_v_size_flags(Control::SIZE_EXPAND_FILL); graph->set_anchors_and_margins_preset(Control::PRESET_WIDE); - graph->connect_compat("node_selected", this, "_node_selected"); - graph->connect_compat("_begin_node_move", this, "_begin_node_move"); - graph->connect_compat("_end_node_move", this, "_end_node_move"); - graph->connect_compat("delete_nodes_request", this, "_on_nodes_delete"); - graph->connect_compat("duplicate_nodes_request", this, "_on_nodes_duplicate"); - graph->connect_compat("gui_input", this, "_graph_gui_input"); + graph->connect("node_selected", callable_mp(this, &VisualScriptEditor::_node_selected)); + graph->connect("_begin_node_move", callable_mp(this, &VisualScriptEditor::_begin_node_move)); + graph->connect("_end_node_move", callable_mp(this, &VisualScriptEditor::_end_node_move)); + graph->connect("delete_nodes_request", callable_mp(this, &VisualScriptEditor::_on_nodes_delete)); + graph->connect("duplicate_nodes_request", callable_mp(this, &VisualScriptEditor::_on_nodes_duplicate)); + graph->connect("gui_input", callable_mp(this, &VisualScriptEditor::_graph_gui_input)); graph->set_drag_forwarding(this); graph->hide(); - graph->connect_compat("scroll_offset_changed", this, "_graph_ofs_changed"); + graph->connect("scroll_offset_changed", callable_mp(this, &VisualScriptEditor::_graph_ofs_changed)); /// Add Buttons to Top Bar/Zoom bar. HBoxContainer *graph_hbc = graph->get_zoom_hbox(); @@ -4773,18 +4719,18 @@ VisualScriptEditor::VisualScriptEditor() { graph_hbc->add_child(base_lbl); base_type_select = memnew(Button); - base_type_select->connect_compat("pressed", this, "_change_base_type"); + base_type_select->connect("pressed", callable_mp(this, &VisualScriptEditor::_change_base_type)); graph_hbc->add_child(base_type_select); Button *add_nds = memnew(Button); add_nds->set_text(TTR("Add Nodes...")); graph_hbc->add_child(add_nds); - add_nds->connect_compat("pressed", this, "_add_node_dialog"); + add_nds->connect("pressed", callable_mp(this, &VisualScriptEditor::_add_node_dialog)); Button *fn_btn = memnew(Button); fn_btn->set_text(TTR("Add Function...")); graph_hbc->add_child(fn_btn); - fn_btn->connect_compat("pressed", this, "_create_function_dialog"); + fn_btn->connect("pressed", callable_mp(this, &VisualScriptEditor::_create_function_dialog)); // Add Function Dialog. VBoxContainer *function_vb = memnew(VBoxContainer); @@ -4802,7 +4748,7 @@ VisualScriptEditor::VisualScriptEditor() { func_name_box->set_h_size_flags(SIZE_EXPAND_FILL); func_name_box->set_placeholder(TTR("function_name")); func_name_box->set_text(""); - func_name_box->connect_compat("focus_entered", this, "_deselect_input_names"); + func_name_box->connect("focus_entered", callable_mp(this, &VisualScriptEditor::_deselect_input_names)); func_name_hbox->add_child(func_name_box); // Add minor setting for function if needed, here! @@ -4812,7 +4758,7 @@ VisualScriptEditor::VisualScriptEditor() { Button *add_input_button = memnew(Button); add_input_button->set_h_size_flags(SIZE_EXPAND_FILL); add_input_button->set_text(TTR("Add Input")); - add_input_button->connect_compat("pressed", this, "_add_func_input"); + add_input_button->connect("pressed", callable_mp(this, &VisualScriptEditor::_add_func_input)); function_vb->add_child(add_input_button); func_input_scroll = memnew(ScrollContainer); @@ -4828,7 +4774,7 @@ VisualScriptEditor::VisualScriptEditor() { function_create_dialog->set_title(TTR("Create Function")); function_create_dialog->add_child(function_vb); function_create_dialog->get_ok()->set_text(TTR("Create")); - function_create_dialog->get_ok()->connect_compat("pressed", this, "_create_function"); + function_create_dialog->get_ok()->connect("pressed", callable_mp(this, &VisualScriptEditor::_create_function)); add_child(function_create_dialog); select_func_text = memnew(Label); @@ -4848,7 +4794,7 @@ VisualScriptEditor::VisualScriptEditor() { hint_text_timer = memnew(Timer); hint_text_timer->set_wait_time(4); - hint_text_timer->connect_compat("timeout", this, "_hide_timer"); + hint_text_timer->connect("timeout", callable_mp(this, &VisualScriptEditor::_hide_timer)); add_child(hint_text_timer); // Allowed casts (connections). @@ -4866,9 +4812,9 @@ VisualScriptEditor::VisualScriptEditor() { graph->add_valid_left_disconnect_type(TYPE_SEQUENCE); - graph->connect_compat("connection_request", this, "_graph_connected"); - graph->connect_compat("disconnection_request", this, "_graph_disconnected"); - graph->connect_compat("connection_to_empty", this, "_graph_connect_to_empty"); + graph->connect("connection_request", callable_mp(this, &VisualScriptEditor::_graph_connected)); + graph->connect("disconnection_request", callable_mp(this, &VisualScriptEditor::_graph_disconnected)); + graph->connect("connection_to_empty", callable_mp(this, &VisualScriptEditor::_graph_connect_to_empty)); edit_signal_dialog = memnew(AcceptDialog); edit_signal_dialog->get_ok()->set_text(TTR("Close")); @@ -4892,7 +4838,7 @@ VisualScriptEditor::VisualScriptEditor() { select_base_type = memnew(CreateDialog); select_base_type->set_base_type("Object"); // Anything goes. - select_base_type->connect_compat("create", this, "_change_base_type_callback"); + select_base_type->connect("create", callable_mp(this, &VisualScriptEditor::_change_base_type_callback)); add_child(select_base_type); undo_redo = EditorNode::get_singleton()->get_undo_redo(); @@ -4904,22 +4850,22 @@ VisualScriptEditor::VisualScriptEditor() { default_value_edit = memnew(CustomPropertyEditor); add_child(default_value_edit); - default_value_edit->connect_compat("variant_changed", this, "_default_value_changed"); + default_value_edit->connect("variant_changed", callable_mp(this, &VisualScriptEditor::_default_value_changed)); method_select = memnew(VisualScriptPropertySelector); add_child(method_select); - method_select->connect_compat("selected", this, "_selected_method"); + method_select->connect("selected", callable_mp(this, &VisualScriptEditor::_selected_method)); error_line = -1; new_connect_node_select = memnew(VisualScriptPropertySelector); add_child(new_connect_node_select); new_connect_node_select->set_resizable(true); - new_connect_node_select->connect_compat("selected", this, "_selected_connect_node"); - new_connect_node_select->get_cancel()->connect_compat("pressed", this, "_cancel_connect_node"); + new_connect_node_select->connect("selected", callable_mp(this, &VisualScriptEditor::_selected_connect_node)); + new_connect_node_select->get_cancel()->connect("pressed", callable_mp(this, &VisualScriptEditor::_cancel_connect_node)); new_virtual_method_select = memnew(VisualScriptPropertySelector); add_child(new_virtual_method_select); - new_virtual_method_select->connect_compat("selected", this, "_selected_new_virtual_method"); + new_virtual_method_select->connect("selected", callable_mp(this, &VisualScriptEditor::_selected_new_virtual_method)); } VisualScriptEditor::~VisualScriptEditor() { diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 4a9a6bdb1d..ea09c82013 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -3130,8 +3130,6 @@ void VisualScriptCustomNode::_bind_methods() { stepmi.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT; BIND_VMETHOD(stepmi); - ClassDB::bind_method(D_METHOD("_script_changed"), &VisualScriptCustomNode::_script_changed); - BIND_ENUM_CONSTANT(START_MODE_BEGIN_SEQUENCE); BIND_ENUM_CONSTANT(START_MODE_CONTINUE_SEQUENCE); BIND_ENUM_CONSTANT(START_MODE_RESUME_YIELD); @@ -3144,7 +3142,7 @@ void VisualScriptCustomNode::_bind_methods() { } VisualScriptCustomNode::VisualScriptCustomNode() { - connect_compat("script_changed", this, "_script_changed"); + connect("script_changed", callable_mp(this, &VisualScriptCustomNode::_script_changed)); } ////////////////////////////////////////// diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp index 20bad364dc..f8b8a9f00b 100644 --- a/modules/visual_script/visual_script_property_selector.cpp +++ b/modules/visual_script/visual_script_property_selector.cpp @@ -522,7 +522,7 @@ void VisualScriptPropertySelector::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - connect_compat("confirmed", this, "_confirmed"); + connect("confirmed", callable_mp(this, &VisualScriptPropertySelector::_confirmed)); } } @@ -690,11 +690,6 @@ void VisualScriptPropertySelector::show_window(float p_screen_ratio) { void VisualScriptPropertySelector::_bind_methods() { - ClassDB::bind_method(D_METHOD("_text_changed"), &VisualScriptPropertySelector::_text_changed); - ClassDB::bind_method(D_METHOD("_confirmed"), &VisualScriptPropertySelector::_confirmed); - ClassDB::bind_method(D_METHOD("_sbox_input"), &VisualScriptPropertySelector::_sbox_input); - ClassDB::bind_method(D_METHOD("_item_selected"), &VisualScriptPropertySelector::_item_selected); - ADD_SIGNAL(MethodInfo("selected", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::STRING, "category"), PropertyInfo(Variant::BOOL, "connecting"))); } @@ -705,16 +700,16 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() { //set_child_rect(vbc); search_box = memnew(LineEdit); vbc->add_margin_child(TTR("Search:"), search_box); - search_box->connect_compat("text_changed", this, "_text_changed"); - search_box->connect_compat("gui_input", this, "_sbox_input"); + search_box->connect("text_changed", callable_mp(this, &VisualScriptPropertySelector::_text_changed)); + search_box->connect("gui_input", callable_mp(this, &VisualScriptPropertySelector::_sbox_input)); search_options = memnew(Tree); vbc->add_margin_child(TTR("Matches:"), search_options, true); get_ok()->set_text(TTR("Open")); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); - search_options->connect_compat("item_activated", this, "_confirmed"); - search_options->connect_compat("cell_selected", this, "_item_selected"); + search_options->connect("item_activated", callable_mp(this, &VisualScriptPropertySelector::_confirmed)); + search_options->connect("cell_selected", callable_mp(this, &VisualScriptPropertySelector::_item_selected)); search_options->set_hide_root(true); search_options->set_hide_folding(true); virtuals_only = false; |