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 /editor/plugins | |
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 'editor/plugins')
48 files changed, 597 insertions, 1076 deletions
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index 6f29b6c76a..6e950e8c0b 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -209,8 +209,8 @@ void AbstractPolygon2DEditor::_notification(int p_what) { button_delete->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveDelete", "EditorIcons")); button_edit->set_pressed(true); - get_tree()->connect_compat("node_removed", this, "_node_removed"); - create_resource->connect_compat("confirmed", this, "_create_resource"); + get_tree()->connect("node_removed", callable_mp(this, &AbstractPolygon2DEditor::_node_removed)); + create_resource->connect("confirmed", callable_mp(this, &AbstractPolygon2DEditor::_create_resource)); } break; } } @@ -695,10 +695,6 @@ void AbstractPolygon2DEditor::edit(Node *p_polygon) { } void AbstractPolygon2DEditor::_bind_methods() { - - ClassDB::bind_method(D_METHOD("_node_removed"), &AbstractPolygon2DEditor::_node_removed); - ClassDB::bind_method(D_METHOD("_menu_option"), &AbstractPolygon2DEditor::_menu_option); - ClassDB::bind_method(D_METHOD("_create_resource"), &AbstractPolygon2DEditor::_create_resource); } void AbstractPolygon2DEditor::remove_point(const Vertex &p_vertex) { @@ -820,17 +816,17 @@ AbstractPolygon2DEditor::AbstractPolygon2DEditor(EditorNode *p_editor, bool p_wi add_child(memnew(VSeparator)); button_create = memnew(ToolButton); add_child(button_create); - button_create->connect_compat("pressed", this, "_menu_option", varray(MODE_CREATE)); + button_create->connect("pressed", callable_mp(this, &AbstractPolygon2DEditor::_menu_option), varray(MODE_CREATE)); button_create->set_toggle_mode(true); button_edit = memnew(ToolButton); add_child(button_edit); - button_edit->connect_compat("pressed", this, "_menu_option", varray(MODE_EDIT)); + button_edit->connect("pressed", callable_mp(this, &AbstractPolygon2DEditor::_menu_option), varray(MODE_EDIT)); button_edit->set_toggle_mode(true); button_delete = memnew(ToolButton); add_child(button_delete); - button_delete->connect_compat("pressed", this, "_menu_option", varray(MODE_DELETE)); + button_delete->connect("pressed", callable_mp(this, &AbstractPolygon2DEditor::_menu_option), varray(MODE_DELETE)); button_delete->set_toggle_mode(true); create_resource = memnew(ConfirmationDialog); diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index c955f2b806..d5d5727ad9 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -568,25 +568,10 @@ void AnimationNodeBlendSpace1DEditor::_notification(int p_what) { } void AnimationNodeBlendSpace1DEditor::_bind_methods() { - ClassDB::bind_method("_blend_space_gui_input", &AnimationNodeBlendSpace1DEditor::_blend_space_gui_input); - ClassDB::bind_method("_blend_space_draw", &AnimationNodeBlendSpace1DEditor::_blend_space_draw); - ClassDB::bind_method("_config_changed", &AnimationNodeBlendSpace1DEditor::_config_changed); - ClassDB::bind_method("_labels_changed", &AnimationNodeBlendSpace1DEditor::_labels_changed); ClassDB::bind_method("_update_space", &AnimationNodeBlendSpace1DEditor::_update_space); - ClassDB::bind_method("_snap_toggled", &AnimationNodeBlendSpace1DEditor::_snap_toggled); - ClassDB::bind_method("_tool_switch", &AnimationNodeBlendSpace1DEditor::_tool_switch); - ClassDB::bind_method("_erase_selected", &AnimationNodeBlendSpace1DEditor::_erase_selected); ClassDB::bind_method("_update_tool_erase", &AnimationNodeBlendSpace1DEditor::_update_tool_erase); - ClassDB::bind_method("_edit_point_pos", &AnimationNodeBlendSpace1DEditor::_edit_point_pos); - - ClassDB::bind_method("_add_menu_type", &AnimationNodeBlendSpace1DEditor::_add_menu_type); - ClassDB::bind_method("_add_animation_type", &AnimationNodeBlendSpace1DEditor::_add_animation_type); ClassDB::bind_method("_update_edited_point_pos", &AnimationNodeBlendSpace1DEditor::_update_edited_point_pos); - - ClassDB::bind_method("_open_editor", &AnimationNodeBlendSpace1DEditor::_open_editor); - - ClassDB::bind_method("_file_opened", &AnimationNodeBlendSpace1DEditor::_file_opened); } bool AnimationNodeBlendSpace1DEditor::can_edit(const Ref<AnimationNode> &p_node) { @@ -622,28 +607,28 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { top_hb->add_child(tool_blend); tool_blend->set_pressed(true); tool_blend->set_tooltip(TTR("Set the blending position within the space")); - tool_blend->connect_compat("pressed", this, "_tool_switch", varray(3)); + tool_blend->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch), varray(3)); tool_select = memnew(ToolButton); tool_select->set_toggle_mode(true); tool_select->set_button_group(bg); top_hb->add_child(tool_select); tool_select->set_tooltip(TTR("Select and move points, create points with RMB.")); - tool_select->connect_compat("pressed", this, "_tool_switch", varray(0)); + tool_select->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch), varray(0)); tool_create = memnew(ToolButton); tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); top_hb->add_child(tool_create); tool_create->set_tooltip(TTR("Create points.")); - tool_create->connect_compat("pressed", this, "_tool_switch", varray(1)); + tool_create->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch), varray(1)); tool_erase_sep = memnew(VSeparator); top_hb->add_child(tool_erase_sep); tool_erase = memnew(ToolButton); top_hb->add_child(tool_erase); tool_erase->set_tooltip(TTR("Erase points.")); - tool_erase->connect_compat("pressed", this, "_erase_selected"); + tool_erase->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_erase_selected)); top_hb->add_child(memnew(VSeparator)); @@ -652,7 +637,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { top_hb->add_child(snap); snap->set_pressed(true); snap->set_tooltip(TTR("Enable snap and show grid.")); - snap->connect_compat("pressed", this, "_snap_toggled"); + snap->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_snap_toggled)); snap_value = memnew(SpinBox); top_hb->add_child(snap_value); @@ -670,12 +655,12 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { edit_value->set_min(-1000); edit_value->set_max(1000); edit_value->set_step(0.01); - edit_value->connect_compat("value_changed", this, "_edit_point_pos"); + edit_value->connect("value_changed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_edit_point_pos)); open_editor = memnew(Button); edit_hb->add_child(open_editor); open_editor->set_text(TTR("Open Editor")); - open_editor->connect_compat("pressed", this, "_open_editor", varray(), CONNECT_DEFERRED); + open_editor->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_open_editor), varray(), CONNECT_DEFERRED); edit_hb->hide(); open_editor->hide(); @@ -691,8 +676,8 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { panel->set_v_size_flags(SIZE_EXPAND_FILL); blend_space_draw = memnew(Control); - blend_space_draw->connect_compat("gui_input", this, "_blend_space_gui_input"); - blend_space_draw->connect_compat("draw", this, "_blend_space_draw"); + blend_space_draw->connect("gui_input", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_blend_space_gui_input)); + blend_space_draw->connect("draw", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_blend_space_draw)); blend_space_draw->set_focus_mode(FOCUS_ALL); panel->add_child(blend_space_draw); @@ -724,10 +709,10 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { bottom_hb->add_child(max_value); } - snap_value->connect_compat("value_changed", this, "_config_changed"); - min_value->connect_compat("value_changed", this, "_config_changed"); - max_value->connect_compat("value_changed", this, "_config_changed"); - label_value->connect_compat("text_changed", this, "_labels_changed"); + snap_value->connect("value_changed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_config_changed)); + min_value->connect("value_changed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_config_changed)); + max_value->connect("value_changed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_config_changed)); + label_value->connect("text_changed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_labels_changed)); error_panel = memnew(PanelContainer); add_child(error_panel); @@ -740,18 +725,18 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { menu = memnew(PopupMenu); add_child(menu); - menu->connect_compat("id_pressed", this, "_add_menu_type"); + menu->connect("id_pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_add_menu_type)); animations_menu = memnew(PopupMenu); menu->add_child(animations_menu); animations_menu->set_name("animations"); - animations_menu->connect_compat("index_pressed", this, "_add_animation_type"); + animations_menu->connect("index_pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_add_animation_type)); open_file = memnew(EditorFileDialog); add_child(open_file); open_file->set_title(TTR("Open Animation Node")); open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE); - open_file->connect_compat("file_selected", this, "_file_opened"); + open_file->connect("file_selected", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_file_opened)); undo_redo = EditorNode::get_undo_redo(); selected_point = -1; diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index d2306a5d6b..363c3a0e0a 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -55,12 +55,12 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_changed() { void AnimationNodeBlendSpace2DEditor::edit(const Ref<AnimationNode> &p_node) { if (blend_space.is_valid()) { - blend_space->disconnect_compat("triangles_updated", this, "_blend_space_changed"); + blend_space->disconnect("triangles_updated", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_blend_space_changed)); } blend_space = p_node; if (!blend_space.is_null()) { - blend_space->connect_compat("triangles_updated", this, "_blend_space_changed"); + blend_space->connect("triangles_updated", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_blend_space_changed)); _update_space(); } } @@ -825,30 +825,12 @@ void AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled() { void AnimationNodeBlendSpace2DEditor::_bind_methods() { - ClassDB::bind_method("_blend_space_gui_input", &AnimationNodeBlendSpace2DEditor::_blend_space_gui_input); - ClassDB::bind_method("_blend_space_draw", &AnimationNodeBlendSpace2DEditor::_blend_space_draw); - ClassDB::bind_method("_config_changed", &AnimationNodeBlendSpace2DEditor::_config_changed); - ClassDB::bind_method("_labels_changed", &AnimationNodeBlendSpace2DEditor::_labels_changed); ClassDB::bind_method("_update_space", &AnimationNodeBlendSpace2DEditor::_update_space); - ClassDB::bind_method("_snap_toggled", &AnimationNodeBlendSpace2DEditor::_snap_toggled); - ClassDB::bind_method("_tool_switch", &AnimationNodeBlendSpace2DEditor::_tool_switch); - ClassDB::bind_method("_erase_selected", &AnimationNodeBlendSpace2DEditor::_erase_selected); ClassDB::bind_method("_update_tool_erase", &AnimationNodeBlendSpace2DEditor::_update_tool_erase); - ClassDB::bind_method("_edit_point_pos", &AnimationNodeBlendSpace2DEditor::_edit_point_pos); - - ClassDB::bind_method("_add_menu_type", &AnimationNodeBlendSpace2DEditor::_add_menu_type); - ClassDB::bind_method("_add_animation_type", &AnimationNodeBlendSpace2DEditor::_add_animation_type); ClassDB::bind_method("_update_edited_point_pos", &AnimationNodeBlendSpace2DEditor::_update_edited_point_pos); - ClassDB::bind_method("_open_editor", &AnimationNodeBlendSpace2DEditor::_open_editor); - ClassDB::bind_method("_removed_from_graph", &AnimationNodeBlendSpace2DEditor::_removed_from_graph); - - ClassDB::bind_method("_auto_triangles_toggled", &AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled); - ClassDB::bind_method("_blend_space_changed", &AnimationNodeBlendSpace2DEditor::_blend_space_changed); - - ClassDB::bind_method("_file_opened", &AnimationNodeBlendSpace2DEditor::_file_opened); } AnimationNodeBlendSpace2DEditor *AnimationNodeBlendSpace2DEditor::singleton = NULL; @@ -870,42 +852,42 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { top_hb->add_child(tool_blend); tool_blend->set_pressed(true); tool_blend->set_tooltip(TTR("Set the blending position within the space")); - tool_blend->connect_compat("pressed", this, "_tool_switch", varray(3)); + tool_blend->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch), varray(3)); tool_select = memnew(ToolButton); tool_select->set_toggle_mode(true); tool_select->set_button_group(bg); top_hb->add_child(tool_select); tool_select->set_tooltip(TTR("Select and move points, create points with RMB.")); - tool_select->connect_compat("pressed", this, "_tool_switch", varray(0)); + tool_select->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch), varray(0)); tool_create = memnew(ToolButton); tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); top_hb->add_child(tool_create); tool_create->set_tooltip(TTR("Create points.")); - tool_create->connect_compat("pressed", this, "_tool_switch", varray(1)); + tool_create->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch), varray(1)); tool_triangle = memnew(ToolButton); tool_triangle->set_toggle_mode(true); tool_triangle->set_button_group(bg); top_hb->add_child(tool_triangle); tool_triangle->set_tooltip(TTR("Create triangles by connecting points.")); - tool_triangle->connect_compat("pressed", this, "_tool_switch", varray(2)); + tool_triangle->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch), varray(2)); tool_erase_sep = memnew(VSeparator); top_hb->add_child(tool_erase_sep); tool_erase = memnew(ToolButton); top_hb->add_child(tool_erase); tool_erase->set_tooltip(TTR("Erase points and triangles.")); - tool_erase->connect_compat("pressed", this, "_erase_selected"); + tool_erase->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_erase_selected)); tool_erase->set_disabled(true); top_hb->add_child(memnew(VSeparator)); auto_triangles = memnew(ToolButton); top_hb->add_child(auto_triangles); - auto_triangles->connect_compat("pressed", this, "_auto_triangles_toggled"); + auto_triangles->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled)); auto_triangles->set_toggle_mode(true); auto_triangles->set_tooltip(TTR("Generate blend triangles automatically (instead of manually)")); @@ -916,7 +898,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { top_hb->add_child(snap); snap->set_pressed(true); snap->set_tooltip(TTR("Enable snap and show grid.")); - snap->connect_compat("pressed", this, "_snap_toggled"); + snap->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_snap_toggled)); snap_x = memnew(SpinBox); top_hb->add_child(snap_x); @@ -937,7 +919,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { top_hb->add_child(memnew(Label(TTR("Blend:")))); interpolation = memnew(OptionButton); top_hb->add_child(interpolation); - interpolation->connect_compat("item_selected", this, "_config_changed"); + interpolation->connect("item_selected", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_config_changed)); edit_hb = memnew(HBoxContainer); top_hb->add_child(edit_hb); @@ -948,17 +930,17 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { edit_x->set_min(-1000); edit_x->set_step(0.01); edit_x->set_max(1000); - edit_x->connect_compat("value_changed", this, "_edit_point_pos"); + edit_x->connect("value_changed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_edit_point_pos)); edit_y = memnew(SpinBox); edit_hb->add_child(edit_y); edit_y->set_min(-1000); edit_y->set_step(0.01); edit_y->set_max(1000); - edit_y->connect_compat("value_changed", this, "_edit_point_pos"); + edit_y->connect("value_changed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_edit_point_pos)); open_editor = memnew(Button); edit_hb->add_child(open_editor); open_editor->set_text(TTR("Open Editor")); - open_editor->connect_compat("pressed", this, "_open_editor", varray(), CONNECT_DEFERRED); + open_editor->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_open_editor), varray(), CONNECT_DEFERRED); edit_hb->hide(); open_editor->hide(); @@ -999,8 +981,8 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { panel->set_h_size_flags(SIZE_EXPAND_FILL); blend_space_draw = memnew(Control); - blend_space_draw->connect_compat("gui_input", this, "_blend_space_gui_input"); - blend_space_draw->connect_compat("draw", this, "_blend_space_draw"); + blend_space_draw->connect("gui_input", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_blend_space_gui_input)); + blend_space_draw->connect("draw", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_blend_space_draw)); blend_space_draw->set_focus_mode(FOCUS_ALL); panel->add_child(blend_space_draw); @@ -1029,14 +1011,14 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { min_x_value->set_step(0.01); } - snap_x->connect_compat("value_changed", this, "_config_changed"); - snap_y->connect_compat("value_changed", this, "_config_changed"); - max_x_value->connect_compat("value_changed", this, "_config_changed"); - min_x_value->connect_compat("value_changed", this, "_config_changed"); - max_y_value->connect_compat("value_changed", this, "_config_changed"); - min_y_value->connect_compat("value_changed", this, "_config_changed"); - label_x->connect_compat("text_changed", this, "_labels_changed"); - label_y->connect_compat("text_changed", this, "_labels_changed"); + snap_x->connect("value_changed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_config_changed)); + snap_y->connect("value_changed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_config_changed)); + max_x_value->connect("value_changed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_config_changed)); + min_x_value->connect("value_changed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_config_changed)); + max_y_value->connect("value_changed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_config_changed)); + min_y_value->connect("value_changed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_config_changed)); + label_x->connect("text_changed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_labels_changed)); + label_y->connect("text_changed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_labels_changed)); error_panel = memnew(PanelContainer); add_child(error_panel); @@ -1050,18 +1032,18 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { menu = memnew(PopupMenu); add_child(menu); - menu->connect_compat("id_pressed", this, "_add_menu_type"); + menu->connect("id_pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_add_menu_type)); animations_menu = memnew(PopupMenu); menu->add_child(animations_menu); animations_menu->set_name("animations"); - animations_menu->connect_compat("index_pressed", this, "_add_animation_type"); + animations_menu->connect("index_pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_add_animation_type)); open_file = memnew(EditorFileDialog); add_child(open_file); open_file->set_title(TTR("Open Animation Node")); open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE); - open_file->connect_compat("file_selected", this, "_file_opened"); + open_file->connect("file_selected", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_file_opened)); undo_redo = EditorNode::get_undo_redo(); selected_point = -1; diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index f2daa809b4..5e53adf471 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -146,11 +146,11 @@ void AnimationNodeBlendTreeEditor::_update_graph() { name->set_expand_to_text_length(true); node->add_child(name); node->set_slot(0, false, 0, Color(), true, 0, get_color("font_color", "Label")); - name->connect_compat("text_entered", this, "_node_renamed", varray(agnode)); - name->connect_compat("focus_exited", this, "_node_renamed_focus_out", varray(name, agnode), CONNECT_DEFERRED); + name->connect("text_entered", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_renamed), varray(agnode)); + name->connect("focus_exited", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_renamed_focus_out), varray(name, agnode), CONNECT_DEFERRED); base = 1; node->set_show_close_button(true); - node->connect_compat("close_request", this, "_delete_request", varray(E->get()), CONNECT_DEFERRED); + node->connect("close_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_delete_request), varray(E->get()), CONNECT_DEFERRED); } for (int i = 0; i < agnode->get_input_count(); i++) { @@ -173,13 +173,13 @@ void AnimationNodeBlendTreeEditor::_update_graph() { prop->set_object_and_property(AnimationTreeEditor::get_singleton()->get_tree(), base_path); prop->update_property(); prop->set_name_split_ratio(0); - prop->connect_compat("property_changed", this, "_property_changed"); + prop->connect("property_changed", callable_mp(this, &AnimationNodeBlendTreeEditor::_property_changed)); node->add_child(prop); visible_properties.push_back(prop); } } - node->connect_compat("dragged", this, "_node_dragged", varray(E->get())); + node->connect("dragged", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_dragged), varray(E->get())); if (AnimationTreeEditor::get_singleton()->can_edit(agnode)) { node->add_child(memnew(HSeparator)); @@ -187,7 +187,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { open_in_editor->set_text(TTR("Open Editor")); open_in_editor->set_icon(get_icon("Edit", "EditorIcons")); node->add_child(open_in_editor); - open_in_editor->connect_compat("pressed", this, "_open_in_editor", varray(E->get()), CONNECT_DEFERRED); + open_in_editor->connect("pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_open_in_editor), varray(E->get()), CONNECT_DEFERRED); open_in_editor->set_h_size_flags(SIZE_SHRINK_CENTER); } @@ -198,7 +198,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { edit_filters->set_text(TTR("Edit Filters")); edit_filters->set_icon(get_icon("AnimationFilter", "EditorIcons")); node->add_child(edit_filters); - edit_filters->connect_compat("pressed", this, "_edit_filters", varray(E->get()), CONNECT_DEFERRED); + edit_filters->connect("pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_edit_filters), varray(E->get()), CONNECT_DEFERRED); edit_filters->set_h_size_flags(SIZE_SHRINK_CENTER); } @@ -238,7 +238,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { animations[E->get()] = pb; node->add_child(pb); - mb->get_popup()->connect_compat("index_pressed", this, "_anim_selected", varray(options, E->get()), CONNECT_DEFERRED); + mb->get_popup()->connect("index_pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_anim_selected), varray(options, E->get()), CONNECT_DEFERRED); } if (EditorSettings::get_singleton()->get("interface/theme/use_graph_node_headers")) { @@ -799,28 +799,7 @@ void AnimationNodeBlendTreeEditor::_scroll_changed(const Vector2 &p_scroll) { void AnimationNodeBlendTreeEditor::_bind_methods() { ClassDB::bind_method("_update_graph", &AnimationNodeBlendTreeEditor::_update_graph); - ClassDB::bind_method("_add_node", &AnimationNodeBlendTreeEditor::_add_node); - ClassDB::bind_method("_node_dragged", &AnimationNodeBlendTreeEditor::_node_dragged); - ClassDB::bind_method("_node_renamed", &AnimationNodeBlendTreeEditor::_node_renamed); - ClassDB::bind_method("_node_renamed_focus_out", &AnimationNodeBlendTreeEditor::_node_renamed_focus_out); - ClassDB::bind_method("_connection_request", &AnimationNodeBlendTreeEditor::_connection_request); - ClassDB::bind_method("_disconnection_request", &AnimationNodeBlendTreeEditor::_disconnection_request); - ClassDB::bind_method("_node_selected", &AnimationNodeBlendTreeEditor::_node_selected); - ClassDB::bind_method("_open_in_editor", &AnimationNodeBlendTreeEditor::_open_in_editor); - ClassDB::bind_method("_scroll_changed", &AnimationNodeBlendTreeEditor::_scroll_changed); - ClassDB::bind_method("_delete_request", &AnimationNodeBlendTreeEditor::_delete_request); - ClassDB::bind_method("_delete_nodes_request", &AnimationNodeBlendTreeEditor::_delete_nodes_request); - ClassDB::bind_method("_popup_request", &AnimationNodeBlendTreeEditor::_popup_request); - ClassDB::bind_method("_edit_filters", &AnimationNodeBlendTreeEditor::_edit_filters); ClassDB::bind_method("_update_filters", &AnimationNodeBlendTreeEditor::_update_filters); - ClassDB::bind_method("_filter_edited", &AnimationNodeBlendTreeEditor::_filter_edited); - ClassDB::bind_method("_filter_toggled", &AnimationNodeBlendTreeEditor::_filter_toggled); - ClassDB::bind_method("_removed_from_graph", &AnimationNodeBlendTreeEditor::_removed_from_graph); - ClassDB::bind_method("_property_changed", &AnimationNodeBlendTreeEditor::_property_changed); - ClassDB::bind_method("_file_opened", &AnimationNodeBlendTreeEditor::_file_opened); - ClassDB::bind_method("_update_options_menu", &AnimationNodeBlendTreeEditor::_update_options_menu); - - ClassDB::bind_method("_anim_selected", &AnimationNodeBlendTreeEditor::_anim_selected); } AnimationNodeBlendTreeEditor *AnimationNodeBlendTreeEditor::singleton = NULL; @@ -911,7 +890,7 @@ bool AnimationNodeBlendTreeEditor::can_edit(const Ref<AnimationNode> &p_node) { void AnimationNodeBlendTreeEditor::edit(const Ref<AnimationNode> &p_node) { if (blend_tree.is_valid()) { - blend_tree->disconnect_compat("removed_from_graph", this, "_removed_from_graph"); + blend_tree->disconnect("removed_from_graph", callable_mp(this, &AnimationNodeBlendTreeEditor::_removed_from_graph)); } blend_tree = p_node; @@ -919,7 +898,7 @@ void AnimationNodeBlendTreeEditor::edit(const Ref<AnimationNode> &p_node) { if (blend_tree.is_null()) { hide(); } else { - blend_tree->connect_compat("removed_from_graph", this, "_removed_from_graph"); + blend_tree->connect("removed_from_graph", callable_mp(this, &AnimationNodeBlendTreeEditor::_removed_from_graph)); _update_graph(); } @@ -936,12 +915,12 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() { graph->add_valid_right_disconnect_type(0); graph->add_valid_left_disconnect_type(0); graph->set_v_size_flags(SIZE_EXPAND_FILL); - graph->connect_compat("connection_request", this, "_connection_request", varray(), CONNECT_DEFERRED); - graph->connect_compat("disconnection_request", this, "_disconnection_request", varray(), CONNECT_DEFERRED); - graph->connect_compat("node_selected", this, "_node_selected"); - graph->connect_compat("scroll_offset_changed", this, "_scroll_changed"); - graph->connect_compat("delete_nodes_request", this, "_delete_nodes_request"); - graph->connect_compat("popup_request", this, "_popup_request"); + graph->connect("connection_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_connection_request), varray(), CONNECT_DEFERRED); + graph->connect("disconnection_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_disconnection_request), varray(), CONNECT_DEFERRED); + graph->connect("node_selected", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_selected)); + graph->connect("scroll_offset_changed", callable_mp(this, &AnimationNodeBlendTreeEditor::_scroll_changed)); + graph->connect("delete_nodes_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_delete_nodes_request)); + graph->connect("popup_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_popup_request)); VSeparator *vs = memnew(VSeparator); graph->get_zoom_hbox()->add_child(vs); @@ -951,8 +930,8 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() { graph->get_zoom_hbox()->add_child(add_node); add_node->set_text(TTR("Add Node...")); graph->get_zoom_hbox()->move_child(add_node, 0); - add_node->get_popup()->connect_compat("id_pressed", this, "_add_node"); - add_node->connect_compat("about_to_show", this, "_update_options_menu"); + add_node->get_popup()->connect("id_pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_add_node)); + add_node->connect("about_to_show", callable_mp(this, &AnimationNodeBlendTreeEditor::_update_options_menu)); add_options.push_back(AddOption("Animation", "AnimationNodeAnimation")); add_options.push_back(AddOption("OneShot", "AnimationNodeOneShot")); @@ -984,19 +963,19 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() { filter_enabled = memnew(CheckBox); filter_enabled->set_text(TTR("Enable Filtering")); - filter_enabled->connect_compat("pressed", this, "_filter_toggled"); + filter_enabled->connect("pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_filter_toggled)); filter_vbox->add_child(filter_enabled); filters = memnew(Tree); filter_vbox->add_child(filters); filters->set_v_size_flags(SIZE_EXPAND_FILL); filters->set_hide_root(true); - filters->connect_compat("item_edited", this, "_filter_edited"); + filters->connect("item_edited", callable_mp(this, &AnimationNodeBlendTreeEditor::_filter_edited)); open_file = memnew(EditorFileDialog); add_child(open_file); open_file->set_title(TTR("Open Animation Node")); open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE); - open_file->connect_compat("file_selected", this, "_file_opened"); + open_file->connect("file_selected", callable_mp(this, &AnimationNodeBlendTreeEditor::_file_opened)); undo_redo = EditorNode::get_undo_redo(); } diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 0f2a7376f5..a42fc9d6a6 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -97,13 +97,13 @@ void AnimationPlayerEditor::_notification(int p_what) { } break; case NOTIFICATION_ENTER_TREE: { - tool_anim->get_popup()->connect_compat("id_pressed", this, "_animation_tool_menu"); + tool_anim->get_popup()->connect("id_pressed", callable_mp(this, &AnimationPlayerEditor::_animation_tool_menu)); - onion_skinning->get_popup()->connect_compat("id_pressed", this, "_onion_skinning_menu"); + onion_skinning->get_popup()->connect("id_pressed", callable_mp(this, &AnimationPlayerEditor::_onion_skinning_menu)); - blend_editor.next->connect_compat("item_selected", this, "_blend_editor_next_changed"); + blend_editor.next->connect("item_selected", callable_mp(this, &AnimationPlayerEditor::_blend_editor_next_changed)); - get_tree()->connect_compat("node_removed", this, "_node_removed"); + get_tree()->connect("node_removed", callable_mp(this, &AnimationPlayerEditor::_node_removed)); add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel")); } break; @@ -1527,44 +1527,22 @@ void AnimationPlayerEditor::_pin_pressed() { void AnimationPlayerEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("_node_removed"), &AnimationPlayerEditor::_node_removed); - ClassDB::bind_method(D_METHOD("_play_pressed"), &AnimationPlayerEditor::_play_pressed); - ClassDB::bind_method(D_METHOD("_play_from_pressed"), &AnimationPlayerEditor::_play_from_pressed); - ClassDB::bind_method(D_METHOD("_play_bw_pressed"), &AnimationPlayerEditor::_play_bw_pressed); - ClassDB::bind_method(D_METHOD("_play_bw_from_pressed"), &AnimationPlayerEditor::_play_bw_from_pressed); - ClassDB::bind_method(D_METHOD("_stop_pressed"), &AnimationPlayerEditor::_stop_pressed); - ClassDB::bind_method(D_METHOD("_autoplay_pressed"), &AnimationPlayerEditor::_autoplay_pressed); - ClassDB::bind_method(D_METHOD("_animation_selected"), &AnimationPlayerEditor::_animation_selected); - ClassDB::bind_method(D_METHOD("_animation_name_edited"), &AnimationPlayerEditor::_animation_name_edited); ClassDB::bind_method(D_METHOD("_animation_new"), &AnimationPlayerEditor::_animation_new); ClassDB::bind_method(D_METHOD("_animation_rename"), &AnimationPlayerEditor::_animation_rename); ClassDB::bind_method(D_METHOD("_animation_load"), &AnimationPlayerEditor::_animation_load); ClassDB::bind_method(D_METHOD("_animation_remove"), &AnimationPlayerEditor::_animation_remove); - ClassDB::bind_method(D_METHOD("_animation_remove_confirmed"), &AnimationPlayerEditor::_animation_remove_confirmed); ClassDB::bind_method(D_METHOD("_animation_blend"), &AnimationPlayerEditor::_animation_blend); ClassDB::bind_method(D_METHOD("_animation_edit"), &AnimationPlayerEditor::_animation_edit); ClassDB::bind_method(D_METHOD("_animation_resource_edit"), &AnimationPlayerEditor::_animation_resource_edit); - ClassDB::bind_method(D_METHOD("_dialog_action"), &AnimationPlayerEditor::_dialog_action); - ClassDB::bind_method(D_METHOD("_seek_value_changed"), &AnimationPlayerEditor::_seek_value_changed, DEFVAL(true)); ClassDB::bind_method(D_METHOD("_animation_player_changed"), &AnimationPlayerEditor::_animation_player_changed); - ClassDB::bind_method(D_METHOD("_blend_edited"), &AnimationPlayerEditor::_blend_edited); - ClassDB::bind_method(D_METHOD("_scale_changed"), &AnimationPlayerEditor::_scale_changed); ClassDB::bind_method(D_METHOD("_list_changed"), &AnimationPlayerEditor::_list_changed); - ClassDB::bind_method(D_METHOD("_animation_key_editor_seek"), &AnimationPlayerEditor::_animation_key_editor_seek); - ClassDB::bind_method(D_METHOD("_animation_key_editor_anim_len_changed"), &AnimationPlayerEditor::_animation_key_editor_anim_len_changed); ClassDB::bind_method(D_METHOD("_animation_duplicate"), &AnimationPlayerEditor::_animation_duplicate); - ClassDB::bind_method(D_METHOD("_blend_editor_next_changed"), &AnimationPlayerEditor::_blend_editor_next_changed); ClassDB::bind_method(D_METHOD("_unhandled_key_input"), &AnimationPlayerEditor::_unhandled_key_input); - ClassDB::bind_method(D_METHOD("_animation_tool_menu"), &AnimationPlayerEditor::_animation_tool_menu); - ClassDB::bind_method(D_METHOD("_onion_skinning_menu"), &AnimationPlayerEditor::_onion_skinning_menu); - ClassDB::bind_method(D_METHOD("_editor_visibility_changed"), &AnimationPlayerEditor::_editor_visibility_changed); ClassDB::bind_method(D_METHOD("_prepare_onion_layers_1"), &AnimationPlayerEditor::_prepare_onion_layers_1); ClassDB::bind_method(D_METHOD("_prepare_onion_layers_2"), &AnimationPlayerEditor::_prepare_onion_layers_2); ClassDB::bind_method(D_METHOD("_start_onion_skinning"), &AnimationPlayerEditor::_start_onion_skinning); ClassDB::bind_method(D_METHOD("_stop_onion_skinning"), &AnimationPlayerEditor::_stop_onion_skinning); - - ClassDB::bind_method(D_METHOD("_pin_pressed"), &AnimationPlayerEditor::_pin_pressed); } AnimationPlayerEditor *AnimationPlayerEditor::singleton = NULL; @@ -1627,7 +1605,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay delete_dialog = memnew(ConfirmationDialog); add_child(delete_dialog); - delete_dialog->connect_compat("confirmed", this, "_animation_remove_confirmed"); + delete_dialog->connect("confirmed", callable_mp(this, &AnimationPlayerEditor::_animation_remove_confirmed)); tool_anim = memnew(MenuButton); tool_anim->set_flat(false); @@ -1672,7 +1650,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay onion_toggle = memnew(ToolButton); onion_toggle->set_toggle_mode(true); onion_toggle->set_tooltip(TTR("Enable Onion Skinning")); - onion_toggle->connect_compat("pressed", this, "_onion_skinning_menu", varray(ONION_SKINNING_ENABLE)); + onion_toggle->connect("pressed", callable_mp(this, &AnimationPlayerEditor::_onion_skinning_menu), varray(ONION_SKINNING_ENABLE)); hb->add_child(onion_toggle); onion_skinning = memnew(MenuButton); @@ -1698,7 +1676,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay pin->set_toggle_mode(true); pin->set_tooltip(TTR("Pin AnimationPlayer")); hb->add_child(pin); - pin->connect_compat("pressed", this, "_pin_pressed"); + pin->connect("pressed", callable_mp(this, &AnimationPlayerEditor::_pin_pressed)); file = memnew(EditorFileDialog); add_child(file); @@ -1722,7 +1700,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay error_dialog->set_title(TTR("Error!")); add_child(error_dialog); - name_dialog->connect_compat("confirmed", this, "_animation_name_edited"); + name_dialog->connect("confirmed", callable_mp(this, &AnimationPlayerEditor::_animation_name_edited)); blend_editor.dialog = memnew(AcceptDialog); add_child(blend_editor.dialog); @@ -1738,21 +1716,21 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay blend_editor.dialog->set_title(TTR("Cross-Animation Blend Times")); updating_blends = false; - blend_editor.tree->connect_compat("item_edited", this, "_blend_edited"); + blend_editor.tree->connect("item_edited", callable_mp(this, &AnimationPlayerEditor::_blend_edited)); - autoplay->connect_compat("pressed", this, "_autoplay_pressed"); + autoplay->connect("pressed", callable_mp(this, &AnimationPlayerEditor::_autoplay_pressed)); autoplay->set_toggle_mode(true); - play->connect_compat("pressed", this, "_play_pressed"); - play_from->connect_compat("pressed", this, "_play_from_pressed"); - play_bw->connect_compat("pressed", this, "_play_bw_pressed"); - play_bw_from->connect_compat("pressed", this, "_play_bw_from_pressed"); - stop->connect_compat("pressed", this, "_stop_pressed"); + play->connect("pressed", callable_mp(this, &AnimationPlayerEditor::_play_pressed)); + play_from->connect("pressed", callable_mp(this, &AnimationPlayerEditor::_play_from_pressed)); + play_bw->connect("pressed", callable_mp(this, &AnimationPlayerEditor::_play_bw_pressed)); + play_bw_from->connect("pressed", callable_mp(this, &AnimationPlayerEditor::_play_bw_from_pressed)); + stop->connect("pressed", callable_mp(this, &AnimationPlayerEditor::_stop_pressed)); - animation->connect_compat("item_selected", this, "_animation_selected", Vector<Variant>(), true); + animation->connect("item_selected", callable_mp(this, &AnimationPlayerEditor::_animation_selected), Vector<Variant>(), true); - file->connect_compat("file_selected", this, "_dialog_action"); - frame->connect_compat("value_changed", this, "_seek_value_changed", Vector<Variant>(), true); - scale->connect_compat("text_entered", this, "_scale_changed", Vector<Variant>(), true); + file->connect("file_selected", callable_mp(this, &AnimationPlayerEditor::_dialog_action)); + frame->connect("value_changed", callable_mp(this, &AnimationPlayerEditor::_seek_value_changed), Vector<Variant>(), true); + scale->connect("text_entered", callable_mp(this, &AnimationPlayerEditor::_scale_changed), Vector<Variant>(), true); renaming = false; last_active = false; @@ -1762,14 +1740,14 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay add_child(track_editor); track_editor->set_v_size_flags(SIZE_EXPAND_FILL); - track_editor->connect_compat("timeline_changed", this, "_animation_key_editor_seek"); - track_editor->connect_compat("animation_len_changed", this, "_animation_key_editor_anim_len_changed"); + track_editor->connect("timeline_changed", callable_mp(this, &AnimationPlayerEditor::_animation_key_editor_seek)); + track_editor->connect("animation_len_changed", callable_mp(this, &AnimationPlayerEditor::_animation_key_editor_anim_len_changed)); _update_player(); // Onion skinning. - track_editor->connect_compat("visibility_changed", this, "_editor_visibility_changed"); + track_editor->connect("visibility_changed", callable_mp(this, &AnimationPlayerEditor::_editor_visibility_changed)); onion.enabled = false; onion.past = true; diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 6f29aba356..77a8489f9e 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -1234,27 +1234,11 @@ void AnimationNodeStateMachineEditor::_update_mode() { void AnimationNodeStateMachineEditor::_bind_methods() { - ClassDB::bind_method("_state_machine_gui_input", &AnimationNodeStateMachineEditor::_state_machine_gui_input); - ClassDB::bind_method("_state_machine_draw", &AnimationNodeStateMachineEditor::_state_machine_draw); - ClassDB::bind_method("_state_machine_pos_draw", &AnimationNodeStateMachineEditor::_state_machine_pos_draw); ClassDB::bind_method("_update_graph", &AnimationNodeStateMachineEditor::_update_graph); - ClassDB::bind_method("_add_menu_type", &AnimationNodeStateMachineEditor::_add_menu_type); - ClassDB::bind_method("_add_animation_type", &AnimationNodeStateMachineEditor::_add_animation_type); - - ClassDB::bind_method("_name_edited", &AnimationNodeStateMachineEditor::_name_edited); - ClassDB::bind_method("_name_edited_focus_out", &AnimationNodeStateMachineEditor::_name_edited_focus_out); - ClassDB::bind_method("_removed_from_graph", &AnimationNodeStateMachineEditor::_removed_from_graph); ClassDB::bind_method("_open_editor", &AnimationNodeStateMachineEditor::_open_editor); - ClassDB::bind_method("_scroll_changed", &AnimationNodeStateMachineEditor::_scroll_changed); - - ClassDB::bind_method("_erase_selected", &AnimationNodeStateMachineEditor::_erase_selected); - ClassDB::bind_method("_autoplay_selected", &AnimationNodeStateMachineEditor::_autoplay_selected); - ClassDB::bind_method("_end_selected", &AnimationNodeStateMachineEditor::_end_selected); - ClassDB::bind_method("_update_mode", &AnimationNodeStateMachineEditor::_update_mode); - ClassDB::bind_method("_file_opened", &AnimationNodeStateMachineEditor::_file_opened); } AnimationNodeStateMachineEditor *AnimationNodeStateMachineEditor::singleton = NULL; @@ -1276,21 +1260,21 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_select->set_button_group(bg); tool_select->set_pressed(true); tool_select->set_tooltip(TTR("Select and move nodes.\nRMB to add new nodes.\nShift+LMB to create connections.")); - tool_select->connect_compat("pressed", this, "_update_mode", varray(), CONNECT_DEFERRED); + tool_select->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), varray(), CONNECT_DEFERRED); tool_create = memnew(ToolButton); top_hb->add_child(tool_create); tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); tool_create->set_tooltip(TTR("Create new nodes.")); - tool_create->connect_compat("pressed", this, "_update_mode", varray(), CONNECT_DEFERRED); + tool_create->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), varray(), CONNECT_DEFERRED); tool_connect = memnew(ToolButton); top_hb->add_child(tool_connect); tool_connect->set_toggle_mode(true); tool_connect->set_button_group(bg); tool_connect->set_tooltip(TTR("Connect nodes.")); - tool_connect->connect_compat("pressed", this, "_update_mode", varray(), CONNECT_DEFERRED); + tool_connect->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), varray(), CONNECT_DEFERRED); tool_erase_hb = memnew(HBoxContainer); top_hb->add_child(tool_erase_hb); @@ -1298,7 +1282,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_erase = memnew(ToolButton); tool_erase->set_tooltip(TTR("Remove selected node or transition.")); tool_erase_hb->add_child(tool_erase); - tool_erase->connect_compat("pressed", this, "_erase_selected"); + tool_erase->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_erase_selected)); tool_erase->set_disabled(true); tool_erase_hb->add_child(memnew(VSeparator)); @@ -1306,13 +1290,13 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_autoplay = memnew(ToolButton); tool_autoplay->set_tooltip(TTR("Toggle autoplay this animation on start, restart or seek to zero.")); tool_erase_hb->add_child(tool_autoplay); - tool_autoplay->connect_compat("pressed", this, "_autoplay_selected"); + tool_autoplay->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_autoplay_selected)); tool_autoplay->set_disabled(true); tool_end = memnew(ToolButton); tool_end->set_tooltip(TTR("Set the end animation. This is useful for sub-transitions.")); tool_erase_hb->add_child(tool_end); - tool_end->connect_compat("pressed", this, "_end_selected"); + tool_end->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_end_selected)); tool_end->set_disabled(true); top_hb->add_child(memnew(VSeparator)); @@ -1333,26 +1317,26 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { state_machine_draw = memnew(Control); panel->add_child(state_machine_draw); - state_machine_draw->connect_compat("gui_input", this, "_state_machine_gui_input"); - state_machine_draw->connect_compat("draw", this, "_state_machine_draw"); + state_machine_draw->connect("gui_input", callable_mp(this, &AnimationNodeStateMachineEditor::_state_machine_gui_input)); + state_machine_draw->connect("draw", callable_mp(this, &AnimationNodeStateMachineEditor::_state_machine_draw)); state_machine_draw->set_focus_mode(FOCUS_ALL); state_machine_play_pos = memnew(Control); state_machine_draw->add_child(state_machine_play_pos); state_machine_play_pos->set_mouse_filter(MOUSE_FILTER_PASS); //pass all to parent state_machine_play_pos->set_anchors_and_margins_preset(PRESET_WIDE); - state_machine_play_pos->connect_compat("draw", this, "_state_machine_pos_draw"); + state_machine_play_pos->connect("draw", callable_mp(this, &AnimationNodeStateMachineEditor::_state_machine_pos_draw)); v_scroll = memnew(VScrollBar); state_machine_draw->add_child(v_scroll); v_scroll->set_anchors_and_margins_preset(PRESET_RIGHT_WIDE); - v_scroll->connect_compat("value_changed", this, "_scroll_changed"); + v_scroll->connect("value_changed", callable_mp(this, &AnimationNodeStateMachineEditor::_scroll_changed)); h_scroll = memnew(HScrollBar); state_machine_draw->add_child(h_scroll); h_scroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE); h_scroll->set_margin(MARGIN_RIGHT, -v_scroll->get_size().x * EDSCALE); - h_scroll->connect_compat("value_changed", this, "_scroll_changed"); + h_scroll->connect("value_changed", callable_mp(this, &AnimationNodeStateMachineEditor::_scroll_changed)); error_panel = memnew(PanelContainer); add_child(error_panel); @@ -1366,25 +1350,25 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { menu = memnew(PopupMenu); add_child(menu); - menu->connect_compat("id_pressed", this, "_add_menu_type"); + menu->connect("id_pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_add_menu_type)); animations_menu = memnew(PopupMenu); menu->add_child(animations_menu); animations_menu->set_name("animations"); - animations_menu->connect_compat("index_pressed", this, "_add_animation_type"); + animations_menu->connect("index_pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_add_animation_type)); name_edit = memnew(LineEdit); state_machine_draw->add_child(name_edit); name_edit->hide(); - name_edit->connect_compat("text_entered", this, "_name_edited"); - name_edit->connect_compat("focus_exited", this, "_name_edited_focus_out"); + name_edit->connect("text_entered", callable_mp(this, &AnimationNodeStateMachineEditor::_name_edited)); + name_edit->connect("focus_exited", callable_mp(this, &AnimationNodeStateMachineEditor::_name_edited_focus_out)); name_edit->set_as_toplevel(true); open_file = memnew(EditorFileDialog); add_child(open_file); open_file->set_title(TTR("Open Animation Node")); open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE); - open_file->connect_compat("file_selected", this, "_file_opened"); + open_file->connect("file_selected", callable_mp(this, &AnimationNodeStateMachineEditor::_file_opened)); undo_redo = EditorNode::get_undo_redo(); over_text = false; diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index 8900882725..c9706a7f68 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -85,7 +85,7 @@ void AnimationTreeEditor::_update_path() { b->set_button_group(group); b->set_pressed(true); b->set_focus_mode(FOCUS_NONE); - b->connect_compat("pressed", this, "_path_button_pressed", varray(-1)); + b->connect("pressed", callable_mp(this, &AnimationTreeEditor::_path_button_pressed), varray(-1)); path_hb->add_child(b); for (int i = 0; i < button_path.size(); i++) { b = memnew(Button); @@ -95,7 +95,7 @@ void AnimationTreeEditor::_update_path() { path_hb->add_child(b); b->set_pressed(true); b->set_focus_mode(FOCUS_NONE); - b->connect_compat("pressed", this, "_path_button_pressed", varray(i)); + b->connect("pressed", callable_mp(this, &AnimationTreeEditor::_path_button_pressed), varray(i)); } } @@ -167,7 +167,6 @@ void AnimationTreeEditor::_notification(int p_what) { } void AnimationTreeEditor::_bind_methods() { - ClassDB::bind_method("_path_button_pressed", &AnimationTreeEditor::_path_button_pressed); } AnimationTreeEditor *AnimationTreeEditor::singleton = NULL; diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index c8cbc59e45..e598fc5d8b 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -86,9 +86,6 @@ void EditorAssetLibraryItem::_author_clicked() { void EditorAssetLibraryItem::_bind_methods() { ClassDB::bind_method("set_image", &EditorAssetLibraryItem::set_image); - ClassDB::bind_method("_asset_clicked", &EditorAssetLibraryItem::_asset_clicked); - ClassDB::bind_method("_category_clicked", &EditorAssetLibraryItem::_category_clicked); - ClassDB::bind_method("_author_clicked", &EditorAssetLibraryItem::_author_clicked); ADD_SIGNAL(MethodInfo("asset_selected")); ADD_SIGNAL(MethodInfo("category_selected")); ADD_SIGNAL(MethodInfo("author_selected")); @@ -112,7 +109,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() { icon = memnew(TextureButton); icon->set_custom_minimum_size(Size2(64, 64) * EDSCALE); icon->set_default_cursor_shape(CURSOR_POINTING_HAND); - icon->connect_compat("pressed", this, "_asset_clicked"); + icon->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_asset_clicked)); hb->add_child(icon); @@ -123,17 +120,17 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() { title = memnew(LinkButton); title->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER); - title->connect_compat("pressed", this, "_asset_clicked"); + title->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_asset_clicked)); vb->add_child(title); category = memnew(LinkButton); category->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER); - category->connect_compat("pressed", this, "_category_clicked"); + category->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_category_clicked)); vb->add_child(category); author = memnew(LinkButton); author->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER); - author->connect_compat("pressed", this, "_author_clicked"); + author->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_author_clicked)); vb->add_child(author); price = memnew(Label); @@ -208,8 +205,6 @@ void EditorAssetLibraryItemDescription::_notification(int p_what) { void EditorAssetLibraryItemDescription::_bind_methods() { ClassDB::bind_method(D_METHOD("set_image"), &EditorAssetLibraryItemDescription::set_image); - ClassDB::bind_method(D_METHOD("_link_click"), &EditorAssetLibraryItemDescription::_link_click); - ClassDB::bind_method(D_METHOD("_preview_click"), &EditorAssetLibraryItemDescription::_preview_click); } void EditorAssetLibraryItemDescription::_link_click(const String &p_url) { @@ -263,7 +258,7 @@ void EditorAssetLibraryItemDescription::add_preview(int p_id, bool p_video, cons preview.button->set_flat(true); preview.button->set_icon(get_icon("ThumbnailWait", "EditorIcons")); preview.button->set_toggle_mode(true); - preview.button->connect_compat("pressed", this, "_preview_click", varray(p_id)); + preview.button->connect("pressed", callable_mp(this, &EditorAssetLibraryItemDescription::_preview_click), varray(p_id)); preview_hb->add_child(preview.button); if (!p_video) { preview.image = get_icon("ThumbnailWait", "EditorIcons"); @@ -290,7 +285,7 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() { description = memnew(RichTextLabel); desc_vbox->add_child(description); description->set_v_size_flags(SIZE_EXPAND_FILL); - description->connect_compat("meta_clicked", this, "_link_click"); + description->connect("meta_clicked", callable_mp(this, &EditorAssetLibraryItemDescription::_link_click)); description->add_constant_override("line_separation", Math::round(5 * EDSCALE)); VBoxContainer *previews_vbox = memnew(VBoxContainer); @@ -500,11 +495,6 @@ void EditorAssetLibraryItemDownload::_make_request() { void EditorAssetLibraryItemDownload::_bind_methods() { - ClassDB::bind_method("_http_download_completed", &EditorAssetLibraryItemDownload::_http_download_completed); - ClassDB::bind_method("_install", &EditorAssetLibraryItemDownload::_install); - ClassDB::bind_method("_close", &EditorAssetLibraryItemDownload::_close); - ClassDB::bind_method("_make_request", &EditorAssetLibraryItemDownload::_make_request); - ADD_SIGNAL(MethodInfo("install_asset", PropertyInfo(Variant::STRING, "zip_path"), PropertyInfo(Variant::STRING, "name"))); } @@ -526,7 +516,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { title->set_h_size_flags(SIZE_EXPAND_FILL); dismiss = memnew(TextureButton); - dismiss->connect_compat("pressed", this, "_close"); + dismiss->connect("pressed", callable_mp(this, &EditorAssetLibraryItemDownload::_close)); title_hb->add_child(dismiss); title->set_clip_text(true); @@ -546,11 +536,11 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { install = memnew(Button); install->set_text(TTR("Install...")); install->set_disabled(true); - install->connect_compat("pressed", this, "_install"); + install->connect("pressed", callable_mp(this, &EditorAssetLibraryItemDownload::_install)); retry = memnew(Button); retry->set_text(TTR("Retry")); - retry->connect_compat("pressed", this, "_make_request"); + retry->connect("pressed", callable_mp(this, &EditorAssetLibraryItemDownload::_make_request)); hb2->add_child(retry); hb2->add_child(install); @@ -558,7 +548,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { download = memnew(HTTPRequest); add_child(download); - download->connect_compat("request_completed", this, "_http_download_completed"); + download->connect("request_completed", callable_mp(this, &EditorAssetLibraryItemDownload::_http_download_completed)); download->set_use_threads(EDITOR_DEF("asset_library/use_threads", true)); download_error = memnew(AcceptDialog); @@ -567,7 +557,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { asset_installer = memnew(EditorAssetInstaller); add_child(asset_installer); - asset_installer->connect_compat("confirmed", this, "_close"); + asset_installer->connect("confirmed", callable_mp(this, &EditorAssetLibraryItemDownload::_close)); prev_status = -1; @@ -657,7 +647,7 @@ void EditorAssetLibrary::_install_asset() { if (templates_only) { download->set_external_install(true); - download->connect_compat("install_asset", this, "_install_external_asset"); + download->connect("install_asset", callable_mp(this, &EditorAssetLibrary::_install_external_asset)); } } @@ -892,7 +882,7 @@ void EditorAssetLibrary::_request_image(ObjectID p_for, String p_image_url, Imag iq.queue_id = ++last_queue_id; iq.active = false; - iq.request->connect_compat("request_completed", this, "_image_request_completed", varray(iq.queue_id)); + iq.request->connect("request_completed", callable_mp(this, &EditorAssetLibrary::_image_request_completed), varray(iq.queue_id)); image_queue[iq.queue_id] = iq; @@ -991,7 +981,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int Button *first = memnew(Button); first->set_text(TTR("First")); if (p_page != 0) { - first->connect_compat("pressed", this, "_search", varray(0)); + first->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search), varray(0)); } else { first->set_disabled(true); first->set_focus_mode(Control::FOCUS_NONE); @@ -1001,7 +991,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int Button *prev = memnew(Button); prev->set_text(TTR("Previous")); if (p_page > 0) { - prev->connect_compat("pressed", this, "_search", varray(p_page - 1)); + prev->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search), varray(p_page - 1)); } else { prev->set_disabled(true); prev->set_focus_mode(Control::FOCUS_NONE); @@ -1023,7 +1013,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int Button *current = memnew(Button); current->set_text(itos(i + 1)); - current->connect_compat("pressed", this, "_search", varray(i)); + current->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search), varray(i)); hbc->add_child(current); } @@ -1032,7 +1022,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int Button *next = memnew(Button); next->set_text(TTR("Next")); if (p_page < p_page_count - 1) { - next->connect_compat("pressed", this, "_search", varray(p_page + 1)); + next->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search), varray(p_page + 1)); } else { next->set_disabled(true); next->set_focus_mode(Control::FOCUS_NONE); @@ -1043,7 +1033,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int Button *last = memnew(Button); last->set_text(TTR("Last")); if (p_page != p_page_count - 1) { - last->connect_compat("pressed", this, "_search", varray(p_page_count - 1)); + last->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search), varray(p_page_count - 1)); } else { last->set_disabled(true); last->set_focus_mode(Control::FOCUS_NONE); @@ -1238,9 +1228,9 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const EditorAssetLibraryItem *item = memnew(EditorAssetLibraryItem); asset_items->add_child(item); item->configure(r["title"], r["asset_id"], category_map[r["category_id"]], r["category_id"], r["author"], r["author_id"], r["cost"]); - item->connect_compat("asset_selected", this, "_select_asset"); - item->connect_compat("author_selected", this, "_select_author"); - item->connect_compat("category_selected", this, "_select_category"); + item->connect("asset_selected", callable_mp(this, &EditorAssetLibrary::_select_asset)); + item->connect("author_selected", callable_mp(this, &EditorAssetLibrary::_select_author)); + item->connect("category_selected", callable_mp(this, &EditorAssetLibrary::_select_category)); if (r.has("icon_url") && r["icon_url"] != "") { _request_image(item->get_instance_id(), r["icon_url"], IMAGE_QUEUE_ICON, 0); @@ -1271,7 +1261,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const description = memnew(EditorAssetLibraryItemDescription); add_child(description); description->popup_centered_minsize(); - description->connect_compat("confirmed", this, "_install_asset"); + description->connect("confirmed", callable_mp(this, &EditorAssetLibrary::_install_asset)); description->configure(r["title"], r["asset_id"], category_map[r["category_id"]], r["category_id"], r["author"], r["author_id"], r["cost"], r["version"], r["version_string"], r["description"], r["download_url"], r["browse_url"], r["download_hash"]); @@ -1346,21 +1336,6 @@ void EditorAssetLibrary::disable_community_support() { void EditorAssetLibrary::_bind_methods() { ClassDB::bind_method("_unhandled_input", &EditorAssetLibrary::_unhandled_input); - ClassDB::bind_method("_http_request_completed", &EditorAssetLibrary::_http_request_completed); - ClassDB::bind_method("_select_asset", &EditorAssetLibrary::_select_asset); - ClassDB::bind_method("_select_author", &EditorAssetLibrary::_select_author); - ClassDB::bind_method("_select_category", &EditorAssetLibrary::_select_category); - ClassDB::bind_method("_image_request_completed", &EditorAssetLibrary::_image_request_completed); - ClassDB::bind_method("_search", &EditorAssetLibrary::_search, DEFVAL(0)); - ClassDB::bind_method("_search_text_entered", &EditorAssetLibrary::_search_text_entered); - ClassDB::bind_method("_install_asset", &EditorAssetLibrary::_install_asset); - ClassDB::bind_method("_manage_plugins", &EditorAssetLibrary::_manage_plugins); - ClassDB::bind_method("_asset_open", &EditorAssetLibrary::_asset_open); - ClassDB::bind_method("_asset_file_selected", &EditorAssetLibrary::_asset_file_selected); - ClassDB::bind_method("_repository_changed", &EditorAssetLibrary::_repository_changed); - ClassDB::bind_method("_support_toggled", &EditorAssetLibrary::_support_toggled); - ClassDB::bind_method("_rerun_search", &EditorAssetLibrary::_rerun_search); - ClassDB::bind_method("_install_external_asset", &EditorAssetLibrary::_install_external_asset); ADD_SIGNAL(MethodInfo("install_asset", PropertyInfo(Variant::STRING, "zip_path"), PropertyInfo(Variant::STRING, "name"))); } @@ -1383,9 +1358,9 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { filter = memnew(LineEdit); search_hb->add_child(filter); filter->set_h_size_flags(SIZE_EXPAND_FILL); - filter->connect_compat("text_entered", this, "_search_text_entered"); + filter->connect("text_entered", callable_mp(this, &EditorAssetLibrary::_search_text_entered)); search = memnew(Button(TTR("Search"))); - search->connect_compat("pressed", this, "_search"); + search->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search)); search_hb->add_child(search); if (!p_templates_only) @@ -1394,12 +1369,12 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { Button *open_asset = memnew(Button); open_asset->set_text(TTR("Import...")); search_hb->add_child(open_asset); - open_asset->connect_compat("pressed", this, "_asset_open"); + open_asset->connect("pressed", callable_mp(this, &EditorAssetLibrary::_asset_open)); Button *plugins = memnew(Button); plugins->set_text(TTR("Plugins...")); search_hb->add_child(plugins); - plugins->connect_compat("pressed", this, "_manage_plugins"); + plugins->connect("pressed", callable_mp(this, &EditorAssetLibrary::_manage_plugins)); if (p_templates_only) { open_asset->hide(); @@ -1418,7 +1393,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { search_hb2->add_child(sort); sort->set_h_size_flags(SIZE_EXPAND_FILL); - sort->connect_compat("item_selected", this, "_rerun_search"); + sort->connect("item_selected", callable_mp(this, &EditorAssetLibrary::_rerun_search)); search_hb2->add_child(memnew(VSeparator)); @@ -1427,7 +1402,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { categories->add_item(TTR("All")); search_hb2->add_child(categories); categories->set_h_size_flags(SIZE_EXPAND_FILL); - categories->connect_compat("item_selected", this, "_rerun_search"); + categories->connect("item_selected", callable_mp(this, &EditorAssetLibrary::_rerun_search)); search_hb2->add_child(memnew(VSeparator)); @@ -1439,7 +1414,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { repository->add_item("localhost"); repository->set_item_metadata(1, "http://127.0.0.1/asset-library/api"); - repository->connect_compat("item_selected", this, "_repository_changed"); + repository->connect("item_selected", callable_mp(this, &EditorAssetLibrary::_repository_changed)); search_hb2->add_child(repository); repository->set_h_size_flags(SIZE_EXPAND_FILL); @@ -1454,7 +1429,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { support->get_popup()->add_check_item(TTR("Testing"), SUPPORT_TESTING); support->get_popup()->set_item_checked(SUPPORT_OFFICIAL, true); support->get_popup()->set_item_checked(SUPPORT_COMMUNITY, true); - support->get_popup()->connect_compat("id_pressed", this, "_support_toggled"); + support->get_popup()->connect("id_pressed", callable_mp(this, &EditorAssetLibrary::_support_toggled)); ///////// @@ -1510,7 +1485,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { request = memnew(HTTPRequest); add_child(request); request->set_use_threads(EDITOR_DEF("asset_library/use_threads", true)); - request->connect_compat("request_completed", this, "_http_request_completed"); + request->connect("request_completed", callable_mp(this, &EditorAssetLibrary::_http_request_completed)); last_queue_id = 0; @@ -1543,7 +1518,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { asset_open->add_filter("*.zip ; " + TTR("Assets ZIP File")); asset_open->set_mode(EditorFileDialog::MODE_OPEN_FILE); add_child(asset_open); - asset_open->connect_compat("file_selected", this, "_asset_file_selected"); + asset_open->connect("file_selected", callable_mp(this, &EditorAssetLibrary::_asset_file_selected)); asset_installer = NULL; } diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp index e4a9c38a99..7a1722c73b 100644 --- a/editor/plugins/audio_stream_editor_plugin.cpp +++ b/editor/plugins/audio_stream_editor_plugin.cpp @@ -39,7 +39,7 @@ void AudioStreamEditor::_notification(int p_what) { if (p_what == NOTIFICATION_READY) { - AudioStreamPreviewGenerator::get_singleton()->connect_compat("preview_updated", this, "_preview_changed"); + AudioStreamPreviewGenerator::get_singleton()->connect("preview_updated", callable_mp(this, &AudioStreamEditor::_preview_changed)); } if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) { @@ -197,14 +197,6 @@ void AudioStreamEditor::edit(Ref<AudioStream> p_stream) { } void AudioStreamEditor::_bind_methods() { - - ClassDB::bind_method(D_METHOD("_preview_changed"), &AudioStreamEditor::_preview_changed); - ClassDB::bind_method(D_METHOD("_play"), &AudioStreamEditor::_play); - ClassDB::bind_method(D_METHOD("_stop"), &AudioStreamEditor::_stop); - ClassDB::bind_method(D_METHOD("_on_finished"), &AudioStreamEditor::_on_finished); - ClassDB::bind_method(D_METHOD("_draw_preview"), &AudioStreamEditor::_draw_preview); - ClassDB::bind_method(D_METHOD("_draw_indicator"), &AudioStreamEditor::_draw_indicator); - ClassDB::bind_method(D_METHOD("_on_input_indicator"), &AudioStreamEditor::_on_input_indicator); } AudioStreamEditor::AudioStreamEditor() { @@ -214,7 +206,7 @@ AudioStreamEditor::AudioStreamEditor() { _dragging = false; _player = memnew(AudioStreamPlayer); - _player->connect_compat("finished", this, "_on_finished"); + _player->connect("finished", callable_mp(this, &AudioStreamEditor::_on_finished)); add_child(_player); VBoxContainer *vbox = memnew(VBoxContainer); @@ -223,13 +215,13 @@ AudioStreamEditor::AudioStreamEditor() { _preview = memnew(ColorRect); _preview->set_v_size_flags(SIZE_EXPAND_FILL); - _preview->connect_compat("draw", this, "_draw_preview"); + _preview->connect("draw", callable_mp(this, &AudioStreamEditor::_draw_preview)); vbox->add_child(_preview); _indicator = memnew(Control); _indicator->set_anchors_and_margins_preset(PRESET_WIDE); - _indicator->connect_compat("draw", this, "_draw_indicator"); - _indicator->connect_compat("gui_input", this, "_on_input_indicator"); + _indicator->connect("draw", callable_mp(this, &AudioStreamEditor::_draw_indicator)); + _indicator->connect("gui_input", callable_mp(this, &AudioStreamEditor::_on_input_indicator)); _preview->add_child(_indicator); HBoxContainer *hbox = memnew(HBoxContainer); @@ -239,12 +231,12 @@ AudioStreamEditor::AudioStreamEditor() { _play_button = memnew(ToolButton); hbox->add_child(_play_button); _play_button->set_focus_mode(Control::FOCUS_NONE); - _play_button->connect_compat("pressed", this, "_play"); + _play_button->connect("pressed", callable_mp(this, &AudioStreamEditor::_play)); _stop_button = memnew(ToolButton); hbox->add_child(_stop_button); _stop_button->set_focus_mode(Control::FOCUS_NONE); - _stop_button->connect_compat("pressed", this, "_stop"); + _stop_button->connect("pressed", callable_mp(this, &AudioStreamEditor::_stop)); _current_label = memnew(Label); _current_label->set_align(Label::ALIGN_RIGHT); diff --git a/editor/plugins/camera_editor_plugin.cpp b/editor/plugins/camera_editor_plugin.cpp index 0440785eaf..8726c8c552 100644 --- a/editor/plugins/camera_editor_plugin.cpp +++ b/editor/plugins/camera_editor_plugin.cpp @@ -48,8 +48,6 @@ void CameraEditor::_pressed() { } void CameraEditor::_bind_methods() { - - ClassDB::bind_method(D_METHOD("_pressed"), &CameraEditor::_pressed); } void CameraEditor::edit(Node *p_camera) { @@ -81,7 +79,7 @@ CameraEditor::CameraEditor() { preview->set_margin(MARGIN_RIGHT, 0); preview->set_margin(MARGIN_TOP, 0); preview->set_margin(MARGIN_BOTTOM, 10); - preview->connect_compat("pressed", this, "_pressed"); + preview->connect("pressed", callable_mp(this, &CameraEditor::_pressed)); } void CameraEditorPlugin::edit(Object *p_object) { diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index f5cc0ccf2a..8277879d80 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3891,10 +3891,10 @@ void CanvasItemEditor::_notification(int p_what) { select_sb->set_default_margin(Margin(i), 4); } - AnimationPlayerEditor::singleton->get_track_editor()->connect_compat("visibility_changed", this, "_keying_changed"); + AnimationPlayerEditor::singleton->get_track_editor()->connect("visibility_changed", callable_mp(this, &CanvasItemEditor::_keying_changed)); _keying_changed(); - get_tree()->connect_compat("node_added", this, "_tree_changed", varray()); - get_tree()->connect_compat("node_removed", this, "_tree_changed", varray()); + get_tree()->connect("node_added", callable_mp(this, &CanvasItemEditor::_tree_changed), varray()); + get_tree()->connect("node_removed", callable_mp(this, &CanvasItemEditor::_tree_changed), varray()); } else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { @@ -3902,8 +3902,8 @@ void CanvasItemEditor::_notification(int p_what) { } if (p_what == NOTIFICATION_EXIT_TREE) { - get_tree()->disconnect_compat("node_added", this, "_tree_changed"); - get_tree()->disconnect_compat("node_removed", this, "_tree_changed"); + get_tree()->disconnect("node_added", callable_mp(this, &CanvasItemEditor::_tree_changed)); + get_tree()->disconnect("node_removed", callable_mp(this, &CanvasItemEditor::_tree_changed)); } if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { @@ -4181,7 +4181,7 @@ void CanvasItemEditor::_popup_warning_temporarily(Control *p_control, const floa Timer *timer; if (!popup_temporarily_timers.has(p_control)) { timer = memnew(Timer); - timer->connect_compat("timeout", this, "_popup_warning_depop", varray(p_control)); + timer->connect("timeout", callable_mp(this, &CanvasItemEditor::_popup_warning_depop), varray(p_control)); timer->set_one_shot(true); add_child(timer); @@ -5060,31 +5060,11 @@ void CanvasItemEditor::_focus_selection(int p_op) { void CanvasItemEditor::_bind_methods() { - ClassDB::bind_method("_button_zoom_minus", &CanvasItemEditor::_button_zoom_minus); - ClassDB::bind_method("_button_zoom_reset", &CanvasItemEditor::_button_zoom_reset); - ClassDB::bind_method("_button_zoom_plus", &CanvasItemEditor::_button_zoom_plus); - ClassDB::bind_method("_button_toggle_smart_snap", &CanvasItemEditor::_button_toggle_smart_snap); - ClassDB::bind_method("_button_toggle_grid_snap", &CanvasItemEditor::_button_toggle_grid_snap); - ClassDB::bind_method(D_METHOD("_button_override_camera", "pressed"), &CanvasItemEditor::_button_override_camera); ClassDB::bind_method(D_METHOD("_update_override_camera_button", "game_running"), &CanvasItemEditor::_update_override_camera_button); - ClassDB::bind_method("_button_toggle_anchor_mode", &CanvasItemEditor::_button_toggle_anchor_mode); - ClassDB::bind_method("_update_scroll", &CanvasItemEditor::_update_scroll); - ClassDB::bind_method("_update_scrollbars", &CanvasItemEditor::_update_scrollbars); - ClassDB::bind_method("_popup_callback", &CanvasItemEditor::_popup_callback); ClassDB::bind_method("_get_editor_data", &CanvasItemEditor::_get_editor_data); - ClassDB::bind_method("_button_tool_select", &CanvasItemEditor::_button_tool_select); - ClassDB::bind_method("_keying_changed", &CanvasItemEditor::_keying_changed); ClassDB::bind_method("_unhandled_key_input", &CanvasItemEditor::_unhandled_key_input); - ClassDB::bind_method("_draw_viewport", &CanvasItemEditor::_draw_viewport); - ClassDB::bind_method("_gui_input_viewport", &CanvasItemEditor::_gui_input_viewport); - ClassDB::bind_method("_snap_changed", &CanvasItemEditor::_snap_changed); ClassDB::bind_method("_queue_update_bone_list", &CanvasItemEditor::_update_bone_list); ClassDB::bind_method("_update_bone_list", &CanvasItemEditor::_update_bone_list); - ClassDB::bind_method("_tree_changed", &CanvasItemEditor::_tree_changed); - ClassDB::bind_method("_selection_changed", &CanvasItemEditor::_selection_changed); - ClassDB::bind_method("_popup_warning_depop", &CanvasItemEditor::_popup_warning_depop); - ClassDB::bind_method(D_METHOD("_selection_result_pressed"), &CanvasItemEditor::_selection_result_pressed); - ClassDB::bind_method(D_METHOD("_selection_menu_hide"), &CanvasItemEditor::_selection_menu_hide); ClassDB::bind_method(D_METHOD("set_state"), &CanvasItemEditor::set_state); ClassDB::bind_method(D_METHOD("update_viewport"), &CanvasItemEditor::update_viewport); @@ -5411,7 +5391,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { editor_selection = p_editor->get_editor_selection(); editor_selection->add_editor_plugin(this); editor_selection->connect_compat("selection_changed", this, "update"); - editor_selection->connect_compat("selection_changed", this, "_selection_changed"); + editor_selection->connect("selection_changed", callable_mp(this, &CanvasItemEditor::_selection_changed)); editor->call_deferred("connect", make_binds("play_pressed", Callable(this, "_update_override_camera_button"), true)); editor->call_deferred("connect", make_binds("stop_pressed", Callable(this, "_update_override_camera_button"), false)); @@ -5434,7 +5414,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { viewport_scrollable->set_clip_contents(true); viewport_scrollable->set_v_size_flags(SIZE_EXPAND_FILL); viewport_scrollable->set_h_size_flags(SIZE_EXPAND_FILL); - viewport_scrollable->connect_compat("draw", this, "_update_scrollbars"); + viewport_scrollable->connect("draw", callable_mp(this, &CanvasItemEditor::_update_scrollbars)); ViewportContainer *scene_tree = memnew(ViewportContainer); viewport_scrollable->add_child(scene_tree); @@ -5456,8 +5436,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { viewport->set_anchors_and_margins_preset(Control::PRESET_WIDE); viewport->set_clip_contents(true); viewport->set_focus_mode(FOCUS_ALL); - viewport->connect_compat("draw", this, "_draw_viewport"); - viewport->connect_compat("gui_input", this, "_gui_input_viewport"); + viewport->connect("draw", callable_mp(this, &CanvasItemEditor::_draw_viewport)); + viewport->connect("gui_input", callable_mp(this, &CanvasItemEditor::_gui_input_viewport)); info_overlay = memnew(VBoxContainer); info_overlay->set_anchors_and_margins_preset(Control::PRESET_BOTTOM_LEFT); @@ -5485,25 +5465,25 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { h_scroll = memnew(HScrollBar); viewport->add_child(h_scroll); - h_scroll->connect_compat("value_changed", this, "_update_scroll"); + h_scroll->connect("value_changed", callable_mp(this, &CanvasItemEditor::_update_scroll)); h_scroll->hide(); v_scroll = memnew(VScrollBar); viewport->add_child(v_scroll); - v_scroll->connect_compat("value_changed", this, "_update_scroll"); + v_scroll->connect("value_changed", callable_mp(this, &CanvasItemEditor::_update_scroll)); v_scroll->hide(); viewport->add_child(controls_vb); zoom_minus = memnew(ToolButton); zoom_hb->add_child(zoom_minus); - zoom_minus->connect_compat("pressed", this, "_button_zoom_minus"); + zoom_minus->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_zoom_minus)); zoom_minus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_minus", TTR("Zoom Out"), KEY_MASK_CMD | KEY_MINUS)); zoom_minus->set_focus_mode(FOCUS_NONE); zoom_reset = memnew(ToolButton); zoom_hb->add_child(zoom_reset); - zoom_reset->connect_compat("pressed", this, "_button_zoom_reset"); + zoom_reset->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_zoom_reset)); zoom_reset->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_reset", TTR("Zoom Reset"), KEY_MASK_CMD | KEY_0)); zoom_reset->set_focus_mode(FOCUS_NONE); zoom_reset->set_text_align(Button::TextAlign::ALIGN_CENTER); @@ -5512,7 +5492,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { zoom_plus = memnew(ToolButton); zoom_hb->add_child(zoom_plus); - zoom_plus->connect_compat("pressed", this, "_button_zoom_plus"); + zoom_plus->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_zoom_plus)); zoom_plus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_plus", TTR("Zoom In"), KEY_MASK_CMD | KEY_EQUAL)); // Usually direct access key for PLUS zoom_plus->set_focus_mode(FOCUS_NONE); @@ -5521,7 +5501,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { select_button = memnew(ToolButton); hb->add_child(select_button); select_button->set_toggle_mode(true); - select_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_SELECT)); + select_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_SELECT)); select_button->set_pressed(true); select_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/select_mode", TTR("Select Mode"), KEY_Q)); select_button->set_tooltip(keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate") + "\n" + TTR("Alt+Drag: Move") + "\n" + TTR("Press 'v' to Change Pivot, 'Shift+v' to Drag Pivot (while moving).") + "\n" + TTR("Alt+RMB: Depth list selection")); @@ -5531,21 +5511,21 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { move_button = memnew(ToolButton); hb->add_child(move_button); move_button->set_toggle_mode(true); - move_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_MOVE)); + move_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_MOVE)); move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode", TTR("Move Mode"), KEY_W)); move_button->set_tooltip(TTR("Move Mode")); rotate_button = memnew(ToolButton); hb->add_child(rotate_button); rotate_button->set_toggle_mode(true); - rotate_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_ROTATE)); + rotate_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_ROTATE)); rotate_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/rotate_mode", TTR("Rotate Mode"), KEY_E)); rotate_button->set_tooltip(TTR("Rotate Mode")); scale_button = memnew(ToolButton); hb->add_child(scale_button); scale_button->set_toggle_mode(true); - scale_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_SCALE)); + scale_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_SCALE)); scale_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/scale_mode", TTR("Scale Mode"), KEY_S)); scale_button->set_tooltip(TTR("Scale Mode")); @@ -5554,25 +5534,25 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { list_select_button = memnew(ToolButton); hb->add_child(list_select_button); list_select_button->set_toggle_mode(true); - list_select_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_LIST_SELECT)); + list_select_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_LIST_SELECT)); list_select_button->set_tooltip(TTR("Show a list of all objects at the position clicked\n(same as Alt+RMB in select mode).")); pivot_button = memnew(ToolButton); hb->add_child(pivot_button); pivot_button->set_toggle_mode(true); - pivot_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_EDIT_PIVOT)); + pivot_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_EDIT_PIVOT)); pivot_button->set_tooltip(TTR("Click to change object's rotation pivot.")); pan_button = memnew(ToolButton); hb->add_child(pan_button); pan_button->set_toggle_mode(true); - pan_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_PAN)); + pan_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_PAN)); pan_button->set_tooltip(TTR("Pan Mode")); ruler_button = memnew(ToolButton); hb->add_child(ruler_button); ruler_button->set_toggle_mode(true); - ruler_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_RULER)); + ruler_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_RULER)); ruler_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/ruler_mode", TTR("Ruler Mode"), KEY_R)); ruler_button->set_tooltip(TTR("Ruler Mode")); @@ -5581,14 +5561,14 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { smart_snap_button = memnew(ToolButton); hb->add_child(smart_snap_button); smart_snap_button->set_toggle_mode(true); - smart_snap_button->connect_compat("toggled", this, "_button_toggle_smart_snap"); + smart_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_smart_snap)); smart_snap_button->set_tooltip(TTR("Toggle smart snapping.")); smart_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_smart_snap", TTR("Use Smart Snap"), KEY_MASK_SHIFT | KEY_S)); grid_snap_button = memnew(ToolButton); hb->add_child(grid_snap_button); grid_snap_button->set_toggle_mode(true); - grid_snap_button->connect_compat("toggled", this, "_button_toggle_grid_snap"); + grid_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_grid_snap)); grid_snap_button->set_tooltip(TTR("Toggle grid snapping.")); grid_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_grid_snap", TTR("Use Grid Snap"), KEY_MASK_SHIFT | KEY_G)); @@ -5599,7 +5579,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { snap_config_menu->set_switch_on_hover(true); PopupMenu *p = snap_config_menu->get_popup(); - p->connect_compat("id_pressed", this, "_popup_callback"); + p->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback)); p->set_hide_on_checkable_item_selection(false); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_rotation_snap", TTR("Use Rotation Snap")), SNAP_USE_ROTATION); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_scale_snap", TTR("Use Scale Snap")), SNAP_USE_SCALE); @@ -5613,7 +5593,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { smartsnap_config_popup = memnew(PopupMenu); p->add_child(smartsnap_config_popup); smartsnap_config_popup->set_name("SmartSnapping"); - smartsnap_config_popup->connect_compat("id_pressed", this, "_popup_callback"); + smartsnap_config_popup->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback)); smartsnap_config_popup->set_hide_on_checkable_item_selection(false); smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_parent", TTR("Snap to Parent")), SNAP_USE_NODE_PARENT); smartsnap_config_popup->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_node_anchors", TTR("Snap to Node Anchor")), SNAP_USE_NODE_ANCHORS); @@ -5627,22 +5607,22 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { lock_button = memnew(ToolButton); hb->add_child(lock_button); - lock_button->connect_compat("pressed", this, "_popup_callback", varray(LOCK_SELECTED)); + lock_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(LOCK_SELECTED)); lock_button->set_tooltip(TTR("Lock the selected object in place (can't be moved).")); unlock_button = memnew(ToolButton); hb->add_child(unlock_button); - unlock_button->connect_compat("pressed", this, "_popup_callback", varray(UNLOCK_SELECTED)); + unlock_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(UNLOCK_SELECTED)); unlock_button->set_tooltip(TTR("Unlock the selected object (can be moved).")); group_button = memnew(ToolButton); hb->add_child(group_button); - group_button->connect_compat("pressed", this, "_popup_callback", varray(GROUP_SELECTED)); + group_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(GROUP_SELECTED)); group_button->set_tooltip(TTR("Makes sure the object's children are not selectable.")); ungroup_button = memnew(ToolButton); hb->add_child(ungroup_button); - ungroup_button->connect_compat("pressed", this, "_popup_callback", varray(UNGROUP_SELECTED)); + ungroup_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(UNGROUP_SELECTED)); ungroup_button->set_tooltip(TTR("Restores the object's children's ability to be selected.")); hb->add_child(memnew(VSeparator)); @@ -5661,13 +5641,13 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { p->add_separator(); p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_make_bones", TTR("Make Custom Bone(s) from Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B), SKELETON_MAKE_BONES); p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_bones", TTR("Clear Custom Bones")), SKELETON_CLEAR_BONES); - p->connect_compat("id_pressed", this, "_popup_callback"); + p->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback)); hb->add_child(memnew(VSeparator)); override_camera_button = memnew(ToolButton); hb->add_child(override_camera_button); - override_camera_button->connect_compat("toggled", this, "_button_override_camera"); + override_camera_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_override_camera)); override_camera_button->set_toggle_mode(true); override_camera_button->set_disabled(true); _update_override_camera_button(false); @@ -5677,7 +5657,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { view_menu = memnew(MenuButton); view_menu->set_text(TTR("View")); hb->add_child(view_menu); - view_menu->get_popup()->connect_compat("id_pressed", this, "_popup_callback"); + view_menu->get_popup()->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback)); view_menu->set_switch_on_hover(true); p = view_menu->get_popup(); @@ -5705,18 +5685,18 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { presets_menu->set_switch_on_hover(true); p = presets_menu->get_popup(); - p->connect_compat("id_pressed", this, "_popup_callback"); + p->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback)); anchors_popup = memnew(PopupMenu); p->add_child(anchors_popup); anchors_popup->set_name("Anchors"); - anchors_popup->connect_compat("id_pressed", this, "_popup_callback"); + anchors_popup->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback)); anchor_mode_button = memnew(ToolButton); hb->add_child(anchor_mode_button); anchor_mode_button->set_toggle_mode(true); anchor_mode_button->hide(); - anchor_mode_button->connect_compat("toggled", this, "_button_toggle_anchor_mode"); + anchor_mode_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_anchor_mode)); animation_hb = memnew(HBoxContainer); hb->add_child(animation_hb); @@ -5728,7 +5708,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { key_loc_button->set_flat(true); key_loc_button->set_pressed(true); key_loc_button->set_focus_mode(FOCUS_NONE); - key_loc_button->connect_compat("pressed", this, "_popup_callback", varray(ANIM_INSERT_POS)); + key_loc_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(ANIM_INSERT_POS)); key_loc_button->set_tooltip(TTR("Translation mask for inserting keys.")); animation_hb->add_child(key_loc_button); key_rot_button = memnew(Button); @@ -5736,20 +5716,20 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { key_rot_button->set_flat(true); key_rot_button->set_pressed(true); key_rot_button->set_focus_mode(FOCUS_NONE); - key_rot_button->connect_compat("pressed", this, "_popup_callback", varray(ANIM_INSERT_ROT)); + key_rot_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(ANIM_INSERT_ROT)); key_rot_button->set_tooltip(TTR("Rotation mask for inserting keys.")); animation_hb->add_child(key_rot_button); key_scale_button = memnew(Button); key_scale_button->set_toggle_mode(true); key_scale_button->set_flat(true); key_scale_button->set_focus_mode(FOCUS_NONE); - key_scale_button->connect_compat("pressed", this, "_popup_callback", varray(ANIM_INSERT_SCALE)); + key_scale_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(ANIM_INSERT_SCALE)); key_scale_button->set_tooltip(TTR("Scale mask for inserting keys.")); animation_hb->add_child(key_scale_button); key_insert_button = memnew(Button); key_insert_button->set_flat(true); key_insert_button->set_focus_mode(FOCUS_NONE); - key_insert_button->connect_compat("pressed", this, "_popup_callback", varray(ANIM_INSERT_KEY)); + key_insert_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(ANIM_INSERT_KEY)); key_insert_button->set_tooltip(TTR("Insert keys (based on mask).")); key_insert_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/anim_insert_key", TTR("Insert Key"), KEY_INSERT)); animation_hb->add_child(key_insert_button); @@ -5765,7 +5745,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { animation_menu = memnew(MenuButton); animation_menu->set_tooltip(TTR("Animation Key and Pose Options")); animation_hb->add_child(animation_menu); - animation_menu->get_popup()->connect_compat("id_pressed", this, "_popup_callback"); + animation_menu->get_popup()->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback)); animation_menu->set_switch_on_hover(true); p = animation_menu->get_popup(); @@ -5778,7 +5758,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_clear_pose", TTR("Clear Pose"), KEY_MASK_SHIFT | KEY_K), ANIM_CLEAR_POSE); snap_dialog = memnew(SnapDialog); - snap_dialog->connect_compat("confirmed", this, "_snap_changed"); + snap_dialog->connect("confirmed", callable_mp(this, &CanvasItemEditor::_snap_changed)); add_child(snap_dialog); select_sb = Ref<StyleBoxTexture>(memnew(StyleBoxTexture)); @@ -5786,8 +5766,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { selection_menu = memnew(PopupMenu); add_child(selection_menu); selection_menu->set_custom_minimum_size(Vector2(100, 0)); - selection_menu->connect_compat("id_pressed", this, "_selection_result_pressed"); - selection_menu->connect_compat("popup_hide", this, "_selection_menu_hide"); + selection_menu->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_selection_result_pressed)); + selection_menu->connect("popup_hide", callable_mp(this, &CanvasItemEditor::_selection_menu_hide)); multiply_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/multiply_grid_step", TTR("Multiply grid step by 2"), KEY_KP_MULTIPLY); divide_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/divide_grid_step", TTR("Divide grid step by 2"), KEY_KP_DIVIDE); @@ -6234,11 +6214,11 @@ void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p void CanvasItemEditorViewport::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - connect_compat("mouse_exited", this, "_on_mouse_exit"); + connect("mouse_exited", callable_mp(this, &CanvasItemEditorViewport::_on_mouse_exit)); label->add_color_override("font_color", get_color("warning_color", "Editor")); } break; case NOTIFICATION_EXIT_TREE: { - disconnect_compat("mouse_exited", this, "_on_mouse_exit"); + disconnect("mouse_exited", callable_mp(this, &CanvasItemEditorViewport::_on_mouse_exit)); } break; default: break; @@ -6246,10 +6226,6 @@ void CanvasItemEditorViewport::_notification(int p_what) { } void CanvasItemEditorViewport::_bind_methods() { - ClassDB::bind_method(D_METHOD("_on_select_type"), &CanvasItemEditorViewport::_on_select_type); - ClassDB::bind_method(D_METHOD("_on_change_type_confirmed"), &CanvasItemEditorViewport::_on_change_type_confirmed); - ClassDB::bind_method(D_METHOD("_on_change_type_closed"), &CanvasItemEditorViewport::_on_change_type_closed); - ClassDB::bind_method(D_METHOD("_on_mouse_exit"), &CanvasItemEditorViewport::_on_mouse_exit); } CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasItemEditor *p_canvas_item_editor) { @@ -6276,8 +6252,8 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte selector = memnew(AcceptDialog); editor->get_gui_base()->add_child(selector); selector->set_title(TTR("Change Default Type")); - selector->connect_compat("confirmed", this, "_on_change_type_confirmed"); - selector->connect_compat("popup_hide", this, "_on_change_type_closed"); + selector->connect("confirmed", callable_mp(this, &CanvasItemEditorViewport::_on_change_type_confirmed)); + selector->connect("popup_hide", callable_mp(this, &CanvasItemEditorViewport::_on_change_type_closed)); VBoxContainer *vbc = memnew(VBoxContainer); selector->add_child(vbc); @@ -6294,7 +6270,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte CheckBox *check = memnew(CheckBox); btn_group->add_child(check); check->set_text(types[i]); - check->connect_compat("button_down", this, "_on_select_type", varray(check)); + check->connect("button_down", callable_mp(this, &CanvasItemEditorViewport::_on_select_type), varray(check)); check->set_button_group(button_group); } diff --git a/editor/plugins/collision_polygon_editor_plugin.cpp b/editor/plugins/collision_polygon_editor_plugin.cpp index 59bbe031ed..1562286073 100644 --- a/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_editor_plugin.cpp @@ -47,7 +47,7 @@ void Polygon3DEditor::_notification(int p_what) { button_create->set_icon(get_icon("Edit", "EditorIcons")); button_edit->set_icon(get_icon("MovePoint", "EditorIcons")); button_edit->set_pressed(true); - get_tree()->connect_compat("node_removed", this, "_node_removed"); + get_tree()->connect("node_removed", callable_mp(this, &Polygon3DEditor::_node_removed)); } break; case NOTIFICATION_PROCESS: { @@ -518,9 +518,7 @@ void Polygon3DEditor::edit(Node *p_collision_polygon) { void Polygon3DEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("_menu_option"), &Polygon3DEditor::_menu_option); ClassDB::bind_method(D_METHOD("_polygon_draw"), &Polygon3DEditor::_polygon_draw); - ClassDB::bind_method(D_METHOD("_node_removed"), &Polygon3DEditor::_node_removed); } Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) { @@ -532,12 +530,12 @@ Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) { add_child(memnew(VSeparator)); button_create = memnew(ToolButton); add_child(button_create); - button_create->connect_compat("pressed", this, "_menu_option", varray(MODE_CREATE)); + button_create->connect("pressed", callable_mp(this, &Polygon3DEditor::_menu_option), varray(MODE_CREATE)); button_create->set_toggle_mode(true); button_edit = memnew(ToolButton); add_child(button_edit); - button_edit->connect_compat("pressed", this, "_menu_option", varray(MODE_EDIT)); + button_edit->connect("pressed", callable_mp(this, &Polygon3DEditor::_menu_option), varray(MODE_EDIT)); button_edit->set_toggle_mode(true); mode = MODE_EDIT; diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp index ad3f01ec37..119528dfc8 100644 --- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp @@ -240,17 +240,13 @@ void CPUParticles2DEditorPlugin::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - menu->get_popup()->connect_compat("id_pressed", this, "_menu_callback"); + menu->get_popup()->connect("id_pressed", callable_mp(this, &CPUParticles2DEditorPlugin::_menu_callback)); menu->set_icon(menu->get_popup()->get_icon("Particles2D", "EditorIcons")); - file->connect_compat("file_selected", this, "_file_selected"); + file->connect("file_selected", callable_mp(this, &CPUParticles2DEditorPlugin::_file_selected)); } } void CPUParticles2DEditorPlugin::_bind_methods() { - - ClassDB::bind_method(D_METHOD("_menu_callback"), &CPUParticles2DEditorPlugin::_menu_callback); - ClassDB::bind_method(D_METHOD("_file_selected"), &CPUParticles2DEditorPlugin::_file_selected); - ClassDB::bind_method(D_METHOD("_generate_emission_mask"), &CPUParticles2DEditorPlugin::_generate_emission_mask); } CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) { @@ -305,7 +301,7 @@ CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) { toolbar->add_child(emission_mask); - emission_mask->connect_compat("confirmed", this, "_generate_emission_mask"); + emission_mask->connect("confirmed", callable_mp(this, &CPUParticles2DEditorPlugin::_generate_emission_mask)); } CPUParticles2DEditorPlugin::~CPUParticles2DEditorPlugin() { diff --git a/editor/plugins/cpu_particles_editor_plugin.cpp b/editor/plugins/cpu_particles_editor_plugin.cpp index 3d438226d2..2161041ee6 100644 --- a/editor/plugins/cpu_particles_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_editor_plugin.cpp @@ -92,8 +92,6 @@ void CPUParticlesEditor::_generate_emission_points() { } void CPUParticlesEditor::_bind_methods() { - - ClassDB::bind_method("_menu_option", &CPUParticlesEditor::_menu_option); } CPUParticlesEditor::CPUParticlesEditor() { @@ -109,7 +107,7 @@ CPUParticlesEditor::CPUParticlesEditor() { options->get_popup()->add_item(TTR("Create Emission Points From Node"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE); options->get_popup()->add_separator(); options->get_popup()->add_item(TTR("Restart"), MENU_OPTION_RESTART); - options->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + options->get_popup()->connect("id_pressed", callable_mp(this, &CPUParticlesEditor::_menu_option)); } void CPUParticlesEditorPlugin::edit(Object *p_object) { diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 5f4fb19d9e..d0926ee47d 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -49,7 +49,7 @@ CurveEditor::CurveEditor() { set_clip_contents(true); _context_menu = memnew(PopupMenu); - _context_menu->connect_compat("id_pressed", this, "_on_context_menu_item_selected"); + _context_menu->connect("id_pressed", callable_mp(this, &CurveEditor::on_context_menu_item_selected)); add_child(_context_menu); _presets_menu = memnew(PopupMenu); @@ -60,7 +60,7 @@ CurveEditor::CurveEditor() { _presets_menu->add_item(TTR("Ease In"), PRESET_EASE_IN); _presets_menu->add_item(TTR("Ease Out"), PRESET_EASE_OUT); _presets_menu->add_item(TTR("Smoothstep"), PRESET_SMOOTHSTEP); - _presets_menu->connect_compat("id_pressed", this, "_on_preset_item_selected"); + _presets_menu->connect("id_pressed", callable_mp(this, &CurveEditor::on_preset_item_selected)); _context_menu->add_child(_presets_menu); } @@ -749,9 +749,7 @@ void CurveEditor::_draw() { void CurveEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &CurveEditor::on_gui_input); - ClassDB::bind_method(D_METHOD("_on_preset_item_selected"), &CurveEditor::on_preset_item_selected); ClassDB::bind_method(D_METHOD("_curve_changed"), &CurveEditor::_curve_changed); - ClassDB::bind_method(D_METHOD("_on_context_menu_item_selected"), &CurveEditor::on_context_menu_item_selected); } //--------------- diff --git a/editor/plugins/gi_probe_editor_plugin.cpp b/editor/plugins/gi_probe_editor_plugin.cpp index 9231d38a02..ddcbb11f7c 100644 --- a/editor/plugins/gi_probe_editor_plugin.cpp +++ b/editor/plugins/gi_probe_editor_plugin.cpp @@ -133,9 +133,6 @@ void GIProbeEditorPlugin::_giprobe_save_path_and_bake(const String &p_path) { } void GIProbeEditorPlugin::_bind_methods() { - - ClassDB::bind_method("_bake", &GIProbeEditorPlugin::_bake); - ClassDB::bind_method("_giprobe_save_path_and_bake", &GIProbeEditorPlugin::_giprobe_save_path_and_bake); } GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) { @@ -147,7 +144,7 @@ GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) { bake = memnew(ToolButton); bake->set_icon(editor->get_gui_base()->get_icon("Bake", "EditorIcons")); bake->set_text(TTR("Bake GI Probe")); - bake->connect_compat("pressed", this, "_bake"); + bake->connect("pressed", callable_mp(this, &GIProbeEditorPlugin::_bake)); bake_hb->add_child(bake); bake_info = memnew(Label); bake_info->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -159,7 +156,7 @@ GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) { probe_file = memnew(EditorFileDialog); probe_file->set_mode(EditorFileDialog::MODE_SAVE_FILE); probe_file->add_filter("*.res"); - probe_file->connect_compat("file_selected", this, "_giprobe_save_path_and_bake"); + probe_file->connect("file_selected", callable_mp(this, &GIProbeEditorPlugin::_giprobe_save_path_and_bake)); get_editor_interface()->get_base_control()->add_child(probe_file); probe_file->set_title(TTR("Select path for GIProbe Data File")); diff --git a/editor/plugins/gradient_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp index b36782ee14..ff03fcf159 100644 --- a/editor/plugins/gradient_editor_plugin.cpp +++ b/editor/plugins/gradient_editor_plugin.cpp @@ -62,15 +62,12 @@ void GradientEditor::_ramp_changed() { } void GradientEditor::_bind_methods() { - - ClassDB::bind_method("_gradient_changed", &GradientEditor::_gradient_changed); - ClassDB::bind_method("_ramp_changed", &GradientEditor::_ramp_changed); } void GradientEditor::set_gradient(const Ref<Gradient> &p_gradient) { gradient = p_gradient; - connect_compat("ramp_changed", this, "_ramp_changed"); - gradient->connect_compat("changed", this, "_gradient_changed"); + connect("ramp_changed", callable_mp(this, &GradientEditor::_ramp_changed)); + gradient->connect("changed", callable_mp(this, &GradientEditor::_gradient_changed)); set_points(gradient->get_points()); } diff --git a/editor/plugins/item_list_editor_plugin.cpp b/editor/plugins/item_list_editor_plugin.cpp index b872a2d932..ba640883c7 100644 --- a/editor/plugins/item_list_editor_plugin.cpp +++ b/editor/plugins/item_list_editor_plugin.cpp @@ -268,7 +268,7 @@ void ItemListEditor::_notification(int p_notification) { del_button->set_icon(get_icon("Remove", "EditorIcons")); } else if (p_notification == NOTIFICATION_READY) { - get_tree()->connect_compat("node_removed", this, "_node_removed"); + get_tree()->connect("node_removed", callable_mp(this, &ItemListEditor::_node_removed)); } } @@ -344,11 +344,6 @@ bool ItemListEditor::handles(Object *p_object) const { } void ItemListEditor::_bind_methods() { - - ClassDB::bind_method("_node_removed", &ItemListEditor::_node_removed); - ClassDB::bind_method("_edit_items", &ItemListEditor::_edit_items); - ClassDB::bind_method("_add_button", &ItemListEditor::_add_pressed); - ClassDB::bind_method("_delete_button", &ItemListEditor::_delete_pressed); } ItemListEditor::ItemListEditor() { @@ -359,7 +354,7 @@ ItemListEditor::ItemListEditor() { toolbar_button = memnew(ToolButton); toolbar_button->set_text(TTR("Items")); add_child(toolbar_button); - toolbar_button->connect_compat("pressed", this, "_edit_items"); + toolbar_button->connect("pressed", callable_mp(this, &ItemListEditor::_edit_items)); dialog = memnew(AcceptDialog); dialog->set_title(TTR("Item List Editor")); @@ -376,14 +371,14 @@ ItemListEditor::ItemListEditor() { add_button = memnew(Button); add_button->set_text(TTR("Add")); hbc->add_child(add_button); - add_button->connect_compat("pressed", this, "_add_button"); + add_button->connect("pressed", callable_mp(this, &ItemListEditor::_add_pressed)); hbc->add_spacer(); del_button = memnew(Button); del_button->set_text(TTR("Delete")); hbc->add_child(del_button); - del_button->connect_compat("pressed", this, "_delete_button"); + del_button->connect("pressed", callable_mp(this, &ItemListEditor::_delete_pressed)); property_editor = memnew(EditorInspector); vbc->add_child(property_editor); diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index bca0bde441..b39465f618 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -105,8 +105,6 @@ void MaterialEditor::_button_pressed(Node *p_button) { } void MaterialEditor::_bind_methods() { - - ClassDB::bind_method(D_METHOD("_button_pressed"), &MaterialEditor::_button_pressed); } MaterialEditor::MaterialEditor() { @@ -171,13 +169,13 @@ MaterialEditor::MaterialEditor() { sphere_switch->set_toggle_mode(true); sphere_switch->set_pressed(true); vb_shape->add_child(sphere_switch); - sphere_switch->connect_compat("pressed", this, "_button_pressed", varray(sphere_switch)); + sphere_switch->connect("pressed", callable_mp(this, &MaterialEditor::_button_pressed), varray(sphere_switch)); box_switch = memnew(TextureButton); box_switch->set_toggle_mode(true); box_switch->set_pressed(false); vb_shape->add_child(box_switch); - box_switch->connect_compat("pressed", this, "_button_pressed", varray(box_switch)); + box_switch->connect("pressed", callable_mp(this, &MaterialEditor::_button_pressed), varray(box_switch)); hb->add_spacer(); @@ -187,12 +185,12 @@ MaterialEditor::MaterialEditor() { light_1_switch = memnew(TextureButton); light_1_switch->set_toggle_mode(true); vb_light->add_child(light_1_switch); - light_1_switch->connect_compat("pressed", this, "_button_pressed", varray(light_1_switch)); + light_1_switch->connect("pressed", callable_mp(this, &MaterialEditor::_button_pressed), varray(light_1_switch)); light_2_switch = memnew(TextureButton); light_2_switch->set_toggle_mode(true); vb_light->add_child(light_2_switch); - light_2_switch->connect_compat("pressed", this, "_button_pressed", varray(light_2_switch)); + light_2_switch->connect("pressed", callable_mp(this, &MaterialEditor::_button_pressed), varray(light_2_switch)); first_enter = true; } diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index 2b25a2328c..5a17f0d4f1 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -111,7 +111,6 @@ void MeshEditor::_button_pressed(Node *p_button) { void MeshEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &MeshEditor::_gui_input); - ClassDB::bind_method(D_METHOD("_button_pressed"), &MeshEditor::_button_pressed); } MeshEditor::MeshEditor() { @@ -157,12 +156,12 @@ MeshEditor::MeshEditor() { light_1_switch = memnew(TextureButton); light_1_switch->set_toggle_mode(true); vb_light->add_child(light_1_switch); - light_1_switch->connect_compat("pressed", this, "_button_pressed", varray(light_1_switch)); + light_1_switch->connect("pressed", callable_mp(this, &MeshEditor::_button_pressed), varray(light_1_switch)); light_2_switch = memnew(TextureButton); light_2_switch->set_toggle_mode(true); vb_light->add_child(light_2_switch); - light_2_switch->connect_compat("pressed", this, "_button_pressed", varray(light_2_switch)); + light_2_switch->connect("pressed", callable_mp(this, &MeshEditor::_button_pressed), varray(light_2_switch)); first_enter = true; diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp index c285bb4e1a..e5b948aad7 100644 --- a/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_editor_plugin.cpp @@ -435,10 +435,6 @@ void MeshInstanceEditor::_create_outline_mesh() { } void MeshInstanceEditor::_bind_methods() { - - ClassDB::bind_method("_menu_option", &MeshInstanceEditor::_menu_option); - ClassDB::bind_method("_create_outline_mesh", &MeshInstanceEditor::_create_outline_mesh); - ClassDB::bind_method("_debug_uv_draw", &MeshInstanceEditor::_debug_uv_draw); } MeshInstanceEditor::MeshInstanceEditor() { @@ -469,7 +465,7 @@ MeshInstanceEditor::MeshInstanceEditor() { options->get_popup()->add_item(TTR("View UV2"), MENU_OPTION_DEBUG_UV2); options->get_popup()->add_item(TTR("Unwrap UV2 for Lightmap/AO"), MENU_OPTION_CREATE_UV2); - options->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + options->get_popup()->connect("id_pressed", callable_mp(this, &MeshInstanceEditor::_menu_option)); outline_dialog = memnew(ConfirmationDialog); outline_dialog->set_title(TTR("Create Outline Mesh")); @@ -487,7 +483,7 @@ MeshInstanceEditor::MeshInstanceEditor() { outline_dialog_vbc->add_margin_child(TTR("Outline Size:"), outline_size); add_child(outline_dialog); - outline_dialog->connect_compat("confirmed", this, "_create_outline_mesh"); + outline_dialog->connect("confirmed", callable_mp(this, &MeshInstanceEditor::_create_outline_mesh)); err_dialog = memnew(AcceptDialog); add_child(err_dialog); @@ -497,7 +493,7 @@ MeshInstanceEditor::MeshInstanceEditor() { add_child(debug_uv_dialog); debug_uv = memnew(Control); debug_uv->set_custom_minimum_size(Size2(600, 600) * EDSCALE); - debug_uv->connect_compat("draw", this, "_debug_uv_draw"); + debug_uv->connect("draw", callable_mp(this, &MeshInstanceEditor::_debug_uv_draw)); debug_uv_dialog->add_child(debug_uv); } diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index 863ea451b5..71976d509b 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -248,10 +248,6 @@ void MeshLibraryEditor::_menu_cbk(int p_option) { } void MeshLibraryEditor::_bind_methods() { - - ClassDB::bind_method("_menu_cbk", &MeshLibraryEditor::_menu_cbk); - ClassDB::bind_method("_menu_confirm", &MeshLibraryEditor::_menu_confirm); - ClassDB::bind_method("_import_scene_cbk", &MeshLibraryEditor::_import_scene_cbk); } MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) { @@ -268,7 +264,7 @@ MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) { file->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper()); } add_child(file); - file->connect_compat("file_selected", this, "_import_scene_cbk"); + file->connect("file_selected", callable_mp(this, &MeshLibraryEditor::_import_scene_cbk)); menu = memnew(MenuButton); SpatialEditor::get_singleton()->add_control_to_menu_panel(menu); @@ -281,13 +277,13 @@ MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) { menu->get_popup()->add_item(TTR("Import from Scene"), MENU_OPTION_IMPORT_FROM_SCENE); menu->get_popup()->add_item(TTR("Update from Scene"), MENU_OPTION_UPDATE_FROM_SCENE); menu->get_popup()->set_item_disabled(menu->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE), true); - menu->get_popup()->connect_compat("id_pressed", this, "_menu_cbk"); + menu->get_popup()->connect("id_pressed", callable_mp(this, &MeshLibraryEditor::_menu_cbk)); menu->hide(); editor = p_editor; cd = memnew(ConfirmationDialog); add_child(cd); - cd->get_ok()->connect_compat("pressed", this, "_menu_confirm"); + cd->get_ok()->connect("pressed", callable_mp(this, &MeshLibraryEditor::_menu_confirm)); } void MeshLibraryEditorPlugin::edit(Object *p_node) { diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index b2ce01b8d8..27d400c035 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -278,11 +278,6 @@ void MultiMeshEditor::_browse(bool p_source) { } void MultiMeshEditor::_bind_methods() { - - ClassDB::bind_method("_menu_option", &MultiMeshEditor::_menu_option); - ClassDB::bind_method("_populate", &MultiMeshEditor::_populate); - ClassDB::bind_method("_browsed", &MultiMeshEditor::_browsed); - ClassDB::bind_method("_browse", &MultiMeshEditor::_browse); } MultiMeshEditor::MultiMeshEditor() { @@ -295,7 +290,7 @@ MultiMeshEditor::MultiMeshEditor() { options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("MultiMeshInstance", "EditorIcons")); options->get_popup()->add_item(TTR("Populate Surface")); - options->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + options->get_popup()->connect("id_pressed", callable_mp(this, &MultiMeshEditor::_menu_option)); populate_dialog = memnew(ConfirmationDialog); populate_dialog->set_title(TTR("Populate MultiMesh")); @@ -313,7 +308,7 @@ MultiMeshEditor::MultiMeshEditor() { Button *b = memnew(Button); hbc->add_child(b); b->set_text(".."); - b->connect_compat("pressed", this, "_browse", make_binds(false)); + b->connect("pressed", callable_mp(this, &MultiMeshEditor::_browse), make_binds(false)); vbc->add_margin_child(TTR("Target Surface:"), hbc); @@ -325,7 +320,7 @@ MultiMeshEditor::MultiMeshEditor() { hbc->add_child(b); b->set_text(".."); vbc->add_margin_child(TTR("Source Mesh:"), hbc); - b->connect_compat("pressed", this, "_browse", make_binds(true)); + b->connect("pressed", callable_mp(this, &MultiMeshEditor::_browse), make_binds(true)); populate_axis = memnew(OptionButton); populate_axis->add_item(TTR("X-Axis")); @@ -371,10 +366,10 @@ MultiMeshEditor::MultiMeshEditor() { populate_dialog->get_ok()->set_text(TTR("Populate")); - populate_dialog->get_ok()->connect_compat("pressed", this, "_populate"); + populate_dialog->get_ok()->connect("pressed", callable_mp(this, &MultiMeshEditor::_populate)); std = memnew(SceneTreeDialog); populate_dialog->add_child(std); - std->connect_compat("selected", this, "_browsed"); + std->connect("selected", callable_mp(this, &MultiMeshEditor::_browsed)); _last_pp_node = NULL; diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index ab23cb9054..812144742f 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -349,18 +349,13 @@ void Particles2DEditorPlugin::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - menu->get_popup()->connect_compat("id_pressed", this, "_menu_callback"); + menu->get_popup()->connect("id_pressed", callable_mp(this, &Particles2DEditorPlugin::_menu_callback)); menu->set_icon(menu->get_popup()->get_icon("Particles2D", "EditorIcons")); - file->connect_compat("file_selected", this, "_file_selected"); + file->connect("file_selected", callable_mp(this, &Particles2DEditorPlugin::_file_selected)); } } void Particles2DEditorPlugin::_bind_methods() { - - ClassDB::bind_method(D_METHOD("_menu_callback"), &Particles2DEditorPlugin::_menu_callback); - ClassDB::bind_method(D_METHOD("_file_selected"), &Particles2DEditorPlugin::_file_selected); - ClassDB::bind_method(D_METHOD("_generate_visibility_rect"), &Particles2DEditorPlugin::_generate_visibility_rect); - ClassDB::bind_method(D_METHOD("_generate_emission_mask"), &Particles2DEditorPlugin::_generate_emission_mask); } Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) { @@ -416,7 +411,7 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) { toolbar->add_child(generate_visibility_rect); - generate_visibility_rect->connect_compat("confirmed", this, "_generate_visibility_rect"); + generate_visibility_rect->connect("confirmed", callable_mp(this, &Particles2DEditorPlugin::_generate_visibility_rect)); emission_mask = memnew(ConfirmationDialog); emission_mask->set_title(TTR("Load Emission Mask")); @@ -433,7 +428,7 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) { toolbar->add_child(emission_mask); - emission_mask->connect_compat("confirmed", this, "_generate_emission_mask"); + emission_mask->connect("confirmed", callable_mp(this, &Particles2DEditorPlugin::_generate_emission_mask)); } Particles2DEditorPlugin::~Particles2DEditorPlugin() { diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 7020abc301..a4d704c6e1 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -203,9 +203,6 @@ void ParticlesEditorBase::_node_selected(const NodePath &p_path) { } void ParticlesEditorBase::_bind_methods() { - - ClassDB::bind_method("_node_selected", &ParticlesEditorBase::_node_selected); - ClassDB::bind_method("_generate_emission_points", &ParticlesEditorBase::_generate_emission_points); } ParticlesEditorBase::ParticlesEditorBase() { @@ -229,11 +226,11 @@ ParticlesEditorBase::ParticlesEditorBase() { emd_vb->add_margin_child(TTR("Emission Source: "), emission_fill); emission_dialog->get_ok()->set_text(TTR("Create")); - emission_dialog->connect_compat("confirmed", this, "_generate_emission_points"); + emission_dialog->connect("confirmed", callable_mp(this, &ParticlesEditorBase::_generate_emission_points)); emission_tree_dialog = memnew(SceneTreeDialog); add_child(emission_tree_dialog); - emission_tree_dialog->connect_compat("selected", this, "_node_selected"); + emission_tree_dialog->connect("selected", callable_mp(this, &ParticlesEditorBase::_node_selected)); } void ParticlesEditor::_node_removed(Node *p_node) { @@ -248,7 +245,7 @@ void ParticlesEditor::_notification(int p_notification) { if (p_notification == NOTIFICATION_ENTER_TREE) { options->set_icon(options->get_popup()->get_icon("Particles", "EditorIcons")); - get_tree()->connect_compat("node_removed", this, "_node_removed"); + get_tree()->connect("node_removed", callable_mp(this, &ParticlesEditor::_node_removed)); } } @@ -423,10 +420,6 @@ void ParticlesEditor::_generate_emission_points() { } void ParticlesEditor::_bind_methods() { - - ClassDB::bind_method("_menu_option", &ParticlesEditor::_menu_option); - ClassDB::bind_method("_generate_aabb", &ParticlesEditor::_generate_aabb); - ClassDB::bind_method("_node_removed", &ParticlesEditor::_node_removed); } ParticlesEditor::ParticlesEditor() { @@ -448,7 +441,7 @@ ParticlesEditor::ParticlesEditor() { options->get_popup()->add_separator(); options->get_popup()->add_item(TTR("Restart"), MENU_OPTION_RESTART); - options->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + options->get_popup()->connect("id_pressed", callable_mp(this, &ParticlesEditor::_menu_option)); generate_aabb = memnew(ConfirmationDialog); generate_aabb->set_title(TTR("Generate Visibility AABB")); @@ -462,7 +455,7 @@ ParticlesEditor::ParticlesEditor() { add_child(generate_aabb); - generate_aabb->connect_compat("confirmed", this, "_generate_aabb"); + generate_aabb->connect("confirmed", callable_mp(this, &ParticlesEditor::_generate_aabb)); } void ParticlesEditorPlugin::edit(Object *p_object) { diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index e642233c64..165df6b500 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -441,14 +441,14 @@ void Path2DEditor::edit(Node *p_path2d) { if (p_path2d) { node = Object::cast_to<Path2D>(p_path2d); - if (!node->is_connected_compat("visibility_changed", this, "_node_visibility_changed")) - node->connect_compat("visibility_changed", this, "_node_visibility_changed"); + if (!node->is_connected("visibility_changed", callable_mp(this, &Path2DEditor::_node_visibility_changed))) + node->connect("visibility_changed", callable_mp(this, &Path2DEditor::_node_visibility_changed)); } else { // node may have been deleted at this point - if (node && node->is_connected_compat("visibility_changed", this, "_node_visibility_changed")) - node->disconnect_compat("visibility_changed", this, "_node_visibility_changed"); + if (node && node->is_connected("visibility_changed", callable_mp(this, &Path2DEditor::_node_visibility_changed))) + node->disconnect("visibility_changed", callable_mp(this, &Path2DEditor::_node_visibility_changed)); node = NULL; } } @@ -456,9 +456,6 @@ void Path2DEditor::edit(Node *p_path2d) { void Path2DEditor::_bind_methods() { //ClassDB::bind_method(D_METHOD("_menu_option"),&Path2DEditor::_menu_option); - ClassDB::bind_method(D_METHOD("_node_visibility_changed"), &Path2DEditor::_node_visibility_changed); - ClassDB::bind_method(D_METHOD("_mode_selected"), &Path2DEditor::_mode_selected); - ClassDB::bind_method(D_METHOD("_handle_option_pressed"), &Path2DEditor::_handle_option_pressed); } void Path2DEditor::_mode_selected(int p_mode) { @@ -555,34 +552,34 @@ Path2DEditor::Path2DEditor(EditorNode *p_editor) { curve_edit->set_toggle_mode(true); curve_edit->set_focus_mode(Control::FOCUS_NONE); curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Click: Add Point") + "\n" + TTR("Left Click: Split Segment (in curve)") + "\n" + TTR("Right Click: Delete Point")); - curve_edit->connect_compat("pressed", this, "_mode_selected", varray(MODE_EDIT)); + curve_edit->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_EDIT)); base_hb->add_child(curve_edit); curve_edit_curve = memnew(ToolButton); curve_edit_curve->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCurve", "EditorIcons")); curve_edit_curve->set_toggle_mode(true); curve_edit_curve->set_focus_mode(Control::FOCUS_NONE); curve_edit_curve->set_tooltip(TTR("Select Control Points (Shift+Drag)")); - curve_edit_curve->connect_compat("pressed", this, "_mode_selected", varray(MODE_EDIT_CURVE)); + curve_edit_curve->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_EDIT_CURVE)); base_hb->add_child(curve_edit_curve); curve_create = memnew(ToolButton); curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCreate", "EditorIcons")); curve_create->set_toggle_mode(true); curve_create->set_focus_mode(Control::FOCUS_NONE); curve_create->set_tooltip(TTR("Add Point (in empty space)")); - curve_create->connect_compat("pressed", this, "_mode_selected", varray(MODE_CREATE)); + curve_create->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_CREATE)); base_hb->add_child(curve_create); curve_del = memnew(ToolButton); curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveDelete", "EditorIcons")); curve_del->set_toggle_mode(true); curve_del->set_focus_mode(Control::FOCUS_NONE); curve_del->set_tooltip(TTR("Delete Point")); - curve_del->connect_compat("pressed", this, "_mode_selected", varray(MODE_DELETE)); + curve_del->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_DELETE)); base_hb->add_child(curve_del); curve_close = memnew(ToolButton); curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveClose", "EditorIcons")); curve_close->set_focus_mode(Control::FOCUS_NONE); curve_close->set_tooltip(TTR("Close Curve")); - curve_close->connect_compat("pressed", this, "_mode_selected", varray(ACTION_CLOSE)); + curve_close->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(ACTION_CLOSE)); base_hb->add_child(curve_close); PopupMenu *menu; @@ -596,7 +593,7 @@ Path2DEditor::Path2DEditor(EditorNode *p_editor) { menu->set_item_checked(HANDLE_OPTION_ANGLE, mirror_handle_angle); menu->add_check_item(TTR("Mirror Handle Lengths")); menu->set_item_checked(HANDLE_OPTION_LENGTH, mirror_handle_length); - menu->connect_compat("id_pressed", this, "_handle_option_pressed"); + menu->connect("id_pressed", callable_mp(this, &Path2DEditor::_handle_option_pressed)); base_hb->hide(); diff --git a/editor/plugins/path_editor_plugin.cpp b/editor/plugins/path_editor_plugin.cpp index b955bf7f41..42b1045666 100644 --- a/editor/plugins/path_editor_plugin.cpp +++ b/editor/plugins/path_editor_plugin.cpp @@ -543,18 +543,14 @@ void PathEditorPlugin::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - curve_create->connect_compat("pressed", this, "_mode_changed", make_binds(0)); - curve_edit->connect_compat("pressed", this, "_mode_changed", make_binds(1)); - curve_del->connect_compat("pressed", this, "_mode_changed", make_binds(2)); - curve_close->connect_compat("pressed", this, "_close_curve"); + curve_create->connect("pressed", callable_mp(this, &PathEditorPlugin::_mode_changed), make_binds(0)); + curve_edit->connect("pressed", callable_mp(this, &PathEditorPlugin::_mode_changed), make_binds(1)); + curve_del->connect("pressed", callable_mp(this, &PathEditorPlugin::_mode_changed), make_binds(2)); + curve_close->connect("pressed", callable_mp(this, &PathEditorPlugin::_close_curve)); } } void PathEditorPlugin::_bind_methods() { - - ClassDB::bind_method(D_METHOD("_mode_changed"), &PathEditorPlugin::_mode_changed); - ClassDB::bind_method(D_METHOD("_close_curve"), &PathEditorPlugin::_close_curve); - ClassDB::bind_method(D_METHOD("_handle_option_pressed"), &PathEditorPlugin::_handle_option_pressed); } PathEditorPlugin *PathEditorPlugin::singleton = NULL; @@ -614,7 +610,7 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) { menu->set_item_checked(HANDLE_OPTION_ANGLE, mirror_handle_angle); menu->add_check_item(TTR("Mirror Handle Lengths")); menu->set_item_checked(HANDLE_OPTION_LENGTH, mirror_handle_length); - menu->connect_compat("id_pressed", this, "_handle_option_pressed"); + menu->connect("id_pressed", callable_mp(this, &PathEditorPlugin::_handle_option_pressed)); curve_edit->set_pressed(true); /* diff --git a/editor/plugins/physical_bone_plugin.cpp b/editor/plugins/physical_bone_plugin.cpp index 4b63d82961..e0d48afeef 100644 --- a/editor/plugins/physical_bone_plugin.cpp +++ b/editor/plugins/physical_bone_plugin.cpp @@ -33,7 +33,6 @@ #include "scene/3d/physics_body.h" void PhysicalBoneEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("_on_toggle_button_transform_joint", "is_pressed"), &PhysicalBoneEditor::_on_toggle_button_transform_joint); } void PhysicalBoneEditor::_on_toggle_button_transform_joint(bool p_is_pressed) { @@ -64,7 +63,7 @@ PhysicalBoneEditor::PhysicalBoneEditor(EditorNode *p_editor) : button_transform_joint->set_text(TTR("Move Joint")); button_transform_joint->set_icon(SpatialEditor::get_singleton()->get_icon("PhysicalBone", "EditorIcons")); button_transform_joint->set_toggle_mode(true); - button_transform_joint->connect_compat("toggled", this, "_on_toggle_button_transform_joint"); + button_transform_joint->connect("toggled", callable_mp(this, &PhysicalBoneEditor::_on_toggle_button_transform_joint)); hide(); } diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 91c0222f6d..f6a55ae545 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -192,7 +192,7 @@ void Polygon2DEditor::_update_bone_list() { if (np == selected || bone_scroll_vb->get_child_count() < 2) cb->set_pressed(true); - cb->connect_compat("pressed", this, "_bone_paint_selected", varray(i)); + cb->connect("pressed", callable_mp(this, &Polygon2DEditor::_bone_paint_selected), varray(i)); } uv_edit_draw->update(); @@ -1234,22 +1234,8 @@ void Polygon2DEditor::_uv_draw() { void Polygon2DEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("_uv_mode"), &Polygon2DEditor::_uv_mode); - ClassDB::bind_method(D_METHOD("_uv_draw"), &Polygon2DEditor::_uv_draw); - ClassDB::bind_method(D_METHOD("_uv_input"), &Polygon2DEditor::_uv_input); - ClassDB::bind_method(D_METHOD("_uv_scroll_changed"), &Polygon2DEditor::_uv_scroll_changed); - ClassDB::bind_method(D_METHOD("_set_use_snap"), &Polygon2DEditor::_set_use_snap); - ClassDB::bind_method(D_METHOD("_set_show_grid"), &Polygon2DEditor::_set_show_grid); - ClassDB::bind_method(D_METHOD("_set_snap_off_x"), &Polygon2DEditor::_set_snap_off_x); - ClassDB::bind_method(D_METHOD("_set_snap_off_y"), &Polygon2DEditor::_set_snap_off_y); - ClassDB::bind_method(D_METHOD("_set_snap_step_x"), &Polygon2DEditor::_set_snap_step_x); - ClassDB::bind_method(D_METHOD("_set_snap_step_y"), &Polygon2DEditor::_set_snap_step_y); - ClassDB::bind_method(D_METHOD("_uv_edit_mode_select"), &Polygon2DEditor::_uv_edit_mode_select); - ClassDB::bind_method(D_METHOD("_uv_edit_popup_hide"), &Polygon2DEditor::_uv_edit_popup_hide); - ClassDB::bind_method(D_METHOD("_sync_bones"), &Polygon2DEditor::_sync_bones); ClassDB::bind_method(D_METHOD("_update_bone_list"), &Polygon2DEditor::_update_bone_list); ClassDB::bind_method(D_METHOD("_update_polygon_editing_state"), &Polygon2DEditor::_update_polygon_editing_state); - ClassDB::bind_method(D_METHOD("_bone_paint_selected"), &Polygon2DEditor::_bone_paint_selected); } Vector2 Polygon2DEditor::snap_point(Vector2 p_target) const { @@ -1280,7 +1266,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : add_child(uv_edit); uv_edit->set_title(TTR("Polygon 2D UV Editor")); uv_edit->set_resizable(true); - uv_edit->connect_compat("popup_hide", this, "_uv_edit_popup_hide"); + uv_edit->connect("popup_hide", callable_mp(this, &Polygon2DEditor::_uv_edit_popup_hide)); VBoxContainer *uv_main_vb = memnew(VBoxContainer); uv_edit->add_child(uv_main_vb); @@ -1312,10 +1298,10 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : uv_edit_mode[2]->set_button_group(uv_edit_group); uv_edit_mode[3]->set_button_group(uv_edit_group); - uv_edit_mode[0]->connect_compat("pressed", this, "_uv_edit_mode_select", varray(0)); - uv_edit_mode[1]->connect_compat("pressed", this, "_uv_edit_mode_select", varray(1)); - uv_edit_mode[2]->connect_compat("pressed", this, "_uv_edit_mode_select", varray(2)); - uv_edit_mode[3]->connect_compat("pressed", this, "_uv_edit_mode_select", varray(3)); + uv_edit_mode[0]->connect("pressed", callable_mp(this, &Polygon2DEditor::_uv_edit_mode_select), varray(0)); + uv_edit_mode[1]->connect("pressed", callable_mp(this, &Polygon2DEditor::_uv_edit_mode_select), varray(1)); + uv_edit_mode[2]->connect("pressed", callable_mp(this, &Polygon2DEditor::_uv_edit_mode_select), varray(2)); + uv_edit_mode[3]->connect("pressed", callable_mp(this, &Polygon2DEditor::_uv_edit_mode_select), varray(3)); uv_mode_hb->add_child(memnew(VSeparator)); @@ -1325,7 +1311,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : uv_button[i] = memnew(ToolButton); uv_button[i]->set_toggle_mode(true); uv_mode_hb->add_child(uv_button[i]); - uv_button[i]->connect_compat("pressed", this, "_uv_mode", varray(i)); + uv_button[i]->connect("pressed", callable_mp(this, &Polygon2DEditor::_uv_mode), varray(i)); uv_button[i]->set_focus_mode(FOCUS_NONE); } @@ -1399,7 +1385,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : b_snap_enable->set_toggle_mode(true); b_snap_enable->set_pressed(use_snap); b_snap_enable->set_tooltip(TTR("Enable Snap")); - b_snap_enable->connect_compat("toggled", this, "_set_use_snap"); + b_snap_enable->connect("toggled", callable_mp(this, &Polygon2DEditor::_set_use_snap)); b_snap_grid = memnew(ToolButton); uv_mode_hb->add_child(b_snap_grid); @@ -1408,7 +1394,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : b_snap_grid->set_toggle_mode(true); b_snap_grid->set_pressed(snap_show_grid); b_snap_grid->set_tooltip(TTR("Show Grid")); - b_snap_grid->connect_compat("toggled", this, "_set_show_grid"); + b_snap_grid->connect("toggled", callable_mp(this, &Polygon2DEditor::_set_show_grid)); grid_settings = memnew(AcceptDialog); grid_settings->set_title(TTR("Configure Grid:")); @@ -1422,7 +1408,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : sb_off_x->set_step(1); sb_off_x->set_value(snap_offset.x); sb_off_x->set_suffix("px"); - sb_off_x->connect_compat("value_changed", this, "_set_snap_off_x"); + sb_off_x->connect("value_changed", callable_mp(this, &Polygon2DEditor::_set_snap_off_x)); grid_settings_vb->add_margin_child(TTR("Grid Offset X:"), sb_off_x); SpinBox *sb_off_y = memnew(SpinBox); @@ -1431,7 +1417,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : sb_off_y->set_step(1); sb_off_y->set_value(snap_offset.y); sb_off_y->set_suffix("px"); - sb_off_y->connect_compat("value_changed", this, "_set_snap_off_y"); + sb_off_y->connect("value_changed", callable_mp(this, &Polygon2DEditor::_set_snap_off_y)); grid_settings_vb->add_margin_child(TTR("Grid Offset Y:"), sb_off_y); SpinBox *sb_step_x = memnew(SpinBox); @@ -1440,7 +1426,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : sb_step_x->set_step(1); sb_step_x->set_value(snap_step.x); sb_step_x->set_suffix("px"); - sb_step_x->connect_compat("value_changed", this, "_set_snap_step_x"); + sb_step_x->connect("value_changed", callable_mp(this, &Polygon2DEditor::_set_snap_step_x)); grid_settings_vb->add_margin_child(TTR("Grid Step X:"), sb_step_x); SpinBox *sb_step_y = memnew(SpinBox); @@ -1449,7 +1435,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : sb_step_y->set_step(1); sb_step_y->set_value(snap_step.y); sb_step_y->set_suffix("px"); - sb_step_y->connect_compat("value_changed", this, "_set_snap_step_y"); + sb_step_y->connect("value_changed", callable_mp(this, &Polygon2DEditor::_set_snap_step_y)); grid_settings_vb->add_margin_child(TTR("Grid Step Y:"), sb_step_y); uv_mode_hb->add_child(memnew(VSeparator)); @@ -1469,16 +1455,16 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : uv_zoom->share(uv_zoom_value); uv_zoom_value->set_custom_minimum_size(Size2(50, 0)); uv_mode_hb->add_child(uv_zoom_value); - uv_zoom->connect_compat("value_changed", this, "_uv_scroll_changed"); + uv_zoom->connect("value_changed", callable_mp(this, &Polygon2DEditor::_uv_scroll_changed)); uv_vscroll = memnew(VScrollBar); uv_vscroll->set_step(0.001); uv_edit_draw->add_child(uv_vscroll); - uv_vscroll->connect_compat("value_changed", this, "_uv_scroll_changed"); + uv_vscroll->connect("value_changed", callable_mp(this, &Polygon2DEditor::_uv_scroll_changed)); uv_hscroll = memnew(HScrollBar); uv_hscroll->set_step(0.001); uv_edit_draw->add_child(uv_hscroll); - uv_hscroll->connect_compat("value_changed", this, "_uv_scroll_changed"); + uv_hscroll->connect("value_changed", callable_mp(this, &Polygon2DEditor::_uv_scroll_changed)); bone_scroll_main_vb = memnew(VBoxContainer); bone_scroll_main_vb->hide(); @@ -1486,7 +1472,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : sync_bones = memnew(Button(TTR("Sync Bones to Polygon"))); bone_scroll_main_vb->add_child(sync_bones); sync_bones->set_h_size_flags(0); - sync_bones->connect_compat("pressed", this, "_sync_bones"); + sync_bones->connect("pressed", callable_mp(this, &Polygon2DEditor::_sync_bones)); uv_main_hsc->add_child(bone_scroll_main_vb); bone_scroll = memnew(ScrollContainer); bone_scroll->set_v_scroll(true); @@ -1496,8 +1482,8 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : bone_scroll_vb = memnew(VBoxContainer); bone_scroll->add_child(bone_scroll_vb); - uv_edit_draw->connect_compat("draw", this, "_uv_draw"); - uv_edit_draw->connect_compat("gui_input", this, "_uv_input"); + uv_edit_draw->connect("draw", callable_mp(this, &Polygon2DEditor::_uv_draw)); + uv_edit_draw->connect("gui_input", callable_mp(this, &Polygon2DEditor::_uv_input)); uv_draw_zoom = 1.0; point_drag_index = -1; uv_drag = false; diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index 12b8ac9008..feef505acc 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -347,12 +347,7 @@ void ResourcePreloaderEditor::drop_data_fw(const Point2 &p_point, const Variant void ResourcePreloaderEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &ResourcePreloaderEditor::_gui_input); - ClassDB::bind_method(D_METHOD("_load_pressed"), &ResourcePreloaderEditor::_load_pressed); - ClassDB::bind_method(D_METHOD("_item_edited"), &ResourcePreloaderEditor::_item_edited); - ClassDB::bind_method(D_METHOD("_paste_pressed"), &ResourcePreloaderEditor::_paste_pressed); - ClassDB::bind_method(D_METHOD("_files_load_request"), &ResourcePreloaderEditor::_files_load_request); ClassDB::bind_method(D_METHOD("_update_library"), &ResourcePreloaderEditor::_update_library); - ClassDB::bind_method(D_METHOD("_cell_button_pressed"), &ResourcePreloaderEditor::_cell_button_pressed); ClassDB::bind_method(D_METHOD("_remove_resource", "to_remove"), &ResourcePreloaderEditor::_remove_resource); ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &ResourcePreloaderEditor::get_drag_data_fw); @@ -382,7 +377,7 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() { add_child(file); tree = memnew(Tree); - tree->connect_compat("button_pressed", this, "_cell_button_pressed"); + tree->connect("button_pressed", callable_mp(this, &ResourcePreloaderEditor::_cell_button_pressed)); tree->set_columns(2); tree->set_column_min_width(0, 2); tree->set_column_min_width(1, 3); @@ -396,10 +391,10 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() { dialog = memnew(AcceptDialog); add_child(dialog); - load->connect_compat("pressed", this, "_load_pressed"); - paste->connect_compat("pressed", this, "_paste_pressed"); - file->connect_compat("files_selected", this, "_files_load_request"); - tree->connect_compat("item_edited", this, "_item_edited"); + load->connect("pressed", callable_mp(this, &ResourcePreloaderEditor::_load_pressed)); + paste->connect("pressed", callable_mp(this, &ResourcePreloaderEditor::_paste_pressed)); + file->connect("files_selected", callable_mp(this, &ResourcePreloaderEditor::_files_load_request)); + tree->connect("item_edited", callable_mp(this, &ResourcePreloaderEditor::_item_edited)); loading_scene = false; } diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp index 132ec40dd2..d932305c63 100644 --- a/editor/plugins/root_motion_editor_plugin.cpp +++ b/editor/plugins/root_motion_editor_plugin.cpp @@ -248,10 +248,6 @@ void EditorPropertyRootMotion::_notification(int p_what) { } void EditorPropertyRootMotion::_bind_methods() { - - ClassDB::bind_method(D_METHOD("_confirmed"), &EditorPropertyRootMotion::_confirmed); - ClassDB::bind_method(D_METHOD("_node_assign"), &EditorPropertyRootMotion::_node_assign); - ClassDB::bind_method(D_METHOD("_node_clear"), &EditorPropertyRootMotion::_node_clear); } EditorPropertyRootMotion::EditorPropertyRootMotion() { @@ -262,24 +258,24 @@ EditorPropertyRootMotion::EditorPropertyRootMotion() { assign->set_flat(true); assign->set_h_size_flags(SIZE_EXPAND_FILL); assign->set_clip_text(true); - assign->connect_compat("pressed", this, "_node_assign"); + assign->connect("pressed", callable_mp(this, &EditorPropertyRootMotion::_node_assign)); hbc->add_child(assign); clear = memnew(Button); clear->set_flat(true); - clear->connect_compat("pressed", this, "_node_clear"); + clear->connect("pressed", callable_mp(this, &EditorPropertyRootMotion::_node_clear)); hbc->add_child(clear); filter_dialog = memnew(ConfirmationDialog); add_child(filter_dialog); filter_dialog->set_title(TTR("Edit Filtered Tracks:")); - filter_dialog->connect_compat("confirmed", this, "_confirmed"); + filter_dialog->connect("confirmed", callable_mp(this, &EditorPropertyRootMotion::_confirmed)); filters = memnew(Tree); filter_dialog->add_child(filters); filters->set_v_size_flags(SIZE_EXPAND_FILL); filters->set_hide_root(true); - filters->connect_compat("item_activated", this, "_confirmed"); + filters->connect("item_activated", callable_mp(this, &EditorPropertyRootMotion::_confirmed)); //filters->connect("item_edited", this, "_filter_edited"); } ////////////////////////// diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 127b98c15b..2b513feedc 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -211,7 +211,7 @@ void ScriptEditorQuickOpen::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - connect_compat("confirmed", this, "_confirmed"); + connect("confirmed", callable_mp(this, &ScriptEditorQuickOpen::_confirmed)); search_box->set_clear_button_enabled(true); [[fallthrough]]; @@ -220,17 +220,13 @@ void ScriptEditorQuickOpen::_notification(int p_what) { search_box->set_right_icon(get_icon("Search", "EditorIcons")); } break; case NOTIFICATION_EXIT_TREE: { - disconnect_compat("confirmed", this, "_confirmed"); + disconnect("confirmed", callable_mp(this, &ScriptEditorQuickOpen::_confirmed)); } break; } } void ScriptEditorQuickOpen::_bind_methods() { - ClassDB::bind_method(D_METHOD("_text_changed"), &ScriptEditorQuickOpen::_text_changed); - ClassDB::bind_method(D_METHOD("_confirmed"), &ScriptEditorQuickOpen::_confirmed); - ClassDB::bind_method(D_METHOD("_sbox_input"), &ScriptEditorQuickOpen::_sbox_input); - ADD_SIGNAL(MethodInfo("goto_line", PropertyInfo(Variant::INT, "line"))); } @@ -240,15 +236,15 @@ ScriptEditorQuickOpen::ScriptEditorQuickOpen() { add_child(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, &ScriptEditorQuickOpen::_text_changed)); + search_box->connect("gui_input", callable_mp(this, &ScriptEditorQuickOpen::_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("item_activated", callable_mp(this, &ScriptEditorQuickOpen::_confirmed)); search_options->set_hide_root(true); search_options->set_hide_folding(true); search_options->add_constant_override("draw_guides", 1); @@ -1386,16 +1382,16 @@ void ScriptEditor::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { - editor->connect_compat("stop_pressed", this, "_editor_stop"); - editor->connect_compat("script_add_function_request", this, "_add_callback"); - editor->connect_compat("resource_saved", this, "_res_saved_callback"); - script_list->connect_compat("item_selected", this, "_script_selected"); + editor->connect("stop_pressed", callable_mp(this, &ScriptEditor::_editor_stop)); + editor->connect("script_add_function_request", callable_mp(this, &ScriptEditor::_add_callback)); + editor->connect("resource_saved", callable_mp(this, &ScriptEditor::_res_saved_callback)); + script_list->connect("item_selected", callable_mp(this, &ScriptEditor::_script_selected)); - members_overview->connect_compat("item_selected", this, "_members_overview_selected"); - help_overview->connect_compat("item_selected", this, "_help_overview_selected"); - script_split->connect_compat("dragged", this, "_script_split_dragged"); + members_overview->connect("item_selected", callable_mp(this, &ScriptEditor::_members_overview_selected)); + help_overview->connect("item_selected", callable_mp(this, &ScriptEditor::_help_overview_selected)); + script_split->connect("dragged", callable_mp(this, &ScriptEditor::_script_split_dragged)); - EditorSettings::get_singleton()->connect_compat("settings_changed", this, "_editor_settings_changed"); + EditorSettings::get_singleton()->connect("settings_changed", callable_mp(this, &ScriptEditor::_editor_settings_changed)); [[fallthrough]]; } case NOTIFICATION_THEME_CHANGED: { @@ -1419,14 +1415,14 @@ void ScriptEditor::_notification(int p_what) { case NOTIFICATION_READY: { - get_tree()->connect_compat("tree_changed", this, "_tree_changed"); - editor->get_inspector_dock()->connect_compat("request_help", this, "_request_help"); - editor->connect_compat("request_help_search", this, "_help_search"); + get_tree()->connect("tree_changed", callable_mp(this, &ScriptEditor::_tree_changed)); + editor->get_inspector_dock()->connect("request_help", callable_mp(this, &ScriptEditor::_help_class_open)); + editor->connect("request_help_search", callable_mp(this, &ScriptEditor::_help_search)); } break; case NOTIFICATION_EXIT_TREE: { - editor->disconnect_compat("stop_pressed", this, "_editor_stop"); + editor->disconnect("stop_pressed", callable_mp(this, &ScriptEditor::_editor_stop)); } break; case MainLoop::NOTIFICATION_WM_FOCUS_IN: { @@ -2137,14 +2133,14 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra _sort_list_on_update = true; _update_script_names(); _save_layout(); - se->connect_compat("name_changed", this, "_update_script_names"); - se->connect_compat("edited_script_changed", this, "_script_changed"); - se->connect_compat("request_help", this, "_help_search"); - se->connect_compat("request_open_script_at_line", this, "_goto_script_line"); - se->connect_compat("go_to_help", this, "_help_class_goto"); - se->connect_compat("request_save_history", this, "_save_history"); - se->connect_compat("search_in_files_requested", this, "_on_find_in_files_requested"); - se->connect_compat("replace_in_files_requested", this, "_on_replace_in_files_requested"); + se->connect("name_changed", callable_mp(this, &ScriptEditor::_update_script_names)); + se->connect("edited_script_changed", callable_mp(this, &ScriptEditor::_script_changed)); + se->connect("request_help", callable_mp(this, &ScriptEditor::_help_search)); + se->connect("request_open_script_at_line", callable_mp(this, &ScriptEditor::_goto_script_line)); + se->connect("go_to_help", callable_mp(this, &ScriptEditor::_help_class_goto)); + se->connect("request_save_history", callable_mp(this, &ScriptEditor::_save_history)); + se->connect("search_in_files_requested", callable_mp(this, &ScriptEditor::_on_find_in_files_requested)); + se->connect("replace_in_files_requested", callable_mp(this, &ScriptEditor::_on_replace_in_files_requested)); //test for modification, maybe the script was not edited but was loaded @@ -2737,7 +2733,7 @@ void ScriptEditor::_help_class_open(const String &p_class) { tab_container->add_child(eh); _go_to_tab(tab_container->get_tab_count() - 1); eh->go_to_class(p_class, 0); - eh->connect_compat("go_to_help", this, "_help_class_goto"); + eh->connect("go_to_help", callable_mp(this, &ScriptEditor::_help_class_goto)); _add_recent_script(p_class); _sort_list_on_update = true; _update_script_names(); @@ -2767,7 +2763,7 @@ void ScriptEditor::_help_class_goto(const String &p_desc) { tab_container->add_child(eh); _go_to_tab(tab_container->get_tab_count() - 1); eh->go_to_help(p_desc); - eh->connect_compat("go_to_help", this, "_help_class_goto"); + eh->connect("go_to_help", callable_mp(this, &ScriptEditor::_help_class_goto)); _add_recent_script(eh->get_class()); _sort_list_on_update = true; _update_script_names(); @@ -3039,58 +3035,20 @@ void ScriptEditor::_filter_methods_text_changed(const String &p_newtext) { void ScriptEditor::_bind_methods() { - ClassDB::bind_method("_file_dialog_action", &ScriptEditor::_file_dialog_action); - ClassDB::bind_method("_tab_changed", &ScriptEditor::_tab_changed); - ClassDB::bind_method("_menu_option", &ScriptEditor::_menu_option); - ClassDB::bind_method("_close_current_tab", &ScriptEditor::_close_current_tab); - ClassDB::bind_method("_close_discard_current_tab", &ScriptEditor::_close_discard_current_tab); ClassDB::bind_method("_close_docs_tab", &ScriptEditor::_close_docs_tab); ClassDB::bind_method("_close_all_tabs", &ScriptEditor::_close_all_tabs); ClassDB::bind_method("_close_other_tabs", &ScriptEditor::_close_other_tabs); - ClassDB::bind_method("_open_recent_script", &ScriptEditor::_open_recent_script); - ClassDB::bind_method("_theme_option", &ScriptEditor::_theme_option); - ClassDB::bind_method("_editor_stop", &ScriptEditor::_editor_stop); - ClassDB::bind_method("_add_callback", &ScriptEditor::_add_callback); - ClassDB::bind_method("_reload_scripts", &ScriptEditor::_reload_scripts); - ClassDB::bind_method("_resave_scripts", &ScriptEditor::_resave_scripts); - ClassDB::bind_method("_res_saved_callback", &ScriptEditor::_res_saved_callback); - ClassDB::bind_method("_goto_script_line", &ScriptEditor::_goto_script_line); ClassDB::bind_method("_goto_script_line2", &ScriptEditor::_goto_script_line2); - ClassDB::bind_method("_set_execution", &ScriptEditor::_set_execution); - ClassDB::bind_method("_clear_execution", &ScriptEditor::_clear_execution); - ClassDB::bind_method("_help_search", &ScriptEditor::_help_search); - ClassDB::bind_method("_save_history", &ScriptEditor::_save_history); ClassDB::bind_method("_copy_script_path", &ScriptEditor::_copy_script_path); - ClassDB::bind_method("_breaked", &ScriptEditor::_breaked); ClassDB::bind_method("_get_debug_tooltip", &ScriptEditor::_get_debug_tooltip); - ClassDB::bind_method("_autosave_scripts", &ScriptEditor::_autosave_scripts); ClassDB::bind_method("_update_autosave_timer", &ScriptEditor::_update_autosave_timer); - ClassDB::bind_method("_editor_settings_changed", &ScriptEditor::_editor_settings_changed); - ClassDB::bind_method("_update_script_names", &ScriptEditor::_update_script_names); ClassDB::bind_method("_update_script_connections", &ScriptEditor::_update_script_connections); - ClassDB::bind_method("_tree_changed", &ScriptEditor::_tree_changed); - ClassDB::bind_method("_members_overview_selected", &ScriptEditor::_members_overview_selected); - ClassDB::bind_method("_help_overview_selected", &ScriptEditor::_help_overview_selected); - ClassDB::bind_method("_script_selected", &ScriptEditor::_script_selected); - ClassDB::bind_method("_script_created", &ScriptEditor::_script_created); - ClassDB::bind_method("_script_split_dragged", &ScriptEditor::_script_split_dragged); ClassDB::bind_method("_help_class_open", &ScriptEditor::_help_class_open); - ClassDB::bind_method("_help_class_goto", &ScriptEditor::_help_class_goto); - ClassDB::bind_method("_request_help", &ScriptEditor::_help_class_open); - ClassDB::bind_method("_history_forward", &ScriptEditor::_history_forward); - ClassDB::bind_method("_history_back", &ScriptEditor::_history_back); ClassDB::bind_method("_live_auto_reload_running_scripts", &ScriptEditor::_live_auto_reload_running_scripts); ClassDB::bind_method("_unhandled_input", &ScriptEditor::_unhandled_input); - ClassDB::bind_method("_script_list_gui_input", &ScriptEditor::_script_list_gui_input); - ClassDB::bind_method("_toggle_members_overview_alpha_sort", &ScriptEditor::_toggle_members_overview_alpha_sort); ClassDB::bind_method("_update_members_overview", &ScriptEditor::_update_members_overview); - ClassDB::bind_method("_script_changed", &ScriptEditor::_script_changed); - ClassDB::bind_method("_filter_scripts_text_changed", &ScriptEditor::_filter_scripts_text_changed); - ClassDB::bind_method("_filter_methods_text_changed", &ScriptEditor::_filter_methods_text_changed); ClassDB::bind_method("_update_recent_scripts", &ScriptEditor::_update_recent_scripts); - ClassDB::bind_method("_on_find_in_files_requested", &ScriptEditor::_on_find_in_files_requested); - ClassDB::bind_method("_on_replace_in_files_requested", &ScriptEditor::_on_replace_in_files_requested); ClassDB::bind_method("_start_find_in_files", &ScriptEditor::_start_find_in_files); ClassDB::bind_method("_on_find_in_files_result_selected", &ScriptEditor::_on_find_in_files_result_selected); ClassDB::bind_method("_on_find_in_files_modified_files", &ScriptEditor::_on_find_in_files_modified_files); @@ -3142,7 +3100,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { filter_scripts = memnew(LineEdit); filter_scripts->set_placeholder(TTR("Filter scripts")); filter_scripts->set_clear_button_enabled(true); - filter_scripts->connect_compat("text_changed", this, "_filter_scripts_text_changed"); + filter_scripts->connect("text_changed", callable_mp(this, &ScriptEditor::_filter_scripts_text_changed)); scripts_vbox->add_child(filter_scripts); script_list = memnew(ItemList); @@ -3151,13 +3109,13 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { script_list->set_v_size_flags(SIZE_EXPAND_FILL); script_split->set_split_offset(70 * EDSCALE); _sort_list_on_update = true; - script_list->connect_compat("gui_input", this, "_script_list_gui_input", varray(), CONNECT_DEFERRED); + script_list->connect("gui_input", callable_mp(this, &ScriptEditor::_script_list_gui_input), varray(), CONNECT_DEFERRED); script_list->set_allow_rmb_select(true); script_list->set_drag_forwarding(this); context_menu = memnew(PopupMenu); add_child(context_menu); - context_menu->connect_compat("id_pressed", this, "_menu_option"); + context_menu->connect("id_pressed", callable_mp(this, &ScriptEditor::_menu_option)); context_menu->set_hide_on_window_lose_focus(true); overview_vbox = memnew(VBoxContainer); @@ -3178,14 +3136,14 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { members_overview_alphabeta_sort_button->set_tooltip(TTR("Toggle alphabetical sorting of the method list.")); members_overview_alphabeta_sort_button->set_toggle_mode(true); members_overview_alphabeta_sort_button->set_pressed(EditorSettings::get_singleton()->get("text_editor/tools/sort_members_outline_alphabetically")); - members_overview_alphabeta_sort_button->connect_compat("toggled", this, "_toggle_members_overview_alpha_sort"); + members_overview_alphabeta_sort_button->connect("toggled", callable_mp(this, &ScriptEditor::_toggle_members_overview_alpha_sort)); buttons_hbox->add_child(members_overview_alphabeta_sort_button); filter_methods = memnew(LineEdit); filter_methods->set_placeholder(TTR("Filter methods")); filter_methods->set_clear_button_enabled(true); - filter_methods->connect_compat("text_changed", this, "_filter_methods_text_changed"); + filter_methods->connect("text_changed", callable_mp(this, &ScriptEditor::_filter_methods_text_changed)); overview_vbox->add_child(filter_methods); members_overview = memnew(ItemList); @@ -3229,7 +3187,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { recent_scripts = memnew(PopupMenu); recent_scripts->set_name("RecentScripts"); file_menu->get_popup()->add_child(recent_scripts); - recent_scripts->connect_compat("id_pressed", this, "_open_recent_script"); + recent_scripts->connect("id_pressed", callable_mp(this, &ScriptEditor::_open_recent_script)); _update_recent_scripts(); file_menu->get_popup()->add_separator(); @@ -3251,7 +3209,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { theme_submenu = memnew(PopupMenu); theme_submenu->set_name("Theme"); file_menu->get_popup()->add_child(theme_submenu); - theme_submenu->connect_compat("id_pressed", this, "_theme_option"); + theme_submenu->connect("id_pressed", callable_mp(this, &ScriptEditor::_theme_option)); theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/import_theme", TTR("Import Theme...")), THEME_IMPORT); theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/reload_theme", TTR("Reload Theme")), THEME_RELOAD); @@ -3270,14 +3228,14 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { file_menu->get_popup()->add_separator(); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/toggle_scripts_panel", TTR("Toggle Scripts Panel"), KEY_MASK_CMD | KEY_BACKSLASH), TOGGLE_SCRIPTS_PANEL); - file_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + file_menu->get_popup()->connect("id_pressed", callable_mp(this, &ScriptEditor::_menu_option)); script_search_menu = memnew(MenuButton); menu_hb->add_child(script_search_menu); script_search_menu->set_text(TTR("Search")); script_search_menu->set_switch_on_hover(true); script_search_menu->get_popup()->set_hide_on_window_lose_focus(true); - script_search_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + script_search_menu->get_popup()->connect("id_pressed", callable_mp(this, &ScriptEditor::_menu_option)); MenuButton *debug_menu = memnew(MenuButton); menu_hb->add_child(debug_menu); @@ -3285,10 +3243,10 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { EditorDebuggerNode *debugger = EditorDebuggerNode::get_singleton(); debugger->set_script_debug_button(debug_menu); - debugger->connect_compat("goto_script_line", this, "_goto_script_line"); - debugger->connect_compat("set_execution", this, "_set_execution"); - debugger->connect_compat("clear_execution", this, "_clear_execution"); - debugger->connect_compat("breaked", this, "_breaked"); + debugger->connect("goto_script_line", callable_mp(this, &ScriptEditor::_goto_script_line)); + debugger->connect("set_execution", callable_mp(this, &ScriptEditor::_set_execution)); + debugger->connect("clear_execution", callable_mp(this, &ScriptEditor::_clear_execution)); + debugger->connect("breaked", callable_mp(this, &ScriptEditor::_breaked)); menu_hb->add_spacer(); @@ -3304,54 +3262,54 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { site_search = memnew(ToolButton); site_search->set_text(TTR("Online Docs")); - site_search->connect_compat("pressed", this, "_menu_option", varray(SEARCH_WEBSITE)); + site_search->connect("pressed", callable_mp(this, &ScriptEditor::_menu_option), varray(SEARCH_WEBSITE)); menu_hb->add_child(site_search); site_search->set_tooltip(TTR("Open Godot online documentation.")); request_docs = memnew(ToolButton); request_docs->set_text(TTR("Request Docs")); - request_docs->connect_compat("pressed", this, "_menu_option", varray(REQUEST_DOCS)); + request_docs->connect("pressed", callable_mp(this, &ScriptEditor::_menu_option), varray(REQUEST_DOCS)); menu_hb->add_child(request_docs); request_docs->set_tooltip(TTR("Help improve the Godot documentation by giving feedback.")); help_search = memnew(ToolButton); help_search->set_text(TTR("Search Help")); - help_search->connect_compat("pressed", this, "_menu_option", varray(SEARCH_HELP)); + help_search->connect("pressed", callable_mp(this, &ScriptEditor::_menu_option), varray(SEARCH_HELP)); menu_hb->add_child(help_search); help_search->set_tooltip(TTR("Search the reference documentation.")); menu_hb->add_child(memnew(VSeparator)); script_back = memnew(ToolButton); - script_back->connect_compat("pressed", this, "_history_back"); + script_back->connect("pressed", callable_mp(this, &ScriptEditor::_history_back)); menu_hb->add_child(script_back); script_back->set_disabled(true); script_back->set_tooltip(TTR("Go to previous edited document.")); script_forward = memnew(ToolButton); - script_forward->connect_compat("pressed", this, "_history_forward"); + script_forward->connect("pressed", callable_mp(this, &ScriptEditor::_history_forward)); menu_hb->add_child(script_forward); script_forward->set_disabled(true); script_forward->set_tooltip(TTR("Go to next edited document.")); - tab_container->connect_compat("tab_changed", this, "_tab_changed"); + tab_container->connect("tab_changed", callable_mp(this, &ScriptEditor::_tab_changed)); erase_tab_confirm = memnew(ConfirmationDialog); erase_tab_confirm->get_ok()->set_text(TTR("Save")); erase_tab_confirm->add_button(TTR("Discard"), OS::get_singleton()->get_swap_ok_cancel(), "discard"); - erase_tab_confirm->connect_compat("confirmed", this, "_close_current_tab"); - erase_tab_confirm->connect_compat("custom_action", this, "_close_discard_current_tab"); + erase_tab_confirm->connect("confirmed", callable_mp(this, &ScriptEditor::_close_current_tab)); + erase_tab_confirm->connect("custom_action", callable_mp(this, &ScriptEditor::_close_discard_current_tab)); add_child(erase_tab_confirm); script_create_dialog = memnew(ScriptCreateDialog); script_create_dialog->set_title(TTR("Create Script")); add_child(script_create_dialog); - script_create_dialog->connect_compat("script_created", this, "_script_created"); + script_create_dialog->connect("script_created", callable_mp(this, &ScriptEditor::_script_created)); file_dialog_option = -1; file_dialog = memnew(EditorFileDialog); add_child(file_dialog); - file_dialog->connect_compat("file_selected", this, "_file_dialog_action"); + file_dialog->connect("file_selected", callable_mp(this, &ScriptEditor::_file_dialog_action)); error_dialog = memnew(AcceptDialog); add_child(error_dialog); @@ -3369,11 +3327,11 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { vbc->add_child(disk_changed_list); disk_changed_list->set_v_size_flags(SIZE_EXPAND_FILL); - disk_changed->connect_compat("confirmed", this, "_reload_scripts"); + disk_changed->connect("confirmed", callable_mp(this, &ScriptEditor::_reload_scripts)); disk_changed->get_ok()->set_text(TTR("Reload")); disk_changed->add_button(TTR("Resave"), !OS::get_singleton()->get_swap_ok_cancel(), "resave"); - disk_changed->connect_compat("custom_action", this, "_resave_scripts"); + disk_changed->connect("custom_action", callable_mp(this, &ScriptEditor::_resave_scripts)); } add_child(disk_changed); @@ -3383,14 +3341,14 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { autosave_timer = memnew(Timer); autosave_timer->set_one_shot(false); autosave_timer->connect_compat(SceneStringNames::get_singleton()->tree_entered, this, "_update_autosave_timer"); - autosave_timer->connect_compat("timeout", this, "_autosave_scripts"); + autosave_timer->connect("timeout", callable_mp(this, &ScriptEditor::_autosave_scripts)); add_child(autosave_timer); grab_focus_block = false; help_search_dialog = memnew(EditorHelpSearch); add_child(help_search_dialog); - help_search_dialog->connect_compat("go_to_help", this, "_help_class_goto"); + help_search_dialog->connect("go_to_help", callable_mp(this, &ScriptEditor::_help_class_goto)); find_in_files_dialog = memnew(FindInFilesDialog); find_in_files_dialog->connect_compat(FindInFilesDialog::SIGNAL_FIND_REQUESTED, this, "_start_find_in_files", varray(false)); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index f4ebd7c3cc..d3d64f0dc5 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1436,24 +1436,7 @@ void ScriptTextEditor::_change_syntax_highlighter(int p_idx) { void ScriptTextEditor::_bind_methods() { - ClassDB::bind_method("_validate_script", &ScriptTextEditor::_validate_script); - ClassDB::bind_method("_update_bookmark_list", &ScriptTextEditor::_update_bookmark_list); - ClassDB::bind_method("_bookmark_item_pressed", &ScriptTextEditor::_bookmark_item_pressed); - ClassDB::bind_method("_load_theme_settings", &ScriptTextEditor::_load_theme_settings); - ClassDB::bind_method("_update_breakpoint_list", &ScriptTextEditor::_update_breakpoint_list); - ClassDB::bind_method("_breakpoint_item_pressed", &ScriptTextEditor::_breakpoint_item_pressed); - ClassDB::bind_method("_breakpoint_toggled", &ScriptTextEditor::_breakpoint_toggled); - ClassDB::bind_method("_lookup_connections", &ScriptTextEditor::_lookup_connections); ClassDB::bind_method("_update_connected_methods", &ScriptTextEditor::_update_connected_methods); - ClassDB::bind_method("_change_syntax_highlighter", &ScriptTextEditor::_change_syntax_highlighter); - ClassDB::bind_method("_edit_option", &ScriptTextEditor::_edit_option); - ClassDB::bind_method("_goto_line", &ScriptTextEditor::_goto_line); - ClassDB::bind_method("_lookup_symbol", &ScriptTextEditor::_lookup_symbol); - ClassDB::bind_method("_text_edit_gui_input", &ScriptTextEditor::_text_edit_gui_input); - ClassDB::bind_method("_show_warnings_panel", &ScriptTextEditor::_show_warnings_panel); - ClassDB::bind_method("_error_pressed", &ScriptTextEditor::_error_pressed); - ClassDB::bind_method("_warning_clicked", &ScriptTextEditor::_warning_clicked); - ClassDB::bind_method("_color_changed", &ScriptTextEditor::_color_changed); ClassDB::bind_method("get_drag_data_fw", &ScriptTextEditor::get_drag_data_fw); ClassDB::bind_method("can_drop_data_fw", &ScriptTextEditor::can_drop_data_fw); @@ -1781,12 +1764,12 @@ ScriptTextEditor::ScriptTextEditor() { editor_box->add_child(code_editor); code_editor->add_constant_override("separation", 2); code_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE); - code_editor->connect_compat("validate_script", this, "_validate_script"); - code_editor->connect_compat("load_theme_settings", this, "_load_theme_settings"); + code_editor->connect("validate_script", callable_mp(this, &ScriptTextEditor::_validate_script)); + code_editor->connect("load_theme_settings", callable_mp(this, &ScriptTextEditor::_load_theme_settings)); code_editor->set_code_complete_func(_code_complete_scripts, this); - code_editor->get_text_edit()->connect_compat("breakpoint_toggled", this, "_breakpoint_toggled"); - code_editor->get_text_edit()->connect_compat("symbol_lookup", this, "_lookup_symbol"); - code_editor->get_text_edit()->connect_compat("info_clicked", this, "_lookup_connections"); + code_editor->get_text_edit()->connect("breakpoint_toggled", callable_mp(this, &ScriptTextEditor::_breakpoint_toggled)); + code_editor->get_text_edit()->connect("symbol_lookup", callable_mp(this, &ScriptTextEditor::_lookup_symbol)); + code_editor->get_text_edit()->connect("info_clicked", callable_mp(this, &ScriptTextEditor::_lookup_connections)); code_editor->set_v_size_flags(SIZE_EXPAND_FILL); code_editor->show_toggle_scripts_button(); @@ -1799,9 +1782,9 @@ ScriptTextEditor::ScriptTextEditor() { warnings_panel->set_focus_mode(FOCUS_CLICK); warnings_panel->hide(); - code_editor->connect_compat("error_pressed", this, "_error_pressed"); - code_editor->connect_compat("show_warnings_panel", this, "_show_warnings_panel"); - warnings_panel->connect_compat("meta_clicked", this, "_warning_clicked"); + code_editor->connect("error_pressed", callable_mp(this, &ScriptTextEditor::_error_pressed)); + code_editor->connect("show_warnings_panel", callable_mp(this, &ScriptTextEditor::_show_warnings_panel)); + warnings_panel->connect("meta_clicked", callable_mp(this, &ScriptTextEditor::_warning_clicked)); update_settings(); @@ -1811,11 +1794,11 @@ ScriptTextEditor::ScriptTextEditor() { code_editor->get_text_edit()->set_select_identifiers_on_hover(true); code_editor->get_text_edit()->set_context_menu_enabled(false); - code_editor->get_text_edit()->connect_compat("gui_input", this, "_text_edit_gui_input"); + code_editor->get_text_edit()->connect("gui_input", callable_mp(this, &ScriptTextEditor::_text_edit_gui_input)); context_menu = memnew(PopupMenu); add_child(context_menu); - context_menu->connect_compat("id_pressed", this, "_edit_option"); + context_menu->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option)); context_menu->set_hide_on_window_lose_focus(true); color_panel = memnew(PopupPanel); @@ -1823,7 +1806,7 @@ ScriptTextEditor::ScriptTextEditor() { color_picker = memnew(ColorPicker); color_picker->set_deferred_mode(true); color_panel->add_child(color_picker); - color_picker->connect_compat("color_changed", this, "_color_changed"); + color_picker->connect("color_changed", callable_mp(this, &ScriptTextEditor::_color_changed)); // get default color picker mode from editor settings int default_color_mode = EDITOR_GET("interface/inspector/default_color_picker_mode"); @@ -1864,7 +1847,7 @@ ScriptTextEditor::ScriptTextEditor() { edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_spaces"), EDIT_CONVERT_INDENT_TO_SPACES); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_tabs"), EDIT_CONVERT_INDENT_TO_TABS); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/auto_indent"), EDIT_AUTO_INDENT); - edit_menu->get_popup()->connect_compat("id_pressed", this, "_edit_option"); + edit_menu->get_popup()->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option)); edit_menu->get_popup()->add_separator(); PopupMenu *convert_case = memnew(PopupMenu); @@ -1874,7 +1857,7 @@ ScriptTextEditor::ScriptTextEditor() { convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_uppercase", TTR("Uppercase"), KEY_MASK_SHIFT | KEY_F4), EDIT_TO_UPPERCASE); convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_lowercase", TTR("Lowercase"), KEY_MASK_SHIFT | KEY_F5), EDIT_TO_LOWERCASE); convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize"), KEY_MASK_SHIFT | KEY_F6), EDIT_CAPITALIZE); - convert_case->connect_compat("id_pressed", this, "_edit_option"); + convert_case->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option)); highlighters[TTR("Standard")] = NULL; highlighter_menu = memnew(PopupMenu); @@ -1882,7 +1865,7 @@ ScriptTextEditor::ScriptTextEditor() { edit_menu->get_popup()->add_child(highlighter_menu); edit_menu->get_popup()->add_submenu_item(TTR("Syntax Highlighter"), "highlighter_menu"); highlighter_menu->add_radio_check_item(TTR("Standard")); - highlighter_menu->connect_compat("id_pressed", this, "_change_syntax_highlighter"); + highlighter_menu->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_change_syntax_highlighter)); search_menu = memnew(MenuButton); edit_hb->add_child(search_menu); @@ -1898,7 +1881,7 @@ ScriptTextEditor::ScriptTextEditor() { search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace_in_files"), REPLACE_IN_FILES); search_menu->get_popup()->add_separator(); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/contextual_help"), HELP_CONTEXTUAL); - search_menu->get_popup()->connect_compat("id_pressed", this, "_edit_option"); + search_menu->get_popup()->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option)); edit_hb->add_child(edit_menu); @@ -1906,7 +1889,7 @@ ScriptTextEditor::ScriptTextEditor() { edit_hb->add_child(goto_menu); goto_menu->set_text(TTR("Go To")); goto_menu->set_switch_on_hover(true); - goto_menu->get_popup()->connect_compat("id_pressed", this, "_edit_option"); + goto_menu->get_popup()->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option)); goto_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_function"), SEARCH_LOCATE_FUNCTION); goto_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"), SEARCH_GOTO_LINE); @@ -1917,20 +1900,20 @@ ScriptTextEditor::ScriptTextEditor() { goto_menu->get_popup()->add_child(bookmarks_menu); goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "Bookmarks"); _update_bookmark_list(); - bookmarks_menu->connect_compat("about_to_show", this, "_update_bookmark_list"); - bookmarks_menu->connect_compat("index_pressed", this, "_bookmark_item_pressed"); + bookmarks_menu->connect("about_to_show", callable_mp(this, &ScriptTextEditor::_update_bookmark_list)); + bookmarks_menu->connect("index_pressed", callable_mp(this, &ScriptTextEditor::_bookmark_item_pressed)); breakpoints_menu = memnew(PopupMenu); breakpoints_menu->set_name("Breakpoints"); goto_menu->get_popup()->add_child(breakpoints_menu); goto_menu->get_popup()->add_submenu_item(TTR("Breakpoints"), "Breakpoints"); _update_breakpoint_list(); - breakpoints_menu->connect_compat("about_to_show", this, "_update_breakpoint_list"); - breakpoints_menu->connect_compat("index_pressed", this, "_breakpoint_item_pressed"); + breakpoints_menu->connect("about_to_show", callable_mp(this, &ScriptTextEditor::_update_breakpoint_list)); + breakpoints_menu->connect("index_pressed", callable_mp(this, &ScriptTextEditor::_breakpoint_item_pressed)); quick_open = memnew(ScriptEditorQuickOpen); add_child(quick_open); - quick_open->connect_compat("goto_line", this, "_goto_line"); + quick_open->connect("goto_line", callable_mp(this, &ScriptTextEditor::_goto_line)); goto_line_dialog = memnew(GotoLineDialog); add_child(goto_line_dialog); diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index b45aacd1ee..31f126cc0a 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -390,17 +390,7 @@ void ShaderEditor::_editor_settings_changed() { void ShaderEditor::_bind_methods() { - ClassDB::bind_method("_reload_shader_from_disk", &ShaderEditor::_reload_shader_from_disk); - ClassDB::bind_method("_editor_settings_changed", &ShaderEditor::_editor_settings_changed); - ClassDB::bind_method("_text_edit_gui_input", &ShaderEditor::_text_edit_gui_input); - - ClassDB::bind_method("_update_bookmark_list", &ShaderEditor::_update_bookmark_list); - ClassDB::bind_method("_bookmark_item_pressed", &ShaderEditor::_bookmark_item_pressed); - - ClassDB::bind_method("_menu_option", &ShaderEditor::_menu_option); ClassDB::bind_method("_params_changed", &ShaderEditor::_params_changed); - ClassDB::bind_method("apply_shaders", &ShaderEditor::apply_shaders); - ClassDB::bind_method("save_external_data", &ShaderEditor::save_external_data); } void ShaderEditor::ensure_select_current() { @@ -608,8 +598,8 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { shader_editor->add_constant_override("separation", 0); shader_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE); - shader_editor->connect_compat("script_changed", this, "apply_shaders"); - EditorSettings::get_singleton()->connect_compat("settings_changed", this, "_editor_settings_changed"); + shader_editor->connect("script_changed", callable_mp(this, &ShaderEditor::apply_shaders)); + EditorSettings::get_singleton()->connect("settings_changed", callable_mp(this, &ShaderEditor::_editor_settings_changed)); shader_editor->get_text_edit()->set_callhint_settings( EditorSettings::get_singleton()->get("text_editor/completion/put_callhint_tooltip_below_current_line"), @@ -617,13 +607,13 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { shader_editor->get_text_edit()->set_select_identifiers_on_hover(true); shader_editor->get_text_edit()->set_context_menu_enabled(false); - shader_editor->get_text_edit()->connect_compat("gui_input", this, "_text_edit_gui_input"); + shader_editor->get_text_edit()->connect("gui_input", callable_mp(this, &ShaderEditor::_text_edit_gui_input)); shader_editor->update_editor_settings(); context_menu = memnew(PopupMenu); add_child(context_menu); - context_menu->connect_compat("id_pressed", this, "_menu_option"); + context_menu->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option)); context_menu->set_hide_on_window_lose_focus(true); VBoxContainer *main_container = memnew(VBoxContainer); @@ -651,7 +641,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/clone_down"), EDIT_CLONE_DOWN); edit_menu->get_popup()->add_separator(); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/complete_symbol"), EDIT_COMPLETE); - edit_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + edit_menu->get_popup()->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option)); search_menu = memnew(MenuButton); search_menu->set_text(TTR("Search")); @@ -661,12 +651,12 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_previous"), SEARCH_FIND_PREV); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace"), SEARCH_REPLACE); - search_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + search_menu->get_popup()->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option)); MenuButton *goto_menu = memnew(MenuButton); goto_menu->set_text(TTR("Go To")); goto_menu->set_switch_on_hover(true); - goto_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + goto_menu->get_popup()->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option)); goto_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"), SEARCH_GOTO_LINE); goto_menu->get_popup()->add_separator(); @@ -676,14 +666,14 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { goto_menu->get_popup()->add_child(bookmarks_menu); goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "Bookmarks"); _update_bookmark_list(); - bookmarks_menu->connect_compat("about_to_show", this, "_update_bookmark_list"); - bookmarks_menu->connect_compat("index_pressed", this, "_bookmark_item_pressed"); + bookmarks_menu->connect("about_to_show", callable_mp(this, &ShaderEditor::_update_bookmark_list)); + bookmarks_menu->connect("index_pressed", callable_mp(this, &ShaderEditor::_bookmark_item_pressed)); help_menu = memnew(MenuButton); help_menu->set_text(TTR("Help")); help_menu->set_switch_on_hover(true); help_menu->get_popup()->add_icon_item(p_node->get_gui_base()->get_icon("Instance", "EditorIcons"), TTR("Online Docs"), HELP_DOCS); - help_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + help_menu->get_popup()->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option)); add_child(main_container); main_container->add_child(hbc); @@ -706,11 +696,11 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { dl->set_text(TTR("This shader has been modified on on disk.\nWhat action should be taken?")); vbc->add_child(dl); - disk_changed->connect_compat("confirmed", this, "_reload_shader_from_disk"); + disk_changed->connect("confirmed", callable_mp(this, &ShaderEditor::_reload_shader_from_disk)); disk_changed->get_ok()->set_text(TTR("Reload")); disk_changed->add_button(TTR("Resave"), !OS::get_singleton()->get_swap_ok_cancel(), "resave"); - disk_changed->connect_compat("custom_action", this, "save_external_data"); + disk_changed->connect("custom_action", callable_mp(this, &ShaderEditor::save_external_data)); add_child(disk_changed); diff --git a/editor/plugins/skeleton_2d_editor_plugin.cpp b/editor/plugins/skeleton_2d_editor_plugin.cpp index d83a8ddf2d..0b77b987bf 100644 --- a/editor/plugins/skeleton_2d_editor_plugin.cpp +++ b/editor/plugins/skeleton_2d_editor_plugin.cpp @@ -92,8 +92,6 @@ void Skeleton2DEditor::_menu_option(int p_option) { } void Skeleton2DEditor::_bind_methods() { - - ClassDB::bind_method("_menu_option", &Skeleton2DEditor::_menu_option); } Skeleton2DEditor::Skeleton2DEditor() { @@ -110,7 +108,7 @@ Skeleton2DEditor::Skeleton2DEditor() { options->get_popup()->add_item(TTR("Set Bones to Rest Pose"), MENU_OPTION_SET_REST); options->set_switch_on_hover(true); - options->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + options->get_popup()->connect("id_pressed", callable_mp(this, &Skeleton2DEditor::_menu_option)); err_dialog = memnew(AcceptDialog); add_child(err_dialog); diff --git a/editor/plugins/skeleton_editor_plugin.cpp b/editor/plugins/skeleton_editor_plugin.cpp index 43ba99317e..07bd6a0e41 100644 --- a/editor/plugins/skeleton_editor_plugin.cpp +++ b/editor/plugins/skeleton_editor_plugin.cpp @@ -137,7 +137,7 @@ void SkeletonEditor::edit(Skeleton *p_node) { void SkeletonEditor::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - get_tree()->connect_compat("node_removed", this, "_node_removed"); + get_tree()->connect("node_removed", callable_mp(this, &SkeletonEditor::_node_removed)); } } @@ -150,8 +150,6 @@ void SkeletonEditor::_node_removed(Node *p_node) { } void SkeletonEditor::_bind_methods() { - ClassDB::bind_method("_on_click_option", &SkeletonEditor::_on_click_option); - ClassDB::bind_method("_node_removed", &SkeletonEditor::_node_removed); } SkeletonEditor::SkeletonEditor() { @@ -164,7 +162,7 @@ SkeletonEditor::SkeletonEditor() { options->get_popup()->add_item(TTR("Create physical skeleton"), MENU_OPTION_CREATE_PHYSICAL_SKELETON); - options->get_popup()->connect_compat("id_pressed", this, "_on_click_option"); + options->get_popup()->connect("id_pressed", callable_mp(this, &SkeletonEditor::_on_click_option)); options->hide(); } diff --git a/editor/plugins/skeleton_ik_editor_plugin.cpp b/editor/plugins/skeleton_ik_editor_plugin.cpp index a09dcca279..b031bd71d3 100644 --- a/editor/plugins/skeleton_ik_editor_plugin.cpp +++ b/editor/plugins/skeleton_ik_editor_plugin.cpp @@ -81,8 +81,6 @@ void SkeletonIKEditorPlugin::make_visible(bool p_visible) { } void SkeletonIKEditorPlugin::_bind_methods() { - - ClassDB::bind_method("_play", &SkeletonIKEditorPlugin::_play); } SkeletonIKEditorPlugin::SkeletonIKEditorPlugin(EditorNode *p_node) { @@ -93,7 +91,7 @@ SkeletonIKEditorPlugin::SkeletonIKEditorPlugin(EditorNode *p_node) { play_btn->set_text(TTR("Play IK")); play_btn->set_toggle_mode(true); play_btn->hide(); - play_btn->connect_compat("pressed", this, "_play"); + play_btn->connect("pressed", callable_mp(this, &SkeletonIKEditorPlugin::_play)); add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, play_btn); skeleton_ik = NULL; } diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 4c8a0590fd..dd006316f7 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -2187,10 +2187,10 @@ void SpatialEditorViewport::_notification(int p_what) { if (cam != NULL && cam != previewing) { //then switch the viewport's camera to the scene's viewport camera if (previewing != NULL) { - previewing->disconnect_compat("tree_exited", this, "_preview_exited_scene"); + previewing->disconnect("tree_exited", callable_mp(this, &SpatialEditorViewport::_preview_exited_scene)); } previewing = cam; - previewing->connect_compat("tree_exited", this, "_preview_exited_scene"); + previewing->connect("tree_exited", callable_mp(this, &SpatialEditorViewport::_preview_exited_scene)); VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), cam->get_camera()); surface->update(); } @@ -2331,12 +2331,12 @@ void SpatialEditorViewport::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - surface->connect_compat("draw", this, "_draw"); - surface->connect_compat("gui_input", this, "_sinput"); - surface->connect_compat("mouse_entered", this, "_surface_mouse_enter"); - surface->connect_compat("mouse_exited", this, "_surface_mouse_exit"); - surface->connect_compat("focus_entered", this, "_surface_focus_enter"); - surface->connect_compat("focus_exited", this, "_surface_focus_exit"); + surface->connect("draw", callable_mp(this, &SpatialEditorViewport::_draw)); + surface->connect("gui_input", callable_mp(this, &SpatialEditorViewport::_sinput)); + surface->connect("mouse_entered", callable_mp(this, &SpatialEditorViewport::_surface_mouse_enter)); + surface->connect("mouse_exited", callable_mp(this, &SpatialEditorViewport::_surface_mouse_exit)); + surface->connect("focus_entered", callable_mp(this, &SpatialEditorViewport::_surface_focus_enter)); + surface->connect("focus_exited", callable_mp(this, &SpatialEditorViewport::_surface_focus_exit)); _init_gizmo_instance(index); } @@ -2837,10 +2837,10 @@ void SpatialEditorViewport::_menu_option(int p_option) { void SpatialEditorViewport::_preview_exited_scene() { - preview_camera->disconnect_compat("toggled", this, "_toggle_camera_preview"); + preview_camera->disconnect("toggled", callable_mp(this, &SpatialEditorViewport::_toggle_camera_preview)); preview_camera->set_pressed(false); _toggle_camera_preview(false); - preview_camera->connect_compat("toggled", this, "_toggle_camera_preview"); + preview_camera->connect("toggled", callable_mp(this, &SpatialEditorViewport::_toggle_camera_preview)); view_menu->show(); } @@ -2903,7 +2903,7 @@ void SpatialEditorViewport::_toggle_camera_preview(bool p_activate) { if (!p_activate) { - previewing->disconnect_compat("tree_exiting", this, "_preview_exited_scene"); + previewing->disconnect("tree_exiting", callable_mp(this, &SpatialEditorViewport::_preview_exited_scene)); previewing = NULL; VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore if (!preview) @@ -2914,7 +2914,7 @@ void SpatialEditorViewport::_toggle_camera_preview(bool p_activate) { } else { previewing = preview; - previewing->connect_compat("tree_exiting", this, "_preview_exited_scene"); + previewing->connect("tree_exiting", callable_mp(this, &SpatialEditorViewport::_preview_exited_scene)); VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), preview->get_camera()); //replace view_menu->set_disabled(true); surface->update(); @@ -2925,7 +2925,7 @@ void SpatialEditorViewport::_toggle_cinema_preview(bool p_activate) { previewing_cinema = p_activate; if (!previewing_cinema) { if (previewing != NULL) - previewing->disconnect_compat("tree_exited", this, "_preview_exited_scene"); + previewing->disconnect("tree_exited", callable_mp(this, &SpatialEditorViewport::_preview_exited_scene)); previewing = NULL; VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore @@ -3110,14 +3110,14 @@ void SpatialEditorViewport::set_state(const Dictionary &p_state) { view_menu->get_popup()->set_item_checked(idx, previewing_cinema); } - if (preview_camera->is_connected_compat("toggled", this, "_toggle_camera_preview")) { - preview_camera->disconnect_compat("toggled", this, "_toggle_camera_preview"); + if (preview_camera->is_connected("toggled", callable_mp(this, &SpatialEditorViewport::_toggle_camera_preview))) { + preview_camera->disconnect("toggled", callable_mp(this, &SpatialEditorViewport::_toggle_camera_preview)); } if (p_state.has("previewing")) { Node *pv = EditorNode::get_singleton()->get_edited_scene()->get_node(p_state["previewing"]); if (Object::cast_to<Camera>(pv)) { previewing = Object::cast_to<Camera>(pv); - previewing->connect_compat("tree_exiting", this, "_preview_exited_scene"); + previewing->connect("tree_exiting", callable_mp(this, &SpatialEditorViewport::_preview_exited_scene)); VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), previewing->get_camera()); //replace view_menu->set_disabled(true); surface->update(); @@ -3125,7 +3125,7 @@ void SpatialEditorViewport::set_state(const Dictionary &p_state) { preview_camera->show(); } } - preview_camera->connect_compat("toggled", this, "_toggle_camera_preview"); + preview_camera->connect("toggled", callable_mp(this, &SpatialEditorViewport::_toggle_camera_preview)); } Dictionary SpatialEditorViewport::get_state() const { @@ -3162,19 +3162,7 @@ Dictionary SpatialEditorViewport::get_state() const { void SpatialEditorViewport::_bind_methods() { - ClassDB::bind_method(D_METHOD("_draw"), &SpatialEditorViewport::_draw); - - ClassDB::bind_method(D_METHOD("_surface_mouse_enter"), &SpatialEditorViewport::_surface_mouse_enter); - ClassDB::bind_method(D_METHOD("_surface_mouse_exit"), &SpatialEditorViewport::_surface_mouse_exit); - ClassDB::bind_method(D_METHOD("_surface_focus_enter"), &SpatialEditorViewport::_surface_focus_enter); - ClassDB::bind_method(D_METHOD("_surface_focus_exit"), &SpatialEditorViewport::_surface_focus_exit); - ClassDB::bind_method(D_METHOD("_sinput"), &SpatialEditorViewport::_sinput); - ClassDB::bind_method(D_METHOD("_menu_option"), &SpatialEditorViewport::_menu_option); - ClassDB::bind_method(D_METHOD("_toggle_camera_preview"), &SpatialEditorViewport::_toggle_camera_preview); - ClassDB::bind_method(D_METHOD("_preview_exited_scene"), &SpatialEditorViewport::_preview_exited_scene); - ClassDB::bind_method(D_METHOD("update_transform_gizmo_view"), &SpatialEditorViewport::update_transform_gizmo_view); - ClassDB::bind_method(D_METHOD("_selection_result_pressed"), &SpatialEditorViewport::_selection_result_pressed); - ClassDB::bind_method(D_METHOD("_selection_menu_hide"), &SpatialEditorViewport::_selection_menu_hide); + ClassDB::bind_method(D_METHOD("update_transform_gizmo_view"), &SpatialEditorViewport::update_transform_gizmo_view); // Used by call_deferred. ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &SpatialEditorViewport::can_drop_data_fw); ClassDB::bind_method(D_METHOD("drop_data_fw"), &SpatialEditorViewport::drop_data_fw); @@ -3684,8 +3672,8 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/focus_selection"), VIEW_CENTER_TO_SELECTION); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/align_transform_with_view"), VIEW_ALIGN_TRANSFORM_WITH_VIEW); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/align_rotation_with_view"), VIEW_ALIGN_ROTATION_WITH_VIEW); - view_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); - display_submenu->connect_compat("id_pressed", this, "_menu_option"); + view_menu->get_popup()->connect("id_pressed", callable_mp(this, &SpatialEditorViewport::_menu_option)); + display_submenu->connect("id_pressed", callable_mp(this, &SpatialEditorViewport::_menu_option)); view_menu->set_disable_shortcuts(true); if (OS::get_singleton()->get_current_video_driver() == OS::VIDEO_DRIVER_GLES2) { @@ -3720,7 +3708,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed vbox->add_child(preview_camera); preview_camera->set_h_size_flags(0); preview_camera->hide(); - preview_camera->connect_compat("toggled", this, "_toggle_camera_preview"); + preview_camera->connect("toggled", callable_mp(this, &SpatialEditorViewport::_toggle_camera_preview)); previewing = NULL; gizmo_scale = 1.0; @@ -3773,8 +3761,8 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed selection_menu = memnew(PopupMenu); add_child(selection_menu); selection_menu->set_custom_minimum_size(Size2(100, 0) * EDSCALE); - selection_menu->connect_compat("id_pressed", this, "_selection_result_pressed"); - selection_menu->connect_compat("popup_hide", this, "_selection_menu_hide"); + selection_menu->connect("id_pressed", callable_mp(this, &SpatialEditorViewport::_selection_result_pressed)); + selection_menu->connect("popup_hide", callable_mp(this, &SpatialEditorViewport::_selection_menu_hide)); if (p_index == 0) { view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_AUDIO_LISTENER), true); @@ -3784,7 +3772,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed name = ""; _update_name(); - EditorSettings::get_singleton()->connect_compat("settings_changed", this, "update_transform_gizmo_view"); + EditorSettings::get_singleton()->connect("settings_changed", callable_mp(this, &SpatialEditorViewport::update_transform_gizmo_view)); } ////////////////////////////////////////////////////////////// @@ -5471,12 +5459,12 @@ void SpatialEditor::_notification(int p_what) { _refresh_menu_icons(); - get_tree()->connect_compat("node_removed", this, "_node_removed"); - EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor()->connect_compat("node_changed", this, "_refresh_menu_icons"); - editor_selection->connect_compat("selection_changed", this, "_refresh_menu_icons"); + get_tree()->connect("node_removed", callable_mp(this, &SpatialEditor::_node_removed)); + EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor()->connect("node_changed", callable_mp(this, &SpatialEditor::_refresh_menu_icons)); + editor_selection->connect("selection_changed", callable_mp(this, &SpatialEditor::_refresh_menu_icons)); - editor->connect_compat("stop_pressed", this, "_update_camera_override_button", make_binds(false)); - editor->connect_compat("play_pressed", this, "_update_camera_override_button", make_binds(true)); + editor->connect("stop_pressed", callable_mp(this, &SpatialEditor::_update_camera_override_button), make_binds(false)); + editor->connect("play_pressed", callable_mp(this, &SpatialEditor::_update_camera_override_button), make_binds(true)); } else if (p_what == NOTIFICATION_ENTER_TREE) { _register_all_gizmos(); @@ -5653,17 +5641,8 @@ void SpatialEditor::_register_all_gizmos() { void SpatialEditor::_bind_methods() { ClassDB::bind_method("_unhandled_key_input", &SpatialEditor::_unhandled_key_input); - ClassDB::bind_method("_node_removed", &SpatialEditor::_node_removed); - ClassDB::bind_method("_menu_item_pressed", &SpatialEditor::_menu_item_pressed); - ClassDB::bind_method("_menu_gizmo_toggled", &SpatialEditor::_menu_gizmo_toggled); - ClassDB::bind_method("_menu_item_toggled", &SpatialEditor::_menu_item_toggled); - ClassDB::bind_method("_xform_dialog_action", &SpatialEditor::_xform_dialog_action); ClassDB::bind_method("_get_editor_data", &SpatialEditor::_get_editor_data); ClassDB::bind_method("_request_gizmo", &SpatialEditor::_request_gizmo); - ClassDB::bind_method("_toggle_maximize_view", &SpatialEditor::_toggle_maximize_view); - ClassDB::bind_method("_refresh_menu_icons", &SpatialEditor::_refresh_menu_icons); - ClassDB::bind_method("_update_camera_override_button", &SpatialEditor::_update_camera_override_button); - ClassDB::bind_method("_update_camera_override_viewport", &SpatialEditor::_update_camera_override_viewport); ADD_SIGNAL(MethodInfo("transform_key_request")); ADD_SIGNAL(MethodInfo("item_lock_status_changed")); @@ -5732,7 +5711,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_button[TOOL_MODE_SELECT]->set_flat(true); tool_button[TOOL_MODE_SELECT]->set_pressed(true); button_binds.write[0] = MENU_TOOL_SELECT; - tool_button[TOOL_MODE_SELECT]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_MODE_SELECT]->connect("pressed", callable_mp(this, &SpatialEditor::_menu_item_pressed), button_binds); tool_button[TOOL_MODE_SELECT]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_select", TTR("Select Mode"), KEY_Q)); tool_button[TOOL_MODE_SELECT]->set_tooltip(keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate\nAlt+Drag: Move\nAlt+RMB: Depth list selection")); @@ -5743,7 +5722,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_button[TOOL_MODE_MOVE]->set_toggle_mode(true); tool_button[TOOL_MODE_MOVE]->set_flat(true); button_binds.write[0] = MENU_TOOL_MOVE; - tool_button[TOOL_MODE_MOVE]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_MODE_MOVE]->connect("pressed", callable_mp(this, &SpatialEditor::_menu_item_pressed), button_binds); tool_button[TOOL_MODE_MOVE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_move", TTR("Move Mode"), KEY_W)); tool_button[TOOL_MODE_ROTATE] = memnew(ToolButton); @@ -5751,7 +5730,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_button[TOOL_MODE_ROTATE]->set_toggle_mode(true); tool_button[TOOL_MODE_ROTATE]->set_flat(true); button_binds.write[0] = MENU_TOOL_ROTATE; - tool_button[TOOL_MODE_ROTATE]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_MODE_ROTATE]->connect("pressed", callable_mp(this, &SpatialEditor::_menu_item_pressed), button_binds); tool_button[TOOL_MODE_ROTATE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_rotate", TTR("Rotate Mode"), KEY_E)); tool_button[TOOL_MODE_SCALE] = memnew(ToolButton); @@ -5759,7 +5738,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_button[TOOL_MODE_SCALE]->set_toggle_mode(true); tool_button[TOOL_MODE_SCALE]->set_flat(true); button_binds.write[0] = MENU_TOOL_SCALE; - tool_button[TOOL_MODE_SCALE]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_MODE_SCALE]->connect("pressed", callable_mp(this, &SpatialEditor::_menu_item_pressed), button_binds); tool_button[TOOL_MODE_SCALE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_scale", TTR("Scale Mode"), KEY_R)); hbc_menu->add_child(memnew(VSeparator)); @@ -5769,31 +5748,31 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_button[TOOL_MODE_LIST_SELECT]->set_toggle_mode(true); tool_button[TOOL_MODE_LIST_SELECT]->set_flat(true); button_binds.write[0] = MENU_TOOL_LIST_SELECT; - tool_button[TOOL_MODE_LIST_SELECT]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_MODE_LIST_SELECT]->connect("pressed", callable_mp(this, &SpatialEditor::_menu_item_pressed), button_binds); tool_button[TOOL_MODE_LIST_SELECT]->set_tooltip(TTR("Show a list of all objects at the position clicked\n(same as Alt+RMB in select mode).")); tool_button[TOOL_LOCK_SELECTED] = memnew(ToolButton); hbc_menu->add_child(tool_button[TOOL_LOCK_SELECTED]); button_binds.write[0] = MENU_LOCK_SELECTED; - tool_button[TOOL_LOCK_SELECTED]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_LOCK_SELECTED]->connect("pressed", callable_mp(this, &SpatialEditor::_menu_item_pressed), button_binds); tool_button[TOOL_LOCK_SELECTED]->set_tooltip(TTR("Lock the selected object in place (can't be moved).")); tool_button[TOOL_UNLOCK_SELECTED] = memnew(ToolButton); hbc_menu->add_child(tool_button[TOOL_UNLOCK_SELECTED]); button_binds.write[0] = MENU_UNLOCK_SELECTED; - tool_button[TOOL_UNLOCK_SELECTED]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_UNLOCK_SELECTED]->connect("pressed", callable_mp(this, &SpatialEditor::_menu_item_pressed), button_binds); tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip(TTR("Unlock the selected object (can be moved).")); tool_button[TOOL_GROUP_SELECTED] = memnew(ToolButton); hbc_menu->add_child(tool_button[TOOL_GROUP_SELECTED]); button_binds.write[0] = MENU_GROUP_SELECTED; - tool_button[TOOL_GROUP_SELECTED]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_GROUP_SELECTED]->connect("pressed", callable_mp(this, &SpatialEditor::_menu_item_pressed), button_binds); tool_button[TOOL_GROUP_SELECTED]->set_tooltip(TTR("Makes sure the object's children are not selectable.")); tool_button[TOOL_UNGROUP_SELECTED] = memnew(ToolButton); hbc_menu->add_child(tool_button[TOOL_UNGROUP_SELECTED]); button_binds.write[0] = MENU_UNGROUP_SELECTED; - tool_button[TOOL_UNGROUP_SELECTED]->connect_compat("pressed", this, "_menu_item_pressed", button_binds); + tool_button[TOOL_UNGROUP_SELECTED]->connect("pressed", callable_mp(this, &SpatialEditor::_menu_item_pressed), button_binds); tool_button[TOOL_UNGROUP_SELECTED]->set_tooltip(TTR("Restores the object's children's ability to be selected.")); hbc_menu->add_child(memnew(VSeparator)); @@ -5803,7 +5782,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_toggle_mode(true); tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_flat(true); button_binds.write[0] = MENU_TOOL_LOCAL_COORDS; - tool_option_button[TOOL_OPT_LOCAL_COORDS]->connect_compat("toggled", this, "_menu_item_toggled", button_binds); + tool_option_button[TOOL_OPT_LOCAL_COORDS]->connect("toggled", callable_mp(this, &SpatialEditor::_menu_item_toggled), button_binds); tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut(ED_SHORTCUT("spatial_editor/local_coords", TTR("Use Local Space"), KEY_T)); tool_option_button[TOOL_OPT_USE_SNAP] = memnew(ToolButton); @@ -5811,7 +5790,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_option_button[TOOL_OPT_USE_SNAP]->set_toggle_mode(true); tool_option_button[TOOL_OPT_USE_SNAP]->set_flat(true); button_binds.write[0] = MENU_TOOL_USE_SNAP; - tool_option_button[TOOL_OPT_USE_SNAP]->connect_compat("toggled", this, "_menu_item_toggled", button_binds); + tool_option_button[TOOL_OPT_USE_SNAP]->connect("toggled", callable_mp(this, &SpatialEditor::_menu_item_toggled), button_binds); tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut(ED_SHORTCUT("spatial_editor/snap", TTR("Use Snap"), KEY_Y)); hbc_menu->add_child(memnew(VSeparator)); @@ -5822,7 +5801,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_flat(true); tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_disabled(true); button_binds.write[0] = MENU_TOOL_OVERRIDE_CAMERA; - tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->connect_compat("toggled", this, "_menu_item_toggled", button_binds); + tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->connect("toggled", callable_mp(this, &SpatialEditor::_menu_item_toggled), button_binds); _update_camera_override_button(false); hbc_menu->add_child(memnew(VSeparator)); @@ -5859,7 +5838,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { p->add_separator(); p->add_shortcut(ED_SHORTCUT("spatial_editor/configure_snap", TTR("Configure Snap...")), MENU_TRANSFORM_CONFIGURE_SNAP); - p->connect_compat("id_pressed", this, "_menu_item_pressed"); + p->connect("id_pressed", callable_mp(this, &SpatialEditor::_menu_item_pressed)); view_menu = memnew(MenuButton); view_menu->set_text(TTR("View")); @@ -5891,13 +5870,13 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { p->set_item_checked(p->get_item_index(MENU_VIEW_ORIGIN), true); p->set_item_checked(p->get_item_index(MENU_VIEW_GRID), true); - p->connect_compat("id_pressed", this, "_menu_item_pressed"); + p->connect("id_pressed", callable_mp(this, &SpatialEditor::_menu_item_pressed)); gizmos_menu = memnew(PopupMenu); p->add_child(gizmos_menu); gizmos_menu->set_name("GizmosMenu"); gizmos_menu->set_hide_on_checkable_item_selection(false); - gizmos_menu->connect_compat("id_pressed", this, "_menu_gizmo_toggled"); + gizmos_menu->connect("id_pressed", callable_mp(this, &SpatialEditor::_menu_gizmo_toggled)); /* REST OF MENU */ @@ -5914,8 +5893,8 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { viewports[i] = memnew(SpatialEditorViewport(this, editor, i)); - viewports[i]->connect_compat("toggle_maximize_view", this, "_toggle_maximize_view"); - viewports[i]->connect_compat("clicked", this, "_update_camera_override_viewport"); + viewports[i]->connect("toggle_maximize_view", callable_mp(this, &SpatialEditor::_toggle_maximize_view)); + viewports[i]->connect("clicked", callable_mp(this, &SpatialEditor::_update_camera_override_viewport)); viewports[i]->assign_pending_data_pointers(preview_node, &preview_bounds, accept); viewport_base->add_child(viewports[i]); } @@ -6030,7 +6009,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { xform_type->add_item(TTR("Post")); xform_vbc->add_child(xform_type); - xform_dialog->connect_compat("confirmed", this, "_xform_dialog_action"); + xform_dialog->connect("confirmed", callable_mp(this, &SpatialEditor::_xform_dialog_action)); scenario_debug = VisualServer::SCENARIO_DEBUG_DISABLED; diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp index c35afa0644..135807e88c 100644 --- a/editor/plugins/sprite_editor_plugin.cpp +++ b/editor/plugins/sprite_editor_plugin.cpp @@ -504,10 +504,6 @@ void SpriteEditor::_debug_uv_draw() { void SpriteEditor::_bind_methods() { - ClassDB::bind_method("_menu_option", &SpriteEditor::_menu_option); - ClassDB::bind_method("_debug_uv_draw", &SpriteEditor::_debug_uv_draw); - ClassDB::bind_method("_update_mesh_data", &SpriteEditor::_update_mesh_data); - ClassDB::bind_method("_create_node", &SpriteEditor::_create_node); ClassDB::bind_method("_add_as_sibling_or_child", &SpriteEditor::_add_as_sibling_or_child); } @@ -526,7 +522,7 @@ SpriteEditor::SpriteEditor() { options->get_popup()->add_item(TTR("Create LightOccluder2D Sibling"), MENU_OPTION_CREATE_LIGHT_OCCLUDER_2D); options->set_switch_on_hover(true); - options->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + options->get_popup()->connect("id_pressed", callable_mp(this, &SpriteEditor::_menu_option)); err_dialog = memnew(AcceptDialog); add_child(err_dialog); @@ -542,9 +538,9 @@ SpriteEditor::SpriteEditor() { scroll->set_enable_v_scroll(true); vb->add_margin_child(TTR("Preview:"), scroll, true); debug_uv = memnew(Control); - debug_uv->connect_compat("draw", this, "_debug_uv_draw"); + debug_uv->connect("draw", callable_mp(this, &SpriteEditor::_debug_uv_draw)); scroll->add_child(debug_uv); - debug_uv_dialog->connect_compat("confirmed", this, "_create_node"); + debug_uv_dialog->connect("confirmed", callable_mp(this, &SpriteEditor::_create_node)); HBoxContainer *hb = memnew(HBoxContainer); hb->add_child(memnew(Label(TTR("Simplification: ")))); @@ -573,7 +569,7 @@ SpriteEditor::SpriteEditor() { hb->add_spacer(); update_preview = memnew(Button); update_preview->set_text(TTR("Update Preview")); - update_preview->connect_compat("pressed", this, "_update_mesh_data"); + update_preview->connect("pressed", callable_mp(this, &SpriteEditor::_update_mesh_data)); hb->add_child(update_preview); vb->add_margin_child(TTR("Settings:"), hb); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index c80ba873fb..288aeb5c4a 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -860,33 +860,10 @@ void SpriteFramesEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da void SpriteFramesEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("_load_pressed"), &SpriteFramesEditor::_load_pressed); - ClassDB::bind_method(D_METHOD("_empty_pressed"), &SpriteFramesEditor::_empty_pressed); - ClassDB::bind_method(D_METHOD("_empty2_pressed"), &SpriteFramesEditor::_empty2_pressed); - ClassDB::bind_method(D_METHOD("_delete_pressed"), &SpriteFramesEditor::_delete_pressed); - ClassDB::bind_method(D_METHOD("_copy_pressed"), &SpriteFramesEditor::_copy_pressed); - ClassDB::bind_method(D_METHOD("_paste_pressed"), &SpriteFramesEditor::_paste_pressed); - ClassDB::bind_method(D_METHOD("_file_load_request", "files", "at_position"), &SpriteFramesEditor::_file_load_request, DEFVAL(-1)); ClassDB::bind_method(D_METHOD("_update_library", "skipsel"), &SpriteFramesEditor::_update_library, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("_up_pressed"), &SpriteFramesEditor::_up_pressed); - ClassDB::bind_method(D_METHOD("_down_pressed"), &SpriteFramesEditor::_down_pressed); - ClassDB::bind_method(D_METHOD("_animation_select"), &SpriteFramesEditor::_animation_select); - ClassDB::bind_method(D_METHOD("_animation_name_edited"), &SpriteFramesEditor::_animation_name_edited); - ClassDB::bind_method(D_METHOD("_animation_add"), &SpriteFramesEditor::_animation_add); - ClassDB::bind_method(D_METHOD("_animation_remove"), &SpriteFramesEditor::_animation_remove); - ClassDB::bind_method(D_METHOD("_animation_remove_confirmed"), &SpriteFramesEditor::_animation_remove_confirmed); - ClassDB::bind_method(D_METHOD("_animation_loop_changed"), &SpriteFramesEditor::_animation_loop_changed); - ClassDB::bind_method(D_METHOD("_animation_fps_changed"), &SpriteFramesEditor::_animation_fps_changed); ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &SpriteFramesEditor::get_drag_data_fw); ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &SpriteFramesEditor::can_drop_data_fw); ClassDB::bind_method(D_METHOD("drop_data_fw"), &SpriteFramesEditor::drop_data_fw); - ClassDB::bind_method(D_METHOD("_prepare_sprite_sheet"), &SpriteFramesEditor::_prepare_sprite_sheet); - ClassDB::bind_method(D_METHOD("_open_sprite_sheet"), &SpriteFramesEditor::_open_sprite_sheet); - ClassDB::bind_method(D_METHOD("_sheet_preview_draw"), &SpriteFramesEditor::_sheet_preview_draw); - ClassDB::bind_method(D_METHOD("_sheet_preview_input"), &SpriteFramesEditor::_sheet_preview_input); - ClassDB::bind_method(D_METHOD("_sheet_spin_changed"), &SpriteFramesEditor::_sheet_spin_changed); - ClassDB::bind_method(D_METHOD("_sheet_add_frames"), &SpriteFramesEditor::_sheet_add_frames); - ClassDB::bind_method(D_METHOD("_sheet_select_clear_all_frames"), &SpriteFramesEditor::_sheet_select_clear_all_frames); } SpriteFramesEditor::SpriteFramesEditor() { @@ -905,19 +882,19 @@ SpriteFramesEditor::SpriteFramesEditor() { new_anim = memnew(ToolButton); new_anim->set_tooltip(TTR("New Animation")); hbc_animlist->add_child(new_anim); - new_anim->connect_compat("pressed", this, "_animation_add"); + new_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_add)); remove_anim = memnew(ToolButton); remove_anim->set_tooltip(TTR("Remove Animation")); hbc_animlist->add_child(remove_anim); - remove_anim->connect_compat("pressed", this, "_animation_remove"); + remove_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_remove)); animations = memnew(Tree); sub_vb->add_child(animations); animations->set_v_size_flags(SIZE_EXPAND_FILL); animations->set_hide_root(true); - animations->connect_compat("cell_selected", this, "_animation_select"); - animations->connect_compat("item_edited", this, "_animation_name_edited"); + animations->connect("cell_selected", callable_mp(this, &SpriteFramesEditor::_animation_select)); + animations->connect("item_edited", callable_mp(this, &SpriteFramesEditor::_animation_name_edited)); animations->set_allow_reselect(true); anim_speed = memnew(SpinBox); @@ -925,12 +902,12 @@ SpriteFramesEditor::SpriteFramesEditor() { anim_speed->set_min(0); anim_speed->set_max(100); anim_speed->set_step(0.01); - anim_speed->connect_compat("value_changed", this, "_animation_fps_changed"); + anim_speed->connect("value_changed", callable_mp(this, &SpriteFramesEditor::_animation_fps_changed)); anim_loop = memnew(CheckButton); anim_loop->set_text(TTR("Loop")); vbc_animlist->add_child(anim_loop); - anim_loop->connect_compat("pressed", this, "_animation_loop_changed"); + anim_loop->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_loop_changed)); VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); @@ -1004,16 +981,16 @@ SpriteFramesEditor::SpriteFramesEditor() { dialog = memnew(AcceptDialog); add_child(dialog); - load->connect_compat("pressed", this, "_load_pressed"); - load_sheet->connect_compat("pressed", this, "_open_sprite_sheet"); - _delete->connect_compat("pressed", this, "_delete_pressed"); - copy->connect_compat("pressed", this, "_copy_pressed"); - paste->connect_compat("pressed", this, "_paste_pressed"); - empty->connect_compat("pressed", this, "_empty_pressed"); - empty2->connect_compat("pressed", this, "_empty2_pressed"); - move_up->connect_compat("pressed", this, "_up_pressed"); - move_down->connect_compat("pressed", this, "_down_pressed"); - file->connect_compat("files_selected", this, "_file_load_request"); + load->connect("pressed", callable_mp(this, &SpriteFramesEditor::_load_pressed)); + load_sheet->connect("pressed", callable_mp(this, &SpriteFramesEditor::_open_sprite_sheet)); + _delete->connect("pressed", callable_mp(this, &SpriteFramesEditor::_delete_pressed)); + copy->connect("pressed", callable_mp(this, &SpriteFramesEditor::_copy_pressed)); + paste->connect("pressed", callable_mp(this, &SpriteFramesEditor::_paste_pressed)); + empty->connect("pressed", callable_mp(this, &SpriteFramesEditor::_empty_pressed)); + empty2->connect("pressed", callable_mp(this, &SpriteFramesEditor::_empty2_pressed)); + move_up->connect("pressed", callable_mp(this, &SpriteFramesEditor::_up_pressed)); + move_down->connect("pressed", callable_mp(this, &SpriteFramesEditor::_down_pressed)); + file->connect("files_selected", callable_mp(this, &SpriteFramesEditor::_file_load_request)); loading_scene = false; sel = -1; @@ -1023,14 +1000,14 @@ SpriteFramesEditor::SpriteFramesEditor() { delete_dialog = memnew(ConfirmationDialog); add_child(delete_dialog); - delete_dialog->connect_compat("confirmed", this, "_animation_remove_confirmed"); + delete_dialog->connect("confirmed", callable_mp(this, &SpriteFramesEditor::_animation_remove_confirmed)); split_sheet_dialog = memnew(ConfirmationDialog); add_child(split_sheet_dialog); VBoxContainer *split_sheet_vb = memnew(VBoxContainer); split_sheet_dialog->add_child(split_sheet_vb); split_sheet_dialog->set_title(TTR("Select Frames")); - split_sheet_dialog->connect_compat("confirmed", this, "_sheet_add_frames"); + split_sheet_dialog->connect("confirmed", callable_mp(this, &SpriteFramesEditor::_sheet_add_frames)); HBoxContainer *split_sheet_hb = memnew(HBoxContainer); @@ -1041,7 +1018,7 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_h->set_max(128); split_sheet_h->set_step(1); split_sheet_hb->add_child(split_sheet_h); - split_sheet_h->connect_compat("value_changed", this, "_sheet_spin_changed"); + split_sheet_h->connect("value_changed", callable_mp(this, &SpriteFramesEditor::_sheet_spin_changed)); ss_label = memnew(Label(TTR("Vertical:"))); split_sheet_hb->add_child(ss_label); @@ -1050,13 +1027,13 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_v->set_max(128); split_sheet_v->set_step(1); split_sheet_hb->add_child(split_sheet_v); - split_sheet_v->connect_compat("value_changed", this, "_sheet_spin_changed"); + split_sheet_v->connect("value_changed", callable_mp(this, &SpriteFramesEditor::_sheet_spin_changed)); split_sheet_hb->add_spacer(); Button *select_clear_all = memnew(Button); select_clear_all->set_text(TTR("Select/Clear All Frames")); - select_clear_all->connect_compat("pressed", this, "_sheet_select_clear_all_frames"); + select_clear_all->connect("pressed", callable_mp(this, &SpriteFramesEditor::_sheet_select_clear_all_frames)); split_sheet_hb->add_child(select_clear_all); split_sheet_vb->add_child(split_sheet_hb); @@ -1064,8 +1041,8 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_preview = memnew(TextureRect); split_sheet_preview->set_expand(false); split_sheet_preview->set_mouse_filter(MOUSE_FILTER_PASS); - split_sheet_preview->connect_compat("draw", this, "_sheet_preview_draw"); - split_sheet_preview->connect_compat("gui_input", this, "_sheet_preview_input"); + split_sheet_preview->connect("draw", callable_mp(this, &SpriteFramesEditor::_sheet_preview_draw)); + split_sheet_preview->connect("gui_input", callable_mp(this, &SpriteFramesEditor::_sheet_preview_input)); splite_sheet_scroll = memnew(ScrollContainer); splite_sheet_scroll->set_enable_h_scroll(true); @@ -1083,7 +1060,7 @@ SpriteFramesEditor::SpriteFramesEditor() { file_split_sheet->set_title(TTR("Create Frames from Sprite Sheet")); file_split_sheet->set_mode(EditorFileDialog::MODE_OPEN_FILE); add_child(file_split_sheet); - file_split_sheet->connect_compat("file_selected", this, "_prepare_sprite_sheet"); + file_split_sheet->connect("file_selected", callable_mp(this, &SpriteFramesEditor::_prepare_sprite_sheet)); } void SpriteFramesEditorPlugin::edit(Object *p_object) { diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp index a9936658c3..a92194da17 100644 --- a/editor/plugins/style_box_editor_plugin.cpp +++ b/editor/plugins/style_box_editor_plugin.cpp @@ -54,11 +54,11 @@ void EditorInspectorPluginStyleBox::parse_end() { void StyleBoxPreview::edit(const Ref<StyleBox> &p_stylebox) { if (stylebox.is_valid()) - stylebox->disconnect_compat("changed", this, "_sb_changed"); + stylebox->disconnect("changed", callable_mp(this, &StyleBoxPreview::_sb_changed)); stylebox = p_stylebox; if (p_stylebox.is_valid()) { preview->add_style_override("panel", stylebox); - stylebox->connect_compat("changed", this, "_sb_changed"); + stylebox->connect("changed", callable_mp(this, &StyleBoxPreview::_sb_changed)); } _sb_changed(); } @@ -82,16 +82,13 @@ void StyleBoxPreview::_redraw() { } void StyleBoxPreview::_bind_methods() { - - ClassDB::bind_method("_sb_changed", &StyleBoxPreview::_sb_changed); - ClassDB::bind_method("_redraw", &StyleBoxPreview::_redraw); } StyleBoxPreview::StyleBoxPreview() { preview = memnew(Control); preview->set_custom_minimum_size(Size2(0, 150 * EDSCALE)); preview->set_clip_contents(true); - preview->connect_compat("draw", this, "_redraw"); + preview->connect("draw", callable_mp(this, &StyleBoxPreview::_redraw)); add_margin_child(TTR("Preview:"), preview); } diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index a8b6d74c1f..8d3788dea7 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -526,14 +526,6 @@ void TextEditor::_convert_case(CodeTextEditor::CaseStyle p_case) { } void TextEditor::_bind_methods() { - - ClassDB::bind_method("_validate_script", &TextEditor::_validate_script); - ClassDB::bind_method("_update_bookmark_list", &TextEditor::_update_bookmark_list); - ClassDB::bind_method("_bookmark_item_pressed", &TextEditor::_bookmark_item_pressed); - ClassDB::bind_method("_load_theme_settings", &TextEditor::_load_theme_settings); - ClassDB::bind_method("_edit_option", &TextEditor::_edit_option); - ClassDB::bind_method("_change_syntax_highlighter", &TextEditor::_change_syntax_highlighter); - ClassDB::bind_method("_text_edit_gui_input", &TextEditor::_text_edit_gui_input); } static ScriptEditorBase *create_editor(const RES &p_resource) { @@ -633,19 +625,19 @@ TextEditor::TextEditor() { code_editor = memnew(CodeTextEditor); add_child(code_editor); code_editor->add_constant_override("separation", 0); - code_editor->connect_compat("load_theme_settings", this, "_load_theme_settings"); - code_editor->connect_compat("validate_script", this, "_validate_script"); + code_editor->connect("load_theme_settings", callable_mp(this, &TextEditor::_load_theme_settings)); + code_editor->connect("validate_script", callable_mp(this, &TextEditor::_validate_script)); code_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE); code_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); update_settings(); code_editor->get_text_edit()->set_context_menu_enabled(false); - code_editor->get_text_edit()->connect_compat("gui_input", this, "_text_edit_gui_input"); + code_editor->get_text_edit()->connect("gui_input", callable_mp(this, &TextEditor::_text_edit_gui_input)); context_menu = memnew(PopupMenu); add_child(context_menu); - context_menu->connect_compat("id_pressed", this, "_edit_option"); + context_menu->connect("id_pressed", callable_mp(this, &TextEditor::_edit_option)); edit_hb = memnew(HBoxContainer); @@ -653,7 +645,7 @@ TextEditor::TextEditor() { edit_hb->add_child(search_menu); search_menu->set_text(TTR("Search")); search_menu->set_switch_on_hover(true); - search_menu->get_popup()->connect_compat("id_pressed", this, "_edit_option"); + search_menu->get_popup()->connect("id_pressed", callable_mp(this, &TextEditor::_edit_option)); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find"), SEARCH_FIND); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT); @@ -667,7 +659,7 @@ TextEditor::TextEditor() { edit_hb->add_child(edit_menu); edit_menu->set_text(TTR("Edit")); edit_menu->set_switch_on_hover(true); - edit_menu->get_popup()->connect_compat("id_pressed", this, "_edit_option"); + edit_menu->get_popup()->connect("id_pressed", callable_mp(this, &TextEditor::_edit_option)); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO); @@ -700,7 +692,7 @@ TextEditor::TextEditor() { convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_uppercase", TTR("Uppercase")), EDIT_TO_UPPERCASE); convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_lowercase", TTR("Lowercase")), EDIT_TO_LOWERCASE); convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize")), EDIT_CAPITALIZE); - convert_case->connect_compat("id_pressed", this, "_edit_option"); + convert_case->connect("id_pressed", callable_mp(this, &TextEditor::_edit_option)); highlighters["Standard"] = NULL; highlighter_menu = memnew(PopupMenu); @@ -708,13 +700,13 @@ TextEditor::TextEditor() { edit_menu->get_popup()->add_child(highlighter_menu); edit_menu->get_popup()->add_submenu_item(TTR("Syntax Highlighter"), "highlighter_menu"); highlighter_menu->add_radio_check_item(TTR("Standard")); - highlighter_menu->connect_compat("id_pressed", this, "_change_syntax_highlighter"); + highlighter_menu->connect("id_pressed", callable_mp(this, &TextEditor::_change_syntax_highlighter)); MenuButton *goto_menu = memnew(MenuButton); edit_hb->add_child(goto_menu); goto_menu->set_text(TTR("Go To")); goto_menu->set_switch_on_hover(true); - goto_menu->get_popup()->connect_compat("id_pressed", this, "_edit_option"); + goto_menu->get_popup()->connect("id_pressed", callable_mp(this, &TextEditor::_edit_option)); goto_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"), SEARCH_GOTO_LINE); goto_menu->get_popup()->add_separator(); @@ -724,8 +716,8 @@ TextEditor::TextEditor() { goto_menu->get_popup()->add_child(bookmarks_menu); goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "Bookmarks"); _update_bookmark_list(); - bookmarks_menu->connect_compat("about_to_show", this, "_update_bookmark_list"); - bookmarks_menu->connect_compat("index_pressed", this, "_bookmark_item_pressed"); + bookmarks_menu->connect("about_to_show", callable_mp(this, &TextEditor::_update_bookmark_list)); + bookmarks_menu->connect("index_pressed", callable_mp(this, &TextEditor::_bookmark_item_pressed)); goto_line_dialog = memnew(GotoLineDialog); add_child(goto_line_dialog); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 065833fd2b..2262e12f5d 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -778,21 +778,8 @@ void TextureRegionEditor::_node_removed(Object *p_obj) { void TextureRegionEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_edit_region"), &TextureRegionEditor::_edit_region); - ClassDB::bind_method(D_METHOD("_region_draw"), &TextureRegionEditor::_region_draw); - ClassDB::bind_method(D_METHOD("_region_input"), &TextureRegionEditor::_region_input); - ClassDB::bind_method(D_METHOD("_scroll_changed"), &TextureRegionEditor::_scroll_changed); ClassDB::bind_method(D_METHOD("_node_removed"), &TextureRegionEditor::_node_removed); - ClassDB::bind_method(D_METHOD("_set_snap_mode"), &TextureRegionEditor::_set_snap_mode); - ClassDB::bind_method(D_METHOD("_set_snap_off_x"), &TextureRegionEditor::_set_snap_off_x); - ClassDB::bind_method(D_METHOD("_set_snap_off_y"), &TextureRegionEditor::_set_snap_off_y); - ClassDB::bind_method(D_METHOD("_set_snap_step_x"), &TextureRegionEditor::_set_snap_step_x); - ClassDB::bind_method(D_METHOD("_set_snap_step_y"), &TextureRegionEditor::_set_snap_step_y); - ClassDB::bind_method(D_METHOD("_set_snap_sep_x"), &TextureRegionEditor::_set_snap_sep_x); - ClassDB::bind_method(D_METHOD("_set_snap_sep_y"), &TextureRegionEditor::_set_snap_sep_y); ClassDB::bind_method(D_METHOD("_zoom_on_position"), &TextureRegionEditor::_zoom_on_position); - ClassDB::bind_method(D_METHOD("_zoom_in"), &TextureRegionEditor::_zoom_in); - ClassDB::bind_method(D_METHOD("_zoom_reset"), &TextureRegionEditor::_zoom_reset); - ClassDB::bind_method(D_METHOD("_zoom_out"), &TextureRegionEditor::_zoom_out); ClassDB::bind_method(D_METHOD("_update_rect"), &TextureRegionEditor::_update_rect); } @@ -935,7 +922,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { snap_mode_button->add_item(TTR("Grid Snap"), 2); snap_mode_button->add_item(TTR("Auto Slice"), 3); snap_mode_button->select(0); - snap_mode_button->connect_compat("item_selected", this, "_set_snap_mode"); + snap_mode_button->connect("item_selected", callable_mp(this, &TextureRegionEditor::_set_snap_mode)); hb_grid = memnew(HBoxContainer); hb_tools->add_child(hb_grid); @@ -949,7 +936,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { sb_off_x->set_step(1); sb_off_x->set_value(snap_offset.x); sb_off_x->set_suffix("px"); - sb_off_x->connect_compat("value_changed", this, "_set_snap_off_x"); + sb_off_x->connect("value_changed", callable_mp(this, &TextureRegionEditor::_set_snap_off_x)); hb_grid->add_child(sb_off_x); sb_off_y = memnew(SpinBox); @@ -958,7 +945,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { sb_off_y->set_step(1); sb_off_y->set_value(snap_offset.y); sb_off_y->set_suffix("px"); - sb_off_y->connect_compat("value_changed", this, "_set_snap_off_y"); + sb_off_y->connect("value_changed", callable_mp(this, &TextureRegionEditor::_set_snap_off_y)); hb_grid->add_child(sb_off_y); hb_grid->add_child(memnew(VSeparator)); @@ -970,7 +957,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { sb_step_x->set_step(1); sb_step_x->set_value(snap_step.x); sb_step_x->set_suffix("px"); - sb_step_x->connect_compat("value_changed", this, "_set_snap_step_x"); + sb_step_x->connect("value_changed", callable_mp(this, &TextureRegionEditor::_set_snap_step_x)); hb_grid->add_child(sb_step_x); sb_step_y = memnew(SpinBox); @@ -979,7 +966,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { sb_step_y->set_step(1); sb_step_y->set_value(snap_step.y); sb_step_y->set_suffix("px"); - sb_step_y->connect_compat("value_changed", this, "_set_snap_step_y"); + sb_step_y->connect("value_changed", callable_mp(this, &TextureRegionEditor::_set_snap_step_y)); hb_grid->add_child(sb_step_y); hb_grid->add_child(memnew(VSeparator)); @@ -991,7 +978,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { sb_sep_x->set_step(1); sb_sep_x->set_value(snap_separation.x); sb_sep_x->set_suffix("px"); - sb_sep_x->connect_compat("value_changed", this, "_set_snap_sep_x"); + sb_sep_x->connect("value_changed", callable_mp(this, &TextureRegionEditor::_set_snap_sep_x)); hb_grid->add_child(sb_sep_x); sb_sep_y = memnew(SpinBox); @@ -1000,7 +987,7 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { sb_sep_y->set_step(1); sb_sep_y->set_value(snap_separation.y); sb_sep_y->set_suffix("px"); - sb_sep_y->connect_compat("value_changed", this, "_set_snap_sep_y"); + sb_sep_y->connect("value_changed", callable_mp(this, &TextureRegionEditor::_set_snap_sep_y)); hb_grid->add_child(sb_sep_y); hb_grid->hide(); @@ -1008,8 +995,8 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { edit_draw = memnew(Panel); add_child(edit_draw); edit_draw->set_v_size_flags(SIZE_EXPAND_FILL); - edit_draw->connect_compat("draw", this, "_region_draw"); - edit_draw->connect_compat("gui_input", this, "_region_input"); + edit_draw->connect("draw", callable_mp(this, &TextureRegionEditor::_region_draw)); + edit_draw->connect("gui_input", callable_mp(this, &TextureRegionEditor::_region_input)); draw_zoom = 1.0; edit_draw->set_clip_contents(true); @@ -1020,27 +1007,27 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { zoom_out = memnew(ToolButton); zoom_out->set_tooltip(TTR("Zoom Out")); - zoom_out->connect_compat("pressed", this, "_zoom_out"); + zoom_out->connect("pressed", callable_mp(this, &TextureRegionEditor::_zoom_out)); zoom_hb->add_child(zoom_out); zoom_reset = memnew(ToolButton); zoom_reset->set_tooltip(TTR("Zoom Reset")); - zoom_reset->connect_compat("pressed", this, "_zoom_reset"); + zoom_reset->connect("pressed", callable_mp(this, &TextureRegionEditor::_zoom_reset)); zoom_hb->add_child(zoom_reset); zoom_in = memnew(ToolButton); zoom_in->set_tooltip(TTR("Zoom In")); - zoom_in->connect_compat("pressed", this, "_zoom_in"); + zoom_in->connect("pressed", callable_mp(this, &TextureRegionEditor::_zoom_in)); zoom_hb->add_child(zoom_in); vscroll = memnew(VScrollBar); vscroll->set_step(0.001); edit_draw->add_child(vscroll); - vscroll->connect_compat("value_changed", this, "_scroll_changed"); + vscroll->connect("value_changed", callable_mp(this, &TextureRegionEditor::_scroll_changed)); hscroll = memnew(HScrollBar); hscroll->set_step(0.001); edit_draw->add_child(hscroll); - hscroll->connect_compat("value_changed", this, "_scroll_changed"); + hscroll->connect("value_changed", callable_mp(this, &TextureRegionEditor::_scroll_changed)); updating_scroll = false; } @@ -1115,7 +1102,6 @@ void TextureRegionEditorPlugin::set_state(const Dictionary &p_state) { } void TextureRegionEditorPlugin::_bind_methods() { - ClassDB::bind_method(D_METHOD("_editor_visiblity_changed"), &TextureRegionEditorPlugin::_editor_visiblity_changed); } TextureRegionEditorPlugin::TextureRegionEditorPlugin(EditorNode *p_node) { @@ -1125,7 +1111,7 @@ TextureRegionEditorPlugin::TextureRegionEditorPlugin(EditorNode *p_node) { region_editor = memnew(TextureRegionEditor(p_node)); region_editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE); region_editor->hide(); - region_editor->connect_compat("visibility_changed", this, "_editor_visiblity_changed"); + region_editor->connect("visibility_changed", callable_mp(this, &TextureRegionEditorPlugin::_editor_visiblity_changed)); texture_region_button = p_node->add_bottom_panel_item(TTR("TextureRegion"), region_editor); texture_region_button->hide(); diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 717c9adad3..d5b52e9711 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -598,13 +598,6 @@ void ThemeEditor::_notification(int p_what) { } void ThemeEditor::_bind_methods() { - - ClassDB::bind_method("_type_menu_cbk", &ThemeEditor::_type_menu_cbk); - ClassDB::bind_method("_name_menu_about_to_show", &ThemeEditor::_name_menu_about_to_show); - ClassDB::bind_method("_name_menu_cbk", &ThemeEditor::_name_menu_cbk); - ClassDB::bind_method("_theme_menu_cbk", &ThemeEditor::_theme_menu_cbk); - ClassDB::bind_method("_dialog_cbk", &ThemeEditor::_dialog_cbk); - ClassDB::bind_method("_save_template_cbk", &ThemeEditor::_save_template_cbk); } ThemeEditor::ThemeEditor() { @@ -629,7 +622,7 @@ ThemeEditor::ThemeEditor() { theme_menu->get_popup()->add_item(TTR("Create Empty Editor Template"), POPUP_CREATE_EDITOR_EMPTY); theme_menu->get_popup()->add_item(TTR("Create From Current Editor Theme"), POPUP_IMPORT_EDITOR_THEME); top_menu->add_child(theme_menu); - theme_menu->get_popup()->connect_compat("id_pressed", this, "_theme_menu_cbk"); + theme_menu->get_popup()->connect("id_pressed", callable_mp(this, &ThemeEditor::_theme_menu_cbk)); ScrollContainer *scroll = memnew(ScrollContainer); add_child(scroll); @@ -835,7 +828,7 @@ ThemeEditor::ThemeEditor() { type_menu->set_text(".."); type_hbc->add_child(type_menu); - type_menu->get_popup()->connect_compat("id_pressed", this, "_type_menu_cbk"); + type_menu->get_popup()->connect("id_pressed", callable_mp(this, &ThemeEditor::_type_menu_cbk)); l = memnew(Label); l->set_text(TTR("Name:")); @@ -853,8 +846,8 @@ ThemeEditor::ThemeEditor() { name_menu->set_text(".."); name_hbc->add_child(name_menu); - name_menu->get_popup()->connect_compat("about_to_show", this, "_name_menu_about_to_show"); - name_menu->get_popup()->connect_compat("id_pressed", this, "_name_menu_cbk"); + name_menu->get_popup()->connect("about_to_show", callable_mp(this, &ThemeEditor::_name_menu_about_to_show)); + name_menu->get_popup()->connect("id_pressed", callable_mp(this, &ThemeEditor::_name_menu_cbk)); type_select_label = memnew(Label); type_select_label->set_text(TTR("Data Type:")); @@ -869,12 +862,12 @@ ThemeEditor::ThemeEditor() { dialog_vbc->add_child(type_select); - add_del_dialog->get_ok()->connect_compat("pressed", this, "_dialog_cbk"); + add_del_dialog->get_ok()->connect("pressed", callable_mp(this, &ThemeEditor::_dialog_cbk)); file_dialog = memnew(EditorFileDialog); file_dialog->add_filter("*.theme ; " + TTR("Theme File")); add_child(file_dialog); - file_dialog->connect_compat("file_selected", this, "_save_template_cbk"); + file_dialog->connect("file_selected", callable_mp(this, &ThemeEditor::_save_template_cbk)); } void ThemeEditorPlugin::edit(Object *p_node) { diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 10d00b2a1d..82f04aaac4 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -1761,30 +1761,30 @@ void TileMapEditor::edit(Node *p_tile_map) { } if (node) - node->disconnect_compat("settings_changed", this, "_tileset_settings_changed"); + node->disconnect("settings_changed", callable_mp(this, &TileMapEditor::_tileset_settings_changed)); if (p_tile_map) { node = Object::cast_to<TileMap>(p_tile_map); - if (!canvas_item_editor_viewport->is_connected_compat("mouse_entered", this, "_canvas_mouse_enter")) - canvas_item_editor_viewport->connect_compat("mouse_entered", this, "_canvas_mouse_enter"); - if (!canvas_item_editor_viewport->is_connected_compat("mouse_exited", this, "_canvas_mouse_exit")) - canvas_item_editor_viewport->connect_compat("mouse_exited", this, "_canvas_mouse_exit"); + if (!canvas_item_editor_viewport->is_connected("mouse_entered", callable_mp(this, &TileMapEditor::_canvas_mouse_enter))) + canvas_item_editor_viewport->connect("mouse_entered", callable_mp(this, &TileMapEditor::_canvas_mouse_enter)); + if (!canvas_item_editor_viewport->is_connected("mouse_exited", callable_mp(this, &TileMapEditor::_canvas_mouse_exit))) + canvas_item_editor_viewport->connect("mouse_exited", callable_mp(this, &TileMapEditor::_canvas_mouse_exit)); _update_palette(); } else { node = NULL; - if (canvas_item_editor_viewport->is_connected_compat("mouse_entered", this, "_canvas_mouse_enter")) - canvas_item_editor_viewport->disconnect_compat("mouse_entered", this, "_canvas_mouse_enter"); - if (canvas_item_editor_viewport->is_connected_compat("mouse_exited", this, "_canvas_mouse_exit")) - canvas_item_editor_viewport->disconnect_compat("mouse_exited", this, "_canvas_mouse_exit"); + if (canvas_item_editor_viewport->is_connected("mouse_entered", callable_mp(this, &TileMapEditor::_canvas_mouse_enter))) + canvas_item_editor_viewport->disconnect("mouse_entered", callable_mp(this, &TileMapEditor::_canvas_mouse_enter)); + if (canvas_item_editor_viewport->is_connected("mouse_exited", callable_mp(this, &TileMapEditor::_canvas_mouse_exit))) + canvas_item_editor_viewport->disconnect("mouse_exited", callable_mp(this, &TileMapEditor::_canvas_mouse_exit)); _update_palette(); } if (node) - node->connect_compat("settings_changed", this, "_tileset_settings_changed"); + node->connect("settings_changed", callable_mp(this, &TileMapEditor::_tileset_settings_changed)); _clear_bucket_cache(); } @@ -1805,27 +1805,8 @@ void TileMapEditor::_icon_size_changed(float p_value) { void TileMapEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("_manual_toggled"), &TileMapEditor::_manual_toggled); - ClassDB::bind_method(D_METHOD("_priority_toggled"), &TileMapEditor::_priority_toggled); - ClassDB::bind_method(D_METHOD("_text_entered"), &TileMapEditor::_text_entered); - ClassDB::bind_method(D_METHOD("_text_changed"), &TileMapEditor::_text_changed); - ClassDB::bind_method(D_METHOD("_sbox_input"), &TileMapEditor::_sbox_input); - ClassDB::bind_method(D_METHOD("_button_tool_select"), &TileMapEditor::_button_tool_select); - ClassDB::bind_method(D_METHOD("_menu_option"), &TileMapEditor::_menu_option); - ClassDB::bind_method(D_METHOD("_canvas_mouse_enter"), &TileMapEditor::_canvas_mouse_enter); - ClassDB::bind_method(D_METHOD("_canvas_mouse_exit"), &TileMapEditor::_canvas_mouse_exit); - ClassDB::bind_method(D_METHOD("_tileset_settings_changed"), &TileMapEditor::_tileset_settings_changed); - ClassDB::bind_method(D_METHOD("_rotate"), &TileMapEditor::_rotate); - ClassDB::bind_method(D_METHOD("_flip_horizontal"), &TileMapEditor::_flip_horizontal); - ClassDB::bind_method(D_METHOD("_flip_vertical"), &TileMapEditor::_flip_vertical); - ClassDB::bind_method(D_METHOD("_clear_transform"), &TileMapEditor::_clear_transform); - ClassDB::bind_method(D_METHOD("_palette_selected"), &TileMapEditor::_palette_selected); - ClassDB::bind_method(D_METHOD("_palette_multi_selected"), &TileMapEditor::_palette_multi_selected); - ClassDB::bind_method(D_METHOD("_fill_points"), &TileMapEditor::_fill_points); ClassDB::bind_method(D_METHOD("_erase_points"), &TileMapEditor::_erase_points); - - ClassDB::bind_method(D_METHOD("_icon_size_changed"), &TileMapEditor::_icon_size_changed); } TileMapEditor::CellOp TileMapEditor::_get_op_from_cell(const Point2i &p_pos) { @@ -1939,20 +1920,20 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { manual_button = memnew(CheckBox); manual_button->set_text(TTR("Disable Autotile")); - manual_button->connect_compat("toggled", this, "_manual_toggled"); + manual_button->connect("toggled", callable_mp(this, &TileMapEditor::_manual_toggled)); add_child(manual_button); priority_button = memnew(CheckBox); priority_button->set_text(TTR("Enable Priority")); - priority_button->connect_compat("toggled", this, "_priority_toggled"); + priority_button->connect("toggled", callable_mp(this, &TileMapEditor::_priority_toggled)); add_child(priority_button); search_box = memnew(LineEdit); search_box->set_placeholder(TTR("Filter tiles")); search_box->set_h_size_flags(SIZE_EXPAND_FILL); - search_box->connect_compat("text_entered", this, "_text_entered"); - search_box->connect_compat("text_changed", this, "_text_changed"); - search_box->connect_compat("gui_input", this, "_sbox_input"); + search_box->connect("text_entered", callable_mp(this, &TileMapEditor::_text_entered)); + search_box->connect("text_changed", callable_mp(this, &TileMapEditor::_text_changed)); + search_box->connect("gui_input", callable_mp(this, &TileMapEditor::_sbox_input)); add_child(search_box); size_slider = memnew(HSlider); @@ -1961,7 +1942,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { size_slider->set_max(4.0f); size_slider->set_step(0.1f); size_slider->set_value(1.0f); - size_slider->connect_compat("value_changed", this, "_icon_size_changed"); + size_slider->connect("value_changed", callable_mp(this, &TileMapEditor::_icon_size_changed)); add_child(size_slider); int mw = EDITOR_DEF("editors/tile_map/palette_min_width", 80); @@ -1980,8 +1961,8 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { palette->set_max_text_lines(2); palette->set_select_mode(ItemList::SELECT_MULTI); palette->add_constant_override("vseparation", 8 * EDSCALE); - palette->connect_compat("item_selected", this, "_palette_selected"); - palette->connect_compat("multi_selected", this, "_palette_multi_selected"); + palette->connect("item_selected", callable_mp(this, &TileMapEditor::_palette_selected)); + palette->connect("multi_selected", callable_mp(this, &TileMapEditor::_palette_multi_selected)); palette_container->add_child(palette); // Add message for when no texture is selected. @@ -2015,25 +1996,25 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { paint_button = memnew(ToolButton); paint_button->set_shortcut(ED_SHORTCUT("tile_map_editor/paint_tile", TTR("Paint Tile"), KEY_P)); paint_button->set_tooltip(TTR("Shift+LMB: Line Draw\nShift+Ctrl+LMB: Rectangle Paint")); - paint_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_NONE)); + paint_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_NONE)); paint_button->set_toggle_mode(true); toolbar->add_child(paint_button); bucket_fill_button = memnew(ToolButton); bucket_fill_button->set_shortcut(ED_SHORTCUT("tile_map_editor/bucket_fill", TTR("Bucket Fill"), KEY_G)); - bucket_fill_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_BUCKET)); + bucket_fill_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_BUCKET)); bucket_fill_button->set_toggle_mode(true); toolbar->add_child(bucket_fill_button); picker_button = memnew(ToolButton); picker_button->set_shortcut(ED_SHORTCUT("tile_map_editor/pick_tile", TTR("Pick Tile"), KEY_I)); - picker_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_PICKING)); + picker_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_PICKING)); picker_button->set_toggle_mode(true); toolbar->add_child(picker_button); select_button = memnew(ToolButton); select_button->set_shortcut(ED_SHORTCUT("tile_map_editor/select", TTR("Select"), KEY_M)); - select_button->connect_compat("pressed", this, "_button_tool_select", make_binds(TOOL_SELECTING)); + select_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_SELECTING)); select_button->set_toggle_mode(true); toolbar->add_child(select_button); @@ -2068,40 +2049,40 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { p->add_shortcut(ED_GET_SHORTCUT("tile_map_editor/erase_selection"), OPTION_ERASE_SELECTION); p->add_separator(); p->add_item(TTR("Fix Invalid Tiles"), OPTION_FIX_INVALID); - p->connect_compat("id_pressed", this, "_menu_option"); + p->connect("id_pressed", callable_mp(this, &TileMapEditor::_menu_option)); rotate_left_button = memnew(ToolButton); rotate_left_button->set_tooltip(TTR("Rotate Left")); rotate_left_button->set_focus_mode(FOCUS_NONE); - rotate_left_button->connect_compat("pressed", this, "_rotate", varray(-1)); + rotate_left_button->connect("pressed", callable_mp(this, &TileMapEditor::_rotate), varray(-1)); rotate_left_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rotate_left", TTR("Rotate Left"), KEY_A)); tool_hb->add_child(rotate_left_button); rotate_right_button = memnew(ToolButton); rotate_right_button->set_tooltip(TTR("Rotate Right")); rotate_right_button->set_focus_mode(FOCUS_NONE); - rotate_right_button->connect_compat("pressed", this, "_rotate", varray(1)); + rotate_right_button->connect("pressed", callable_mp(this, &TileMapEditor::_rotate), varray(1)); rotate_right_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rotate_right", TTR("Rotate Right"), KEY_S)); tool_hb->add_child(rotate_right_button); flip_horizontal_button = memnew(ToolButton); flip_horizontal_button->set_tooltip(TTR("Flip Horizontally")); flip_horizontal_button->set_focus_mode(FOCUS_NONE); - flip_horizontal_button->connect_compat("pressed", this, "_flip_horizontal"); + flip_horizontal_button->connect("pressed", callable_mp(this, &TileMapEditor::_flip_horizontal)); flip_horizontal_button->set_shortcut(ED_SHORTCUT("tile_map_editor/flip_horizontal", TTR("Flip Horizontally"), KEY_X)); tool_hb->add_child(flip_horizontal_button); flip_vertical_button = memnew(ToolButton); flip_vertical_button->set_tooltip(TTR("Flip Vertically")); flip_vertical_button->set_focus_mode(FOCUS_NONE); - flip_vertical_button->connect_compat("pressed", this, "_flip_vertical"); + flip_vertical_button->connect("pressed", callable_mp(this, &TileMapEditor::_flip_vertical)); flip_vertical_button->set_shortcut(ED_SHORTCUT("tile_map_editor/flip_vertical", TTR("Flip Vertically"), KEY_Z)); tool_hb->add_child(flip_vertical_button); clear_transform_button = memnew(ToolButton); clear_transform_button->set_tooltip(TTR("Clear Transform")); clear_transform_button->set_focus_mode(FOCUS_NONE); - clear_transform_button->connect_compat("pressed", this, "_clear_transform"); + clear_transform_button->connect("pressed", callable_mp(this, &TileMapEditor::_clear_transform)); clear_transform_button->set_shortcut(ED_SHORTCUT("tile_map_editor/clear_transform", TTR("Clear Transform"), KEY_W)); tool_hb->add_child(clear_transform_button); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 0d5741d84a..c6747e4e48 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -260,27 +260,11 @@ void TileSetEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, C void TileSetEditor::_bind_methods() { ClassDB::bind_method("_undo_redo_import_scene", &TileSetEditor::_undo_redo_import_scene); - ClassDB::bind_method("_on_tileset_toolbar_button_pressed", &TileSetEditor::_on_tileset_toolbar_button_pressed); - ClassDB::bind_method("_on_textures_added", &TileSetEditor::_on_textures_added); - ClassDB::bind_method("_on_tileset_toolbar_confirm", &TileSetEditor::_on_tileset_toolbar_confirm); - ClassDB::bind_method("_on_texture_list_selected", &TileSetEditor::_on_texture_list_selected); - ClassDB::bind_method("_on_edit_mode_changed", &TileSetEditor::_on_edit_mode_changed); - ClassDB::bind_method("_on_workspace_mode_changed", &TileSetEditor::_on_workspace_mode_changed); - ClassDB::bind_method("_on_workspace_overlay_draw", &TileSetEditor::_on_workspace_overlay_draw); ClassDB::bind_method("_on_workspace_process", &TileSetEditor::_on_workspace_process); - ClassDB::bind_method("_on_workspace_draw", &TileSetEditor::_on_workspace_draw); - ClassDB::bind_method("_on_workspace_input", &TileSetEditor::_on_workspace_input); - ClassDB::bind_method("_on_tool_clicked", &TileSetEditor::_on_tool_clicked); - ClassDB::bind_method("_on_priority_changed", &TileSetEditor::_on_priority_changed); - ClassDB::bind_method("_on_z_index_changed", &TileSetEditor::_on_z_index_changed); - ClassDB::bind_method("_on_grid_snap_toggled", &TileSetEditor::_on_grid_snap_toggled); ClassDB::bind_method("_set_snap_step", &TileSetEditor::_set_snap_step); ClassDB::bind_method("_set_snap_off", &TileSetEditor::_set_snap_off); ClassDB::bind_method("_set_snap_sep", &TileSetEditor::_set_snap_sep); ClassDB::bind_method("_validate_current_tile_id", &TileSetEditor::_validate_current_tile_id); - ClassDB::bind_method("_zoom_in", &TileSetEditor::_zoom_in); - ClassDB::bind_method("_zoom_out", &TileSetEditor::_zoom_out); - ClassDB::bind_method("_zoom_reset", &TileSetEditor::_zoom_reset); ClassDB::bind_method("_select_edited_shape_coord", &TileSetEditor::_select_edited_shape_coord); ClassDB::bind_method("_sort_tiles", &TileSetEditor::_sort_tiles); @@ -358,19 +342,19 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { left_container->add_child(texture_list); texture_list->set_v_size_flags(SIZE_EXPAND_FILL); texture_list->set_custom_minimum_size(Size2(200, 0)); - texture_list->connect_compat("item_selected", this, "_on_texture_list_selected"); + texture_list->connect("item_selected", callable_mp(this, &TileSetEditor::_on_texture_list_selected)); texture_list->set_drag_forwarding(this); HBoxContainer *tileset_toolbar_container = memnew(HBoxContainer); left_container->add_child(tileset_toolbar_container); tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE] = memnew(ToolButton); - tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE]->connect_compat("pressed", this, "_on_tileset_toolbar_button_pressed", varray(TOOL_TILESET_ADD_TEXTURE)); + tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tileset_toolbar_button_pressed), varray(TOOL_TILESET_ADD_TEXTURE)); tileset_toolbar_container->add_child(tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE]); tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE]->set_tooltip(TTR("Add Texture(s) to TileSet.")); tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE] = memnew(ToolButton); - tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE]->connect_compat("pressed", this, "_on_tileset_toolbar_button_pressed", varray(TOOL_TILESET_REMOVE_TEXTURE)); + tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tileset_toolbar_button_pressed), varray(TOOL_TILESET_REMOVE_TEXTURE)); tileset_toolbar_container->add_child(tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE]); tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE]->set_tooltip(TTR("Remove selected Texture from TileSet.")); @@ -383,7 +367,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tileset_toolbar_tools->get_popup()->add_item(TTR("Create from Scene"), TOOL_TILESET_CREATE_SCENE); tileset_toolbar_tools->get_popup()->add_item(TTR("Merge from Scene"), TOOL_TILESET_MERGE_SCENE); - tileset_toolbar_tools->get_popup()->connect_compat("id_pressed", this, "_on_tileset_toolbar_button_pressed"); + tileset_toolbar_tools->get_popup()->connect("id_pressed", callable_mp(this, &TileSetEditor::_on_tileset_toolbar_button_pressed)); tileset_toolbar_container->add_child(tileset_toolbar_tools); //--------------- @@ -416,7 +400,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tool_workspacemode[i]->set_text(workspace_label[i]); tool_workspacemode[i]->set_toggle_mode(true); tool_workspacemode[i]->set_button_group(g); - tool_workspacemode[i]->connect_compat("pressed", this, "_on_workspace_mode_changed", varray(i)); + tool_workspacemode[i]->connect("pressed", callable_mp(this, &TileSetEditor::_on_workspace_mode_changed), varray(i)); tool_hb->add_child(tool_workspacemode[i]); } @@ -429,14 +413,14 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tool_hb->add_child(tools[SELECT_NEXT]); tool_hb->move_child(tools[SELECT_NEXT], WORKSPACE_CREATE_SINGLE); tools[SELECT_NEXT]->set_shortcut(ED_SHORTCUT("tileset_editor/next_shape", TTR("Next Coordinate"), KEY_PAGEDOWN)); - tools[SELECT_NEXT]->connect_compat("pressed", this, "_on_tool_clicked", varray(SELECT_NEXT)); + tools[SELECT_NEXT]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(SELECT_NEXT)); tools[SELECT_NEXT]->set_tooltip(TTR("Select the next shape, subtile, or Tile.")); tools[SELECT_PREVIOUS] = memnew(ToolButton); tool_hb->add_child(tools[SELECT_PREVIOUS]); tool_hb->move_child(tools[SELECT_PREVIOUS], WORKSPACE_CREATE_SINGLE); tools[SELECT_PREVIOUS]->set_shortcut(ED_SHORTCUT("tileset_editor/previous_shape", TTR("Previous Coordinate"), KEY_PAGEUP)); tools[SELECT_PREVIOUS]->set_tooltip(TTR("Select the previous shape, subtile, or Tile.")); - tools[SELECT_PREVIOUS]->connect_compat("pressed", this, "_on_tool_clicked", varray(SELECT_PREVIOUS)); + tools[SELECT_PREVIOUS]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(SELECT_PREVIOUS)); VSeparator *separator_shape_selection = memnew(VSeparator); tool_hb->add_child(separator_shape_selection); @@ -466,7 +450,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tool_editmode[i]->set_text(label[i]); tool_editmode[i]->set_toggle_mode(true); tool_editmode[i]->set_button_group(g); - tool_editmode[i]->connect_compat("pressed", this, "_on_edit_mode_changed", varray(i)); + tool_editmode[i]->connect("pressed", callable_mp(this, &TileSetEditor::_on_edit_mode_changed), varray(i)); tool_hb->add_child(tool_editmode[i]); } tool_editmode[EDITMODE_COLLISION]->set_pressed(true); @@ -493,21 +477,21 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tools[TOOL_SELECT]->set_toggle_mode(true); tools[TOOL_SELECT]->set_button_group(tg); tools[TOOL_SELECT]->set_pressed(true); - tools[TOOL_SELECT]->connect_compat("pressed", this, "_on_tool_clicked", varray(TOOL_SELECT)); + tools[TOOL_SELECT]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(TOOL_SELECT)); separator_bitmask = memnew(VSeparator); toolbar->add_child(separator_bitmask); tools[BITMASK_COPY] = memnew(ToolButton); tools[BITMASK_COPY]->set_tooltip(TTR("Copy bitmask.")); - tools[BITMASK_COPY]->connect_compat("pressed", this, "_on_tool_clicked", varray(BITMASK_COPY)); + tools[BITMASK_COPY]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(BITMASK_COPY)); toolbar->add_child(tools[BITMASK_COPY]); tools[BITMASK_PASTE] = memnew(ToolButton); tools[BITMASK_PASTE]->set_tooltip(TTR("Paste bitmask.")); - tools[BITMASK_PASTE]->connect_compat("pressed", this, "_on_tool_clicked", varray(BITMASK_PASTE)); + tools[BITMASK_PASTE]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(BITMASK_PASTE)); toolbar->add_child(tools[BITMASK_PASTE]); tools[BITMASK_CLEAR] = memnew(ToolButton); tools[BITMASK_CLEAR]->set_tooltip(TTR("Erase bitmask.")); - tools[BITMASK_CLEAR]->connect_compat("pressed", this, "_on_tool_clicked", varray(BITMASK_CLEAR)); + tools[BITMASK_CLEAR]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(BITMASK_CLEAR)); toolbar->add_child(tools[BITMASK_CLEAR]); tools[SHAPE_NEW_RECTANGLE] = memnew(ToolButton); @@ -525,13 +509,13 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { separator_shape_toggle = memnew(VSeparator); toolbar->add_child(separator_shape_toggle); tools[SHAPE_TOGGLE_TYPE] = memnew(ToolButton); - tools[SHAPE_TOGGLE_TYPE]->connect_compat("pressed", this, "_on_tool_clicked", varray(SHAPE_TOGGLE_TYPE)); + tools[SHAPE_TOGGLE_TYPE]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(SHAPE_TOGGLE_TYPE)); toolbar->add_child(tools[SHAPE_TOGGLE_TYPE]); separator_delete = memnew(VSeparator); toolbar->add_child(separator_delete); tools[SHAPE_DELETE] = memnew(ToolButton); - tools[SHAPE_DELETE]->connect_compat("pressed", this, "_on_tool_clicked", varray(SHAPE_DELETE)); + tools[SHAPE_DELETE]->connect("pressed", callable_mp(this, &TileSetEditor::_on_tool_clicked), varray(SHAPE_DELETE)); toolbar->add_child(tools[SHAPE_DELETE]); spin_priority = memnew(SpinBox); @@ -539,7 +523,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { spin_priority->set_max(255); spin_priority->set_step(1); spin_priority->set_custom_minimum_size(Size2(100, 0)); - spin_priority->connect_compat("value_changed", this, "_on_priority_changed"); + spin_priority->connect("value_changed", callable_mp(this, &TileSetEditor::_on_priority_changed)); spin_priority->hide(); toolbar->add_child(spin_priority); @@ -548,7 +532,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { spin_z_index->set_max(VS::CANVAS_ITEM_Z_MAX); spin_z_index->set_step(1); spin_z_index->set_custom_minimum_size(Size2(100, 0)); - spin_z_index->connect_compat("value_changed", this, "_on_z_index_changed"); + spin_z_index->connect("value_changed", callable_mp(this, &TileSetEditor::_on_z_index_changed)); spin_z_index->hide(); toolbar->add_child(spin_z_index); @@ -562,7 +546,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tools[TOOL_GRID_SNAP] = memnew(ToolButton); tools[TOOL_GRID_SNAP]->set_toggle_mode(true); tools[TOOL_GRID_SNAP]->set_tooltip(TTR("Enable snap and show grid (configurable via the Inspector).")); - tools[TOOL_GRID_SNAP]->connect_compat("toggled", this, "_on_grid_snap_toggled"); + tools[TOOL_GRID_SNAP]->connect("toggled", callable_mp(this, &TileSetEditor::_on_grid_snap_toggled)); toolbar->add_child(tools[TOOL_GRID_SNAP]); Control *separator = memnew(Control); @@ -570,15 +554,15 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { toolbar->add_child(separator); tools[ZOOM_OUT] = memnew(ToolButton); - tools[ZOOM_OUT]->connect_compat("pressed", this, "_zoom_out"); + tools[ZOOM_OUT]->connect("pressed", callable_mp(this, &TileSetEditor::_zoom_out)); toolbar->add_child(tools[ZOOM_OUT]); tools[ZOOM_OUT]->set_tooltip(TTR("Zoom Out")); tools[ZOOM_1] = memnew(ToolButton); - tools[ZOOM_1]->connect_compat("pressed", this, "_zoom_reset"); + tools[ZOOM_1]->connect("pressed", callable_mp(this, &TileSetEditor::_zoom_reset)); toolbar->add_child(tools[ZOOM_1]); tools[ZOOM_1]->set_tooltip(TTR("Zoom Reset")); tools[ZOOM_IN] = memnew(ToolButton); - tools[ZOOM_IN]->connect_compat("pressed", this, "_zoom_in"); + tools[ZOOM_IN]->connect("pressed", callable_mp(this, &TileSetEditor::_zoom_in)); toolbar->add_child(tools[ZOOM_IN]); tools[ZOOM_IN]->set_tooltip(TTR("Zoom In")); @@ -607,13 +591,13 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { scroll->add_child(workspace_container); workspace_overlay = memnew(Control); - workspace_overlay->connect_compat("draw", this, "_on_workspace_overlay_draw"); + workspace_overlay->connect("draw", callable_mp(this, &TileSetEditor::_on_workspace_overlay_draw)); workspace_container->add_child(workspace_overlay); workspace = memnew(Control); workspace->set_focus_mode(FOCUS_ALL); - workspace->connect_compat("draw", this, "_on_workspace_draw"); - workspace->connect_compat("gui_input", this, "_on_workspace_input"); + workspace->connect("draw", callable_mp(this, &TileSetEditor::_on_workspace_draw)); + workspace->connect("gui_input", callable_mp(this, &TileSetEditor::_on_workspace_input)); workspace->set_draw_behind_parent(true); workspace_overlay->add_child(workspace); @@ -626,7 +610,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { //--------------- cd = memnew(ConfirmationDialog); add_child(cd); - cd->connect_compat("confirmed", this, "_on_tileset_toolbar_confirm"); + cd->connect("confirmed", callable_mp(this, &TileSetEditor::_on_tileset_toolbar_confirm)); //--------------- err_dialog = memnew(AcceptDialog); @@ -645,7 +629,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { texture_dialog->add_filter("*." + E->get() + " ; " + E->get().to_upper()); } add_child(texture_dialog); - texture_dialog->connect_compat("files_selected", this, "_on_textures_added"); + texture_dialog->connect("files_selected", callable_mp(this, &TileSetEditor::_on_textures_added)); //--------------- helper = memnew(TilesetEditorContext(this)); diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index cfa10488ab..da80eee253 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -39,14 +39,6 @@ VersionControlEditorPlugin *VersionControlEditorPlugin::singleton = NULL; void VersionControlEditorPlugin::_bind_methods() { - ClassDB::bind_method(D_METHOD("_selected_a_vcs"), &VersionControlEditorPlugin::_selected_a_vcs); - ClassDB::bind_method(D_METHOD("_initialize_vcs"), &VersionControlEditorPlugin::_initialize_vcs); - ClassDB::bind_method(D_METHOD("_send_commit_msg"), &VersionControlEditorPlugin::_send_commit_msg); - ClassDB::bind_method(D_METHOD("_refresh_stage_area"), &VersionControlEditorPlugin::_refresh_stage_area); - ClassDB::bind_method(D_METHOD("_stage_all"), &VersionControlEditorPlugin::_stage_all); - ClassDB::bind_method(D_METHOD("_stage_selected"), &VersionControlEditorPlugin::_stage_selected); - ClassDB::bind_method(D_METHOD("_view_file_diff"), &VersionControlEditorPlugin::_view_file_diff); - ClassDB::bind_method(D_METHOD("_refresh_file_diff"), &VersionControlEditorPlugin::_refresh_file_diff); ClassDB::bind_method(D_METHOD("popup_vcs_set_up_dialog"), &VersionControlEditorPlugin::popup_vcs_set_up_dialog); // Used to track the status of files in the staging area @@ -127,7 +119,7 @@ void VersionControlEditorPlugin::_initialize_vcs() { vcs_interface->set_script_and_instance(script, addon_script_instance); EditorVCSInterface::set_singleton(vcs_interface); - EditorFileSystem::get_singleton()->connect_compat("filesystem_changed", this, "_refresh_stage_area"); + EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &VersionControlEditorPlugin::_refresh_stage_area)); String res_dir = OS::get_singleton()->get_resource_dir(); @@ -388,8 +380,8 @@ void VersionControlEditorPlugin::clear_stage_area() { void VersionControlEditorPlugin::shut_down() { if (EditorVCSInterface::get_singleton()) { - if (EditorFileSystem::get_singleton()->is_connected_compat("filesystem_changed", this, "_refresh_stage_area")) { - EditorFileSystem::get_singleton()->disconnect_compat("filesystem_changed", this, "_refresh_stage_area"); + if (EditorFileSystem::get_singleton()->is_connected("filesystem_changed", callable_mp(this, &VersionControlEditorPlugin::_refresh_stage_area))) { + EditorFileSystem::get_singleton()->disconnect("filesystem_changed", callable_mp(this, &VersionControlEditorPlugin::_refresh_stage_area)); } EditorVCSInterface::get_singleton()->shut_down(); memdelete(EditorVCSInterface::get_singleton()); @@ -444,14 +436,14 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { set_up_choice = memnew(OptionButton); set_up_choice->set_h_size_flags(HBoxContainer::SIZE_EXPAND_FILL); - set_up_choice->connect_compat("item_selected", this, "_selected_a_vcs"); + set_up_choice->connect("item_selected", callable_mp(this, &VersionControlEditorPlugin::_selected_a_vcs)); set_up_hbc->add_child(set_up_choice); set_up_init_settings = NULL; set_up_init_button = memnew(Button); set_up_init_button->set_text(TTR("Initialize")); - set_up_init_button->connect_compat("pressed", this, "_initialize_vcs"); + set_up_init_button->connect("pressed", callable_mp(this, &VersionControlEditorPlugin::_initialize_vcs)); set_up_vbc->add_child(set_up_init_button); version_control_actions->set_v_size_flags(PopupMenu::SIZE_EXPAND_FILL); @@ -479,7 +471,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { refresh_button->set_tooltip(TTR("Detect new changes")); refresh_button->set_text(TTR("Refresh")); refresh_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Reload", "EditorIcons")); - refresh_button->connect_compat("pressed", this, "_refresh_stage_area"); + refresh_button->connect("pressed", callable_mp(this, &VersionControlEditorPlugin::_refresh_stage_area)); stage_tools->add_child(refresh_button); stage_files = memnew(Tree); @@ -492,7 +484,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { stage_files->set_allow_rmb_select(true); stage_files->set_select_mode(Tree::SelectMode::SELECT_MULTI); stage_files->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true); - stage_files->connect_compat("cell_selected", this, "_view_file_diff"); + stage_files->connect("cell_selected", callable_mp(this, &VersionControlEditorPlugin::_view_file_diff)); stage_files->create_item(); stage_files->set_hide_root(true); commit_box_vbc->add_child(stage_files); @@ -516,12 +508,12 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { stage_selected_button = memnew(Button); stage_selected_button->set_h_size_flags(Button::SIZE_EXPAND_FILL); stage_selected_button->set_text(TTR("Stage Selected")); - stage_selected_button->connect_compat("pressed", this, "_stage_selected"); + stage_selected_button->connect("pressed", callable_mp(this, &VersionControlEditorPlugin::_stage_selected)); stage_buttons->add_child(stage_selected_button); stage_all_button = memnew(Button); stage_all_button->set_text(TTR("Stage All")); - stage_all_button->connect_compat("pressed", this, "_stage_all"); + stage_all_button->connect("pressed", callable_mp(this, &VersionControlEditorPlugin::_stage_all)); stage_buttons->add_child(stage_all_button); commit_box_vbc->add_child(memnew(HSeparator)); @@ -537,7 +529,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { commit_button = memnew(Button); commit_button->set_text(TTR("Commit Changes")); - commit_button->connect_compat("pressed", this, "_send_commit_msg"); + commit_button->connect("pressed", callable_mp(this, &VersionControlEditorPlugin::_send_commit_msg)); commit_box_vbc->add_child(commit_button); commit_status = memnew(Label); @@ -571,7 +563,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { diff_refresh_button = memnew(Button); diff_refresh_button->set_tooltip(TTR("Detect changes in file diff")); diff_refresh_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Reload", "EditorIcons")); - diff_refresh_button->connect_compat("pressed", this, "_refresh_file_diff"); + diff_refresh_button->connect("pressed", callable_mp(this, &VersionControlEditorPlugin::_refresh_file_diff)); diff_hbc->add_child(diff_refresh_button); diff = memnew(RichTextLabel); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 2fb23f6a84..1f400974b6 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -73,8 +73,8 @@ void VisualShaderEditor::edit(VisualShader *p_visual_shader) { } } visual_shader = Ref<VisualShader>(p_visual_shader); - if (!visual_shader->is_connected_compat("changed", this, "_update_preview")) { - visual_shader->connect_compat("changed", this, "_update_preview"); + if (!visual_shader->is_connected("changed", callable_mp(this, &VisualShaderEditor::_update_preview))) { + visual_shader->connect("changed", callable_mp(this, &VisualShaderEditor::_update_preview)); } #ifndef DISABLE_DEPRECATED String version = VERSION_BRANCH; @@ -86,7 +86,7 @@ void VisualShaderEditor::edit(VisualShader *p_visual_shader) { } else { if (visual_shader.is_valid()) { if (visual_shader->is_connected_compat("changed", this, "")) { - visual_shader->disconnect_compat("changed", this, "_update_preview"); + visual_shader->disconnect("changed", callable_mp(this, &VisualShaderEditor::_update_preview)); } } visual_shader.unref(); @@ -517,7 +517,7 @@ void VisualShaderEditor::_update_graph() { size = group_node->get_size(); node->set_resizable(true); - node->connect_compat("resize_request", this, "_node_resized", varray((int)type, nodes[n_i])); + node->connect("resize_request", callable_mp(this, &VisualShaderEditor::_node_resized), varray((int)type, nodes[n_i])); } if (is_expression) { expression = expression_node->get_expression(); @@ -534,10 +534,10 @@ void VisualShaderEditor::_update_graph() { if (nodes[n_i] >= 2) { node->set_show_close_button(true); - node->connect_compat("close_request", this, "_delete_request", varray(nodes[n_i]), CONNECT_DEFERRED); + node->connect("close_request", callable_mp(this, &VisualShaderEditor::_delete_request), varray(nodes[n_i]), CONNECT_DEFERRED); } - node->connect_compat("dragged", this, "_node_dragged", varray(nodes[n_i])); + node->connect("dragged", callable_mp(this, &VisualShaderEditor::_node_dragged), varray(nodes[n_i])); Control *custom_editor = NULL; int port_offset = 0; @@ -556,8 +556,8 @@ void VisualShaderEditor::_update_graph() { LineEdit *uniform_name = memnew(LineEdit); uniform_name->set_text(uniform->get_uniform_name()); node->add_child(uniform_name); - uniform_name->connect_compat("text_entered", this, "_line_edit_changed", varray(uniform_name, nodes[n_i])); - uniform_name->connect_compat("focus_exited", this, "_line_edit_focus_out", varray(uniform_name, nodes[n_i])); + uniform_name->connect("text_entered", callable_mp(this, &VisualShaderEditor::_line_edit_changed), varray(uniform_name, nodes[n_i])); + uniform_name->connect("focus_exited", callable_mp(this, &VisualShaderEditor::_line_edit_focus_out), varray(uniform_name, nodes[n_i])); if (vsnode->get_input_port_count() == 0 && vsnode->get_output_port_count() == 1 && vsnode->get_output_port_name(0) == "") { //shortcut @@ -601,14 +601,14 @@ void VisualShaderEditor::_update_graph() { Button *add_input_btn = memnew(Button); add_input_btn->set_text(TTR("Add Input")); - add_input_btn->connect_compat("pressed", this, "_add_input_port", varray(nodes[n_i], group_node->get_free_input_port_id(), VisualShaderNode::PORT_TYPE_VECTOR, "input" + itos(group_node->get_free_input_port_id())), CONNECT_DEFERRED); + add_input_btn->connect("pressed", callable_mp(this, &VisualShaderEditor::_add_input_port), varray(nodes[n_i], group_node->get_free_input_port_id(), VisualShaderNode::PORT_TYPE_VECTOR, "input" + itos(group_node->get_free_input_port_id())), CONNECT_DEFERRED); hb2->add_child(add_input_btn); hb2->add_spacer(); Button *add_output_btn = memnew(Button); add_output_btn->set_text(TTR("Add Output")); - add_output_btn->connect_compat("pressed", this, "_add_output_port", varray(nodes[n_i], group_node->get_free_output_port_id(), VisualShaderNode::PORT_TYPE_VECTOR, "output" + itos(group_node->get_free_output_port_id())), CONNECT_DEFERRED); + add_output_btn->connect("pressed", callable_mp(this, &VisualShaderEditor::_add_output_port), varray(nodes[n_i], group_node->get_free_output_port_id(), VisualShaderNode::PORT_TYPE_VECTOR, "output" + itos(group_node->get_free_output_port_id())), CONNECT_DEFERRED); hb2->add_child(add_output_btn); node->add_child(hb2); @@ -656,7 +656,7 @@ void VisualShaderEditor::_update_graph() { if (default_value.get_type() != Variant::NIL) { // only a label Button *button = memnew(Button); hb->add_child(button); - button->connect_compat("pressed", this, "_edit_port_default_input", varray(button, nodes[n_i], i)); + button->connect("pressed", callable_mp(this, &VisualShaderEditor::_edit_port_default_input), varray(button, nodes[n_i], i)); switch (default_value.get_type()) { @@ -698,20 +698,20 @@ void VisualShaderEditor::_update_graph() { type_box->add_item(TTR("Sampler")); type_box->select(group_node->get_input_port_type(i)); type_box->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); - type_box->connect_compat("item_selected", this, "_change_input_port_type", varray(nodes[n_i], i), CONNECT_DEFERRED); + type_box->connect("item_selected", callable_mp(this, &VisualShaderEditor::_change_input_port_type), varray(nodes[n_i], i), CONNECT_DEFERRED); LineEdit *name_box = memnew(LineEdit); hb->add_child(name_box); name_box->set_custom_minimum_size(Size2(65 * EDSCALE, 0)); name_box->set_h_size_flags(SIZE_EXPAND_FILL); name_box->set_text(name_left); - name_box->connect_compat("text_entered", this, "_change_input_port_name", varray(name_box, nodes[n_i], i)); - name_box->connect_compat("focus_exited", this, "_port_name_focus_out", varray(name_box, nodes[n_i], i, false)); + name_box->connect("text_entered", callable_mp(this, &VisualShaderEditor::_change_input_port_name), varray(name_box, nodes[n_i], i)); + name_box->connect("focus_exited", callable_mp(this, &VisualShaderEditor::_port_name_focus_out), varray(name_box, nodes[n_i], i, false)); Button *remove_btn = memnew(Button); remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons")); remove_btn->set_tooltip(TTR("Remove") + " " + name_left); - remove_btn->connect_compat("pressed", this, "_remove_input_port", varray(nodes[n_i], i), CONNECT_DEFERRED); + remove_btn->connect("pressed", callable_mp(this, &VisualShaderEditor::_remove_input_port), varray(nodes[n_i], i), CONNECT_DEFERRED); hb->add_child(remove_btn); } else { @@ -740,7 +740,7 @@ void VisualShaderEditor::_update_graph() { Button *remove_btn = memnew(Button); remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons")); remove_btn->set_tooltip(TTR("Remove") + " " + name_left); - remove_btn->connect_compat("pressed", this, "_remove_output_port", varray(nodes[n_i], i), CONNECT_DEFERRED); + remove_btn->connect("pressed", callable_mp(this, &VisualShaderEditor::_remove_output_port), varray(nodes[n_i], i), CONNECT_DEFERRED); hb->add_child(remove_btn); LineEdit *name_box = memnew(LineEdit); @@ -748,8 +748,8 @@ void VisualShaderEditor::_update_graph() { name_box->set_custom_minimum_size(Size2(65 * EDSCALE, 0)); name_box->set_h_size_flags(SIZE_EXPAND_FILL); name_box->set_text(name_right); - name_box->connect_compat("text_entered", this, "_change_output_port_name", varray(name_box, nodes[n_i], i)); - name_box->connect_compat("focus_exited", this, "_port_name_focus_out", varray(name_box, nodes[n_i], i, true)); + name_box->connect("text_entered", callable_mp(this, &VisualShaderEditor::_change_output_port_name), varray(name_box, nodes[n_i], i)); + name_box->connect("focus_exited", callable_mp(this, &VisualShaderEditor::_port_name_focus_out), varray(name_box, nodes[n_i], i, true)); OptionButton *type_box = memnew(OptionButton); hb->add_child(type_box); @@ -760,7 +760,7 @@ void VisualShaderEditor::_update_graph() { type_box->add_item(TTR("Transform")); type_box->select(group_node->get_output_port_type(i)); type_box->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); - type_box->connect_compat("item_selected", this, "_change_output_port_type", varray(nodes[n_i], i), CONNECT_DEFERRED); + type_box->connect("item_selected", callable_mp(this, &VisualShaderEditor::_change_output_port_type), varray(nodes[n_i], i), CONNECT_DEFERRED); } else { Label *label = memnew(Label); label->set_text(name_right); @@ -781,7 +781,7 @@ void VisualShaderEditor::_update_graph() { preview->set_pressed(true); } - preview->connect_compat("pressed", this, "_preview_select_port", varray(nodes[n_i], i), CONNECT_DEFERRED); + preview->connect("pressed", callable_mp(this, &VisualShaderEditor::_preview_select_port), varray(nodes[n_i], i), CONNECT_DEFERRED); hb->add_child(preview); } @@ -854,7 +854,7 @@ void VisualShaderEditor::_update_graph() { expression_box->set_context_menu_enabled(false); expression_box->set_show_line_numbers(true); - expression_box->connect_compat("focus_exited", this, "_expression_focus_out", varray(expression_box, nodes[n_i])); + expression_box->connect("focus_exited", callable_mp(this, &VisualShaderEditor::_expression_focus_out), varray(expression_box, nodes[n_i])); } if (!uniform.is_valid()) { @@ -2288,59 +2288,17 @@ void VisualShaderEditor::_bind_methods() { ClassDB::bind_method("_rebuild", &VisualShaderEditor::_rebuild); ClassDB::bind_method("_update_graph", &VisualShaderEditor::_update_graph); ClassDB::bind_method("_update_options_menu", &VisualShaderEditor::_update_options_menu); - ClassDB::bind_method("_expression_focus_out", &VisualShaderEditor::_expression_focus_out); ClassDB::bind_method("_add_node", &VisualShaderEditor::_add_node); - ClassDB::bind_method("_node_dragged", &VisualShaderEditor::_node_dragged); - ClassDB::bind_method("_connection_request", &VisualShaderEditor::_connection_request); - ClassDB::bind_method("_disconnection_request", &VisualShaderEditor::_disconnection_request); - ClassDB::bind_method("_node_selected", &VisualShaderEditor::_node_selected); - ClassDB::bind_method("_scroll_changed", &VisualShaderEditor::_scroll_changed); - ClassDB::bind_method("_delete_request", &VisualShaderEditor::_delete_request); - ClassDB::bind_method("_delete_nodes", &VisualShaderEditor::_delete_nodes); ClassDB::bind_method("_node_changed", &VisualShaderEditor::_node_changed); - ClassDB::bind_method("_edit_port_default_input", &VisualShaderEditor::_edit_port_default_input); - ClassDB::bind_method("_port_edited", &VisualShaderEditor::_port_edited); - ClassDB::bind_method("_connection_to_empty", &VisualShaderEditor::_connection_to_empty); - ClassDB::bind_method("_connection_from_empty", &VisualShaderEditor::_connection_from_empty); - ClassDB::bind_method("_line_edit_focus_out", &VisualShaderEditor::_line_edit_focus_out); - ClassDB::bind_method("_line_edit_changed", &VisualShaderEditor::_line_edit_changed); - ClassDB::bind_method("_port_name_focus_out", &VisualShaderEditor::_port_name_focus_out); - ClassDB::bind_method("_duplicate_nodes", &VisualShaderEditor::_duplicate_nodes); - ClassDB::bind_method("_copy_nodes", &VisualShaderEditor::_copy_nodes); - ClassDB::bind_method("_paste_nodes", &VisualShaderEditor::_paste_nodes); - ClassDB::bind_method("_mode_selected", &VisualShaderEditor::_mode_selected); ClassDB::bind_method("_input_select_item", &VisualShaderEditor::_input_select_item); - ClassDB::bind_method("_preview_select_port", &VisualShaderEditor::_preview_select_port); - ClassDB::bind_method("_graph_gui_input", &VisualShaderEditor::_graph_gui_input); - ClassDB::bind_method("_add_input_port", &VisualShaderEditor::_add_input_port); - ClassDB::bind_method("_change_input_port_type", &VisualShaderEditor::_change_input_port_type); - ClassDB::bind_method("_change_input_port_name", &VisualShaderEditor::_change_input_port_name); - ClassDB::bind_method("_remove_input_port", &VisualShaderEditor::_remove_input_port); - ClassDB::bind_method("_add_output_port", &VisualShaderEditor::_add_output_port); - ClassDB::bind_method("_change_output_port_type", &VisualShaderEditor::_change_output_port_type); - ClassDB::bind_method("_change_output_port_name", &VisualShaderEditor::_change_output_port_name); - ClassDB::bind_method("_remove_output_port", &VisualShaderEditor::_remove_output_port); - ClassDB::bind_method("_node_resized", &VisualShaderEditor::_node_resized); ClassDB::bind_method("_set_node_size", &VisualShaderEditor::_set_node_size); ClassDB::bind_method("_clear_buffer", &VisualShaderEditor::_clear_buffer); - ClassDB::bind_method("_show_preview_text", &VisualShaderEditor::_show_preview_text); - ClassDB::bind_method("_update_preview", &VisualShaderEditor::_update_preview); ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &VisualShaderEditor::get_drag_data_fw); ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &VisualShaderEditor::can_drop_data_fw); ClassDB::bind_method(D_METHOD("drop_data_fw"), &VisualShaderEditor::drop_data_fw); ClassDB::bind_method("_is_available", &VisualShaderEditor::_is_available); - ClassDB::bind_method("_tools_menu_option", &VisualShaderEditor::_tools_menu_option); - ClassDB::bind_method("_show_members_dialog", &VisualShaderEditor::_show_members_dialog); - ClassDB::bind_method("_sbox_input", &VisualShaderEditor::_sbox_input); - ClassDB::bind_method("_member_filter_changed", &VisualShaderEditor::_member_filter_changed); - ClassDB::bind_method("_member_selected", &VisualShaderEditor::_member_selected); - ClassDB::bind_method("_member_unselected", &VisualShaderEditor::_member_unselected); - ClassDB::bind_method("_member_create", &VisualShaderEditor::_member_create); - ClassDB::bind_method("_member_cancel", &VisualShaderEditor::_member_cancel); - - ClassDB::bind_method("_node_menu_id_pressed", &VisualShaderEditor::_node_menu_id_pressed); } VisualShaderEditor *VisualShaderEditor::singleton = NULL; @@ -2381,17 +2339,17 @@ VisualShaderEditor::VisualShaderEditor() { graph->add_valid_right_disconnect_type(VisualShaderNode::PORT_TYPE_SAMPLER); //graph->add_valid_left_disconnect_type(0); graph->set_v_size_flags(SIZE_EXPAND_FILL); - graph->connect_compat("connection_request", this, "_connection_request", varray(), CONNECT_DEFERRED); - graph->connect_compat("disconnection_request", this, "_disconnection_request", varray(), CONNECT_DEFERRED); - graph->connect_compat("node_selected", this, "_node_selected"); - graph->connect_compat("scroll_offset_changed", this, "_scroll_changed"); - graph->connect_compat("duplicate_nodes_request", this, "_duplicate_nodes"); - graph->connect_compat("copy_nodes_request", this, "_copy_nodes"); - graph->connect_compat("paste_nodes_request", this, "_paste_nodes"); - graph->connect_compat("delete_nodes_request", this, "_delete_nodes"); - graph->connect_compat("gui_input", this, "_graph_gui_input"); - graph->connect_compat("connection_to_empty", this, "_connection_to_empty"); - graph->connect_compat("connection_from_empty", this, "_connection_from_empty"); + graph->connect("connection_request", callable_mp(this, &VisualShaderEditor::_connection_request), varray(), CONNECT_DEFERRED); + graph->connect("disconnection_request", callable_mp(this, &VisualShaderEditor::_disconnection_request), varray(), CONNECT_DEFERRED); + graph->connect("node_selected", callable_mp(this, &VisualShaderEditor::_node_selected)); + graph->connect("scroll_offset_changed", callable_mp(this, &VisualShaderEditor::_scroll_changed)); + graph->connect("duplicate_nodes_request", callable_mp(this, &VisualShaderEditor::_duplicate_nodes)); + graph->connect("copy_nodes_request", callable_mp(this, &VisualShaderEditor::_copy_nodes)); + graph->connect("paste_nodes_request", callable_mp(this, &VisualShaderEditor::_paste_nodes)); + graph->connect("delete_nodes_request", callable_mp(this, &VisualShaderEditor::_delete_nodes)); + graph->connect("gui_input", callable_mp(this, &VisualShaderEditor::_graph_gui_input)); + graph->connect("connection_to_empty", callable_mp(this, &VisualShaderEditor::_connection_to_empty)); + graph->connect("connection_from_empty", callable_mp(this, &VisualShaderEditor::_connection_from_empty)); graph->add_valid_connection_type(VisualShaderNode::PORT_TYPE_SCALAR, VisualShaderNode::PORT_TYPE_SCALAR); graph->add_valid_connection_type(VisualShaderNode::PORT_TYPE_SCALAR, VisualShaderNode::PORT_TYPE_SCALAR_INT); graph->add_valid_connection_type(VisualShaderNode::PORT_TYPE_SCALAR, VisualShaderNode::PORT_TYPE_VECTOR); @@ -2420,7 +2378,7 @@ VisualShaderEditor::VisualShaderEditor() { edit_type->add_item(TTR("Fragment")); edit_type->add_item(TTR("Light")); edit_type->select(1); - edit_type->connect_compat("item_selected", this, "_mode_selected"); + edit_type->connect("item_selected", callable_mp(this, &VisualShaderEditor::_mode_selected)); graph->get_zoom_hbox()->add_child(edit_type); graph->get_zoom_hbox()->move_child(edit_type, 0); @@ -2428,13 +2386,13 @@ VisualShaderEditor::VisualShaderEditor() { graph->get_zoom_hbox()->add_child(add_node); add_node->set_text(TTR("Add Node...")); graph->get_zoom_hbox()->move_child(add_node, 0); - add_node->connect_compat("pressed", this, "_show_members_dialog", varray(false)); + add_node->connect("pressed", callable_mp(this, &VisualShaderEditor::_show_members_dialog), varray(false)); preview_shader = memnew(ToolButton); preview_shader->set_toggle_mode(true); preview_shader->set_tooltip(TTR("Show resulted shader code.")); graph->get_zoom_hbox()->add_child(preview_shader); - preview_shader->connect_compat("pressed", this, "_show_preview_text"); + preview_shader->connect("pressed", callable_mp(this, &VisualShaderEditor::_show_preview_text)); /////////////////////////////////////// // PREVIEW PANEL @@ -2468,7 +2426,7 @@ VisualShaderEditor::VisualShaderEditor() { popup_menu->add_item("Paste", NodeMenuOptions::PASTE); popup_menu->add_item("Delete", NodeMenuOptions::DELETE); popup_menu->add_item("Duplicate", NodeMenuOptions::DUPLICATE); - popup_menu->connect_compat("id_pressed", this, "_node_menu_id_pressed"); + popup_menu->connect("id_pressed", callable_mp(this, &VisualShaderEditor::_node_menu_id_pressed)); /////////////////////////////////////// // SHADER NODES TREE @@ -2482,15 +2440,15 @@ VisualShaderEditor::VisualShaderEditor() { node_filter = memnew(LineEdit); filter_hb->add_child(node_filter); - node_filter->connect_compat("text_changed", this, "_member_filter_changed"); - node_filter->connect_compat("gui_input", this, "_sbox_input"); + node_filter->connect("text_changed", callable_mp(this, &VisualShaderEditor::_member_filter_changed)); + node_filter->connect("gui_input", callable_mp(this, &VisualShaderEditor::_sbox_input)); node_filter->set_h_size_flags(SIZE_EXPAND_FILL); node_filter->set_placeholder(TTR("Search")); tools = memnew(MenuButton); filter_hb->add_child(tools); tools->set_tooltip(TTR("Options")); - tools->get_popup()->connect_compat("id_pressed", this, "_tools_menu_option"); + tools->get_popup()->connect("id_pressed", callable_mp(this, &VisualShaderEditor::_tools_menu_option)); tools->get_popup()->add_item(TTR("Expand All"), EXPAND_ALL); tools->get_popup()->add_item(TTR("Collapse All"), COLLAPSE_ALL); @@ -2503,9 +2461,9 @@ VisualShaderEditor::VisualShaderEditor() { members->set_allow_reselect(true); members->set_hide_folding(false); members->set_custom_minimum_size(Size2(180 * EDSCALE, 200 * EDSCALE)); - members->connect_compat("item_activated", this, "_member_create"); - members->connect_compat("item_selected", this, "_member_selected"); - members->connect_compat("nothing_selected", this, "_member_unselected"); + members->connect("item_activated", callable_mp(this, &VisualShaderEditor::_member_create)); + members->connect("item_selected", callable_mp(this, &VisualShaderEditor::_member_selected)); + members->connect("nothing_selected", callable_mp(this, &VisualShaderEditor::_member_unselected)); HBoxContainer *desc_hbox = memnew(HBoxContainer); members_vb->add_child(desc_hbox); @@ -2533,11 +2491,11 @@ VisualShaderEditor::VisualShaderEditor() { members_dialog->set_title(TTR("Create Shader Node")); members_dialog->add_child(members_vb); members_dialog->get_ok()->set_text(TTR("Create")); - members_dialog->get_ok()->connect_compat("pressed", this, "_member_create"); + members_dialog->get_ok()->connect("pressed", callable_mp(this, &VisualShaderEditor::_member_create)); members_dialog->get_ok()->set_disabled(true); members_dialog->set_resizable(true); members_dialog->set_as_minsize(); - members_dialog->connect_compat("hide", this, "_member_cancel"); + members_dialog->connect("hide", callable_mp(this, &VisualShaderEditor::_member_cancel)); add_child(members_dialog); alert = memnew(AcceptDialog); @@ -2929,7 +2887,7 @@ VisualShaderEditor::VisualShaderEditor() { property_editor = memnew(CustomPropertyEditor); add_child(property_editor); - property_editor->connect_compat("variant_changed", this, "_port_edited"); + property_editor->connect("variant_changed", callable_mp(this, &VisualShaderEditor::_port_edited)); } void VisualShaderEditorPlugin::edit(Object *p_object) { @@ -3286,8 +3244,6 @@ void EditorPropertyShaderMode::set_option_button_clip(bool p_enable) { } void EditorPropertyShaderMode::_bind_methods() { - - ClassDB::bind_method(D_METHOD("_option_selected"), &EditorPropertyShaderMode::_option_selected); } EditorPropertyShaderMode::EditorPropertyShaderMode() { @@ -3295,7 +3251,7 @@ EditorPropertyShaderMode::EditorPropertyShaderMode() { options->set_clip_text(true); add_child(options); add_focusable(options); - options->connect_compat("item_selected", this, "_option_selected"); + options->connect("item_selected", callable_mp(this, &EditorPropertyShaderMode::_option_selected)); } bool EditorInspectorShaderModePlugin::can_handle(Object *p_object) { @@ -3368,7 +3324,7 @@ void VisualShaderNodePortPreview::_shader_changed() { void VisualShaderNodePortPreview::setup(const Ref<VisualShader> &p_shader, VisualShader::Type p_type, int p_node, int p_port) { shader = p_shader; - shader->connect_compat("changed", this, "_shader_changed"); + shader->connect("changed", callable_mp(this, &VisualShaderNodePortPreview::_shader_changed)); type = p_type; port = p_port; node = p_node; @@ -3403,7 +3359,6 @@ void VisualShaderNodePortPreview::_notification(int p_what) { } void VisualShaderNodePortPreview::_bind_methods() { - ClassDB::bind_method("_shader_changed", &VisualShaderNodePortPreview::_shader_changed); } VisualShaderNodePortPreview::VisualShaderNodePortPreview() { |