diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-02-21 23:26:13 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-02-28 14:24:09 +0100 |
commit | f742dabafee7f54e1b77148d547e2031d7cc535e (patch) | |
tree | 5aab3c9c4b9aca10d190a7efa600afb8c7aef213 /editor/plugins | |
parent | 01afc442c73661df677c2b93f4037a21992ee45b (diff) |
Signals: Manually port most of remaining connect_compat uses
It's tedious work...
Some can't be ported as they depend on private or protected methods
of different classes, which is not supported by callable_mp (even if
it's a class inherited by the current one).
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.cpp | 8 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/curve_editor_plugin.cpp | 9 | ||||
-rw-r--r-- | editor/plugins/polygon_2d_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 14 | ||||
-rw-r--r-- | editor/plugins/tile_set_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 32 |
7 files changed, 27 insertions, 44 deletions
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index a42fc9d6a6..5ebb655c79 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -1501,16 +1501,16 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() { void AnimationPlayerEditor::_start_onion_skinning() { // FIXME: Using "idle_frame" makes onion layers update one frame behind the current. - if (!get_tree()->is_connected_compat("idle_frame", this, "call_deferred")) { - get_tree()->connect_compat("idle_frame", this, "call_deferred", varray("_prepare_onion_layers_1")); + if (!get_tree()->is_connected("idle_frame", callable_mp((Object *)this, &Object::call_deferred))) { + get_tree()->connect("idle_frame", callable_mp((Object *)this, &Object::call_deferred), varray("_prepare_onion_layers_1")); } } void AnimationPlayerEditor::_stop_onion_skinning() { - if (get_tree()->is_connected_compat("idle_frame", this, "call_deferred")) { + if (get_tree()->is_connected("idle_frame", callable_mp((Object *)this, &Object::call_deferred))) { - get_tree()->disconnect_compat("idle_frame", this, "call_deferred"); + get_tree()->disconnect("idle_frame", callable_mp((Object *)this, &Object::call_deferred)); _free_onion_layers(); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 8277879d80..72396174ee 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -5390,7 +5390,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { editor = 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("selection_changed", callable_mp((CanvasItem *)this, &CanvasItem::update)); 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)); diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index d0926ee47d..adf859eb1e 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -70,15 +70,15 @@ void CurveEditor::set_curve(Ref<Curve> curve) { return; if (_curve_ref.is_valid()) { - _curve_ref->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_curve_changed"); - _curve_ref->disconnect_compat(Curve::SIGNAL_RANGE_CHANGED, this, "_curve_changed"); + _curve_ref->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &CurveEditor::_curve_changed)); + _curve_ref->disconnect(Curve::SIGNAL_RANGE_CHANGED, callable_mp(this, &CurveEditor::_curve_changed)); } _curve_ref = curve; if (_curve_ref.is_valid()) { - _curve_ref->connect_compat(CoreStringNames::get_singleton()->changed, this, "_curve_changed"); - _curve_ref->connect_compat(Curve::SIGNAL_RANGE_CHANGED, this, "_curve_changed"); + _curve_ref->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &CurveEditor::_curve_changed)); + _curve_ref->connect(Curve::SIGNAL_RANGE_CHANGED, callable_mp(this, &CurveEditor::_curve_changed)); } _selected_point = -1; @@ -749,7 +749,6 @@ void CurveEditor::_draw() { void CurveEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &CurveEditor::on_gui_input); - ClassDB::bind_method(D_METHOD("_curve_changed"), &CurveEditor::_curve_changed); } //--------------- diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index f6a55ae545..8c115586a4 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -1259,7 +1259,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : button_uv = memnew(ToolButton); add_child(button_uv); button_uv->set_tooltip(TTR("Open Polygon 2D UV editor.")); - button_uv->connect_compat("pressed", this, "_menu_option", varray(MODE_EDIT_UV)); + button_uv->connect("pressed", callable_mp(this, &Polygon2DEditor::_menu_option), varray(MODE_EDIT_UV)); uv_mode = UV_MODE_EDIT_POINT; uv_edit = memnew(AcceptDialog); @@ -1374,7 +1374,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : uv_menu->get_popup()->add_item(TTR("Clear UV"), UVEDIT_UV_CLEAR); uv_menu->get_popup()->add_separator(); uv_menu->get_popup()->add_item(TTR("Grid Settings"), UVEDIT_GRID_SETTINGS); - uv_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option"); + uv_menu->get_popup()->connect("id_pressed", callable_mp(this, &Polygon2DEditor::_menu_option)); uv_mode_hb->add_child(memnew(VSeparator)); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 2b513feedc..fd9c8f6f39 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -3042,16 +3042,12 @@ void ScriptEditor::_bind_methods() { ClassDB::bind_method("_copy_script_path", &ScriptEditor::_copy_script_path); ClassDB::bind_method("_get_debug_tooltip", &ScriptEditor::_get_debug_tooltip); - ClassDB::bind_method("_update_autosave_timer", &ScriptEditor::_update_autosave_timer); ClassDB::bind_method("_update_script_connections", &ScriptEditor::_update_script_connections); ClassDB::bind_method("_help_class_open", &ScriptEditor::_help_class_open); 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("_update_members_overview", &ScriptEditor::_update_members_overview); ClassDB::bind_method("_update_recent_scripts", &ScriptEditor::_update_recent_scripts); - 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); ClassDB::bind_method(D_METHOD("get_drag_data_fw", "point", "from"), &ScriptEditor::get_drag_data_fw); ClassDB::bind_method(D_METHOD("can_drop_data_fw", "point", "data", "from"), &ScriptEditor::can_drop_data_fw); @@ -3340,7 +3336,7 @@ 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(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &ScriptEditor::_update_autosave_timer)); autosave_timer->connect("timeout", callable_mp(this, &ScriptEditor::_autosave_scripts)); add_child(autosave_timer); @@ -3351,14 +3347,14 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { 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)); - find_in_files_dialog->connect_compat(FindInFilesDialog::SIGNAL_REPLACE_REQUESTED, this, "_start_find_in_files", varray(true)); + find_in_files_dialog->connect(FindInFilesDialog::SIGNAL_FIND_REQUESTED, callable_mp(this, &ScriptEditor::_start_find_in_files), varray(false)); + find_in_files_dialog->connect(FindInFilesDialog::SIGNAL_REPLACE_REQUESTED, callable_mp(this, &ScriptEditor::_start_find_in_files), varray(true)); add_child(find_in_files_dialog); find_in_files = memnew(FindInFilesPanel); find_in_files_button = editor->add_bottom_panel_item(TTR("Search Results"), find_in_files); find_in_files->set_custom_minimum_size(Size2(0, 200) * EDSCALE); - find_in_files->connect_compat(FindInFilesPanel::SIGNAL_RESULT_SELECTED, this, "_on_find_in_files_result_selected"); - find_in_files->connect_compat(FindInFilesPanel::SIGNAL_FILES_MODIFIED, this, "_on_find_in_files_modified_files"); + find_in_files->connect(FindInFilesPanel::SIGNAL_RESULT_SELECTED, callable_mp(this, &ScriptEditor::_on_find_in_files_result_selected)); + find_in_files->connect(FindInFilesPanel::SIGNAL_FILES_MODIFIED, callable_mp(this, &ScriptEditor::_on_find_in_files_modified_files)); find_in_files->hide(); find_in_files_button->hide(); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index c6747e4e48..d23b037ed4 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -260,7 +260,7 @@ 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_workspace_process", &TileSetEditor::_on_workspace_process); + ClassDB::bind_method("_on_workspace_process", &TileSetEditor::_on_workspace_process); // Still used by some connect_compat. 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); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 1f400974b6..b3b9afb811 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -85,7 +85,7 @@ void VisualShaderEditor::edit(VisualShader *p_visual_shader) { visual_shader->set_graph_offset(graph->get_scroll_ofs() / EDSCALE); } else { if (visual_shader.is_valid()) { - if (visual_shader->is_connected_compat("changed", this, "")) { + if (visual_shader->is_connected("changed", callable_mp(this, &VisualShaderEditor::_update_preview))) { visual_shader->disconnect("changed", callable_mp(this, &VisualShaderEditor::_update_preview)); } } @@ -523,10 +523,6 @@ void VisualShaderEditor::_update_graph() { expression = expression_node->get_expression(); } - /*if (!vsnode->is_connected("changed", this, "_node_changed")) { - vsnode->connect("changed", this, "_node_changed", varray(vsnode->get_instance_id()), CONNECT_DEFERRED); - }*/ - node->set_offset(position); node->set_title(vsnode->get_caption()); @@ -662,7 +658,7 @@ void VisualShaderEditor::_update_graph() { case Variant::COLOR: { button->set_custom_minimum_size(Size2(30, 0) * EDSCALE); - button->connect_compat("draw", this, "_draw_color_over_button", varray(button, default_value)); + button->connect("draw", callable_mp(this, &VisualShaderEditor::_draw_color_over_button), varray(button, default_value)); } break; case Variant::BOOL: { button->set_text(((bool)default_value) ? "true" : "false"); @@ -2940,15 +2936,10 @@ class VisualShaderNodePluginInputEditor : public OptionButton { Ref<VisualShaderNodeInput> input; -protected: - static void _bind_methods() { - ClassDB::bind_method("_item_selected", &VisualShaderNodePluginInputEditor::_item_selected); - } - public: void _notification(int p_what) { if (p_what == NOTIFICATION_READY) { - connect_compat("item_selected", this, "_item_selected"); + connect("item_selected", callable_mp(this, &VisualShaderNodePluginInputEditor::_item_selected)); } } @@ -3078,25 +3069,22 @@ public: bool res_prop = Object::cast_to<EditorPropertyResource>(p_properties[i]); if (res_prop) { - p_properties[i]->connect_compat("resource_selected", this, "_resource_selected"); + p_properties[i]->connect("resource_selected", callable_mp(this, &VisualShaderNodePluginDefaultEditor::_resource_selected)); } - properties[i]->connect_compat("property_changed", this, "_property_changed"); + properties[i]->connect("property_changed", callable_mp(this, &VisualShaderNodePluginDefaultEditor::_property_changed)); properties[i]->set_object_and_property(node.ptr(), p_names[i]); properties[i]->update_property(); properties[i]->set_name_split_ratio(0); } - node->connect_compat("changed", this, "_node_changed"); - node->connect_compat("editor_refresh_request", this, "_refresh_request", varray(), CONNECT_DEFERRED); + node->connect("changed", callable_mp(this, &VisualShaderNodePluginDefaultEditor::_node_changed)); + node->connect("editor_refresh_request", callable_mp(this, &VisualShaderNodePluginDefaultEditor::_refresh_request), varray(), CONNECT_DEFERRED); } static void _bind_methods() { - ClassDB::bind_method("_property_changed", &VisualShaderNodePluginDefaultEditor::_property_changed, DEFVAL(String()), DEFVAL(false)); - ClassDB::bind_method("_node_changed", &VisualShaderNodePluginDefaultEditor::_node_changed); - ClassDB::bind_method("_refresh_request", &VisualShaderNodePluginDefaultEditor::_refresh_request); - ClassDB::bind_method("_resource_selected", &VisualShaderNodePluginDefaultEditor::_resource_selected); - ClassDB::bind_method("_open_inspector", &VisualShaderNodePluginDefaultEditor::_open_inspector); - ClassDB::bind_method("_show_prop_names", &VisualShaderNodePluginDefaultEditor::_show_prop_names); + ClassDB::bind_method("_refresh_request", &VisualShaderNodePluginDefaultEditor::_refresh_request); // Used by UndoRedo. + ClassDB::bind_method("_open_inspector", &VisualShaderNodePluginDefaultEditor::_open_inspector); // Used by UndoRedo. + ClassDB::bind_method("_show_prop_names", &VisualShaderNodePluginDefaultEditor::_show_prop_names); // Used with call_deferred. } }; |