summaryrefslogtreecommitdiff
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp257
1 files changed, 101 insertions, 156 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index d8043f016b..6f8027ba64 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -374,8 +374,8 @@ void EditorNode::_notification(int p_what) {
get_tree()->get_root()->set_as_audio_listener(false);
get_tree()->get_root()->set_as_audio_listener_2d(false);
get_tree()->set_auto_accept_quit(false);
- get_tree()->connect_compat("files_dropped", this, "_dropped_files");
- get_tree()->connect_compat("global_menu_action", this, "_global_menu_action");
+ get_tree()->connect("files_dropped", callable_mp(this, &EditorNode::_dropped_files));
+ get_tree()->connect("global_menu_action", callable_mp(this, &EditorNode::_global_menu_action));
/* DO NOT LOAD SCENES HERE, WAIT FOR FILE SCANNING AND REIMPORT TO COMPLETE */
} break;
@@ -2972,7 +2972,7 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed
ToolButton *tb = memnew(ToolButton);
tb->set_toggle_mode(true);
- tb->connect_compat("pressed", singleton, "_editor_select", varray(singleton->main_editor_buttons.size()));
+ tb->connect("pressed", callable_mp(singleton, &EditorNode::_editor_select), varray(singleton->main_editor_buttons.size()));
tb->set_text(p_editor->get_name());
Ref<Texture2D> icon = p_editor->get_icon();
@@ -4803,7 +4803,7 @@ void EditorNode::_scene_tab_changed(int p_tab) {
ToolButton *EditorNode::add_bottom_panel_item(String p_text, Control *p_item) {
ToolButton *tb = memnew(ToolButton);
- tb->connect_compat("toggled", this, "_bottom_panel_switch", varray(bottom_panel_items.size()));
+ tb->connect("toggled", callable_mp(this, &EditorNode::_bottom_panel_switch), varray(bottom_panel_items.size()));
tb->set_text(p_text);
tb->set_toggle_mode(true);
tb->set_focus_mode(Control::FOCUS_NONE);
@@ -4865,8 +4865,8 @@ void EditorNode::raise_bottom_panel_item(Control *p_item) {
}
for (int i = 0; i < bottom_panel_items.size(); i++) {
- bottom_panel_items[i].button->disconnect_compat("toggled", this, "_bottom_panel_switch");
- bottom_panel_items[i].button->connect_compat("toggled", this, "_bottom_panel_switch", varray(i));
+ bottom_panel_items[i].button->disconnect("toggled", callable_mp(this, &EditorNode::_bottom_panel_switch));
+ bottom_panel_items[i].button->connect("toggled", callable_mp(this, &EditorNode::_bottom_panel_switch), varray(i));
}
}
@@ -4887,8 +4887,8 @@ void EditorNode::remove_bottom_panel_item(Control *p_item) {
}
for (int i = 0; i < bottom_panel_items.size(); i++) {
- bottom_panel_items[i].button->disconnect_compat("toggled", this, "_bottom_panel_switch");
- bottom_panel_items[i].button->connect_compat("toggled", this, "_bottom_panel_switch", varray(i));
+ bottom_panel_items[i].button->disconnect("toggled", callable_mp(this, &EditorNode::_bottom_panel_switch));
+ bottom_panel_items[i].button->connect("toggled", callable_mp(this, &EditorNode::_bottom_panel_switch), varray(i));
}
}
@@ -5445,92 +5445,37 @@ void EditorNode::_feature_profile_changed() {
void EditorNode::_bind_methods() {
- ClassDB::bind_method("_menu_option", &EditorNode::_menu_option);
- ClassDB::bind_method("_tool_menu_option", &EditorNode::_tool_menu_option);
- ClassDB::bind_method("_menu_confirm_current", &EditorNode::_menu_confirm_current);
- ClassDB::bind_method("_dialog_action", &EditorNode::_dialog_action);
ClassDB::bind_method("_editor_select", &EditorNode::_editor_select);
ClassDB::bind_method("_node_renamed", &EditorNode::_node_renamed);
ClassDB::bind_method("edit_node", &EditorNode::edit_node);
ClassDB::bind_method("_unhandled_input", &EditorNode::_unhandled_input);
- ClassDB::bind_method("_update_file_menu_opened", &EditorNode::_update_file_menu_opened);
- ClassDB::bind_method("_update_file_menu_closed", &EditorNode::_update_file_menu_closed);
ClassDB::bind_method(D_METHOD("push_item", "object", "property", "inspector_only"), &EditorNode::push_item, DEFVAL(""), DEFVAL(false));
ClassDB::bind_method("_get_scene_metadata", &EditorNode::_get_scene_metadata);
ClassDB::bind_method("set_edited_scene", &EditorNode::set_edited_scene);
ClassDB::bind_method("open_request", &EditorNode::open_request);
- ClassDB::bind_method("_inherit_request", &EditorNode::_inherit_request);
- ClassDB::bind_method("_instance_request", &EditorNode::_instance_request);
ClassDB::bind_method("_close_messages", &EditorNode::_close_messages);
ClassDB::bind_method("_show_messages", &EditorNode::_show_messages);
- ClassDB::bind_method("_vp_resized", &EditorNode::_vp_resized);
- ClassDB::bind_method("_quick_opened", &EditorNode::_quick_opened);
- ClassDB::bind_method("_quick_run", &EditorNode::_quick_run);
-
- ClassDB::bind_method("_open_recent_scene", &EditorNode::_open_recent_scene);
ClassDB::bind_method("stop_child_process", &EditorNode::stop_child_process);
ClassDB::bind_method("get_script_create_dialog", &EditorNode::get_script_create_dialog);
- ClassDB::bind_method("_sources_changed", &EditorNode::_sources_changed);
- ClassDB::bind_method("_fs_changed", &EditorNode::_fs_changed);
- ClassDB::bind_method("_dock_select_draw", &EditorNode::_dock_select_draw);
- ClassDB::bind_method("_dock_select_input", &EditorNode::_dock_select_input);
- ClassDB::bind_method("_dock_pre_popup", &EditorNode::_dock_pre_popup);
- ClassDB::bind_method("_dock_split_dragged", &EditorNode::_dock_split_dragged);
- ClassDB::bind_method("_save_docks", &EditorNode::_save_docks);
- ClassDB::bind_method("_dock_popup_exit", &EditorNode::_dock_popup_exit);
- ClassDB::bind_method("_dock_move_left", &EditorNode::_dock_move_left);
- ClassDB::bind_method("_dock_move_right", &EditorNode::_dock_move_right);
- ClassDB::bind_method("_dock_tab_changed", &EditorNode::_dock_tab_changed);
-
- ClassDB::bind_method("_layout_menu_option", &EditorNode::_layout_menu_option);
-
ClassDB::bind_method("set_current_scene", &EditorNode::set_current_scene);
ClassDB::bind_method("set_current_version", &EditorNode::set_current_version);
- ClassDB::bind_method("_scene_tab_changed", &EditorNode::_scene_tab_changed);
- ClassDB::bind_method("_scene_tab_closed", &EditorNode::_scene_tab_closed);
- ClassDB::bind_method("_scene_tab_hover", &EditorNode::_scene_tab_hover);
- ClassDB::bind_method("_scene_tab_exit", &EditorNode::_scene_tab_exit);
- ClassDB::bind_method("_scene_tab_input", &EditorNode::_scene_tab_input);
- ClassDB::bind_method("_reposition_active_tab", &EditorNode::_reposition_active_tab);
ClassDB::bind_method("_thumbnail_done", &EditorNode::_thumbnail_done);
- ClassDB::bind_method("_scene_tab_script_edited", &EditorNode::_scene_tab_script_edited);
ClassDB::bind_method("_set_main_scene_state", &EditorNode::_set_main_scene_state);
- ClassDB::bind_method("_update_scene_tabs", &EditorNode::_update_scene_tabs);
- ClassDB::bind_method("_discard_changes", &EditorNode::_discard_changes);
ClassDB::bind_method("_update_recent_scenes", &EditorNode::_update_recent_scenes);
ClassDB::bind_method("_clear_undo_history", &EditorNode::_clear_undo_history);
- ClassDB::bind_method("_dropped_files", &EditorNode::_dropped_files);
- ClassDB::bind_method(D_METHOD("_global_menu_action"), &EditorNode::_global_menu_action, DEFVAL(Variant()));
- ClassDB::bind_method("_toggle_distraction_free_mode", &EditorNode::_toggle_distraction_free_mode);
- ClassDB::bind_method("_version_control_menu_option", &EditorNode::_version_control_menu_option);
ClassDB::bind_method("edit_item_resource", &EditorNode::edit_item_resource);
ClassDB::bind_method(D_METHOD("get_gui_base"), &EditorNode::get_gui_base);
- ClassDB::bind_method(D_METHOD("_bottom_panel_switch"), &EditorNode::_bottom_panel_switch);
-
- ClassDB::bind_method(D_METHOD("_open_imported"), &EditorNode::_open_imported);
- ClassDB::bind_method(D_METHOD("_inherit_imported"), &EditorNode::_inherit_imported);
-
- ClassDB::bind_method("_copy_warning", &EditorNode::_copy_warning);
-
- ClassDB::bind_method(D_METHOD("_resources_reimported"), &EditorNode::_resources_reimported);
- ClassDB::bind_method(D_METHOD("_bottom_panel_raise_toggled"), &EditorNode::_bottom_panel_raise_toggled);
- ClassDB::bind_method(D_METHOD("_on_plugin_ready"), &EditorNode::_on_plugin_ready);
-
- ClassDB::bind_method(D_METHOD("_video_driver_selected"), &EditorNode::_video_driver_selected);
-
- ClassDB::bind_method(D_METHOD("_resources_changed"), &EditorNode::_resources_changed);
- ClassDB::bind_method(D_METHOD("_feature_profile_changed"), &EditorNode::_feature_profile_changed);
+ ClassDB::bind_method(D_METHOD("_on_plugin_ready"), &EditorNode::_on_plugin_ready); // Still used by some connect_compat.
ClassDB::bind_method("_screenshot", &EditorNode::_screenshot);
- ClassDB::bind_method("_request_screenshot", &EditorNode::_request_screenshot);
ClassDB::bind_method("_save_screenshot", &EditorNode::_save_screenshot);
ADD_SIGNAL(MethodInfo("play_pressed"));
@@ -5554,7 +5499,7 @@ void EditorNode::_print_handler(void *p_this, const String &p_string, bool p_err
static void _execute_thread(void *p_ud) {
EditorNode::ExecuteThreadArgs *eta = (EditorNode::ExecuteThreadArgs *)p_ud;
- Error err = OS::get_singleton()->execute(eta->path, eta->args, true, NULL, &eta->output, &eta->exitcode, true, eta->execute_output_mutex);
+ Error err = OS::get_singleton()->execute(eta->path, eta->args, true, NULL, &eta->output, &eta->exitcode, true, &eta->execute_output_mutex);
print_verbose("Thread exit status: " + itos(eta->exitcode));
if (err != OK) {
eta->exitcode = err;
@@ -5574,7 +5519,6 @@ int EditorNode::execute_and_show_output(const String &p_title, const String &p_p
ExecuteThreadArgs eta;
eta.path = p_path;
eta.args = p_arguments;
- eta.execute_output_mutex = Mutex::create();
eta.exitcode = 255;
eta.done = false;
@@ -5585,20 +5529,20 @@ int EditorNode::execute_and_show_output(const String &p_title, const String &p_p
ERR_FAIL_COND_V(!eta.execute_output_thread, 0);
while (!eta.done) {
- eta.execute_output_mutex->lock();
- if (prev_len != eta.output.length()) {
- String to_add = eta.output.substr(prev_len, eta.output.length());
- prev_len = eta.output.length();
- execute_outputs->add_text(to_add);
- Main::iteration();
- }
- eta.execute_output_mutex->unlock();
+ {
+ MutexLock lock(eta.execute_output_mutex);
+ if (prev_len != eta.output.length()) {
+ String to_add = eta.output.substr(prev_len, eta.output.length());
+ prev_len = eta.output.length();
+ execute_outputs->add_text(to_add);
+ Main::iteration();
+ }
+ }
OS::get_singleton()->delay_usec(1000);
}
Thread::wait_to_finish(eta.execute_output_thread);
memdelete(eta.execute_output_thread);
- memdelete(eta.execute_output_mutex);
execute_outputs->add_text("\nExit Code: " + itos(eta.exitcode));
if (p_close_on_errors && eta.exitcode != 0) {
@@ -5841,7 +5785,7 @@ EditorNode::EditorNode() {
EDITOR_DEF_RST("interface/scene_tabs/show_thumbnail_on_hover", true);
EDITOR_DEF_RST("interface/inspector/capitalize_properties", true);
EDITOR_DEF_RST("interface/inspector/default_float_step", 0.001);
- EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::REAL, "interface/inspector/default_float_step", PROPERTY_HINT_RANGE, "0,1,0"));
+ EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::FLOAT, "interface/inspector/default_float_step", PROPERTY_HINT_RANGE, "0,1,0"));
EDITOR_DEF_RST("interface/inspector/disable_folding", false);
EDITOR_DEF_RST("interface/inspector/auto_unfold_foreign_scenes", true);
EDITOR_DEF("interface/inspector/horizontal_vector2_editing", false);
@@ -5943,8 +5887,8 @@ EditorNode::EditorNode() {
hsplits.push_back(right_hsplit);
for (int i = 0; i < vsplits.size(); i++) {
- vsplits[i]->connect_compat("dragged", this, "_dock_split_dragged");
- hsplits[i]->connect_compat("dragged", this, "_dock_split_dragged");
+ vsplits[i]->connect("dragged", callable_mp(this, &EditorNode::_dock_split_dragged));
+ hsplits[i]->connect("dragged", callable_mp(this, &EditorNode::_dock_split_dragged));
}
dock_select_popup = memnew(PopupPanel);
@@ -5956,7 +5900,7 @@ EditorNode::EditorNode() {
dock_tab_move_left = memnew(ToolButton);
dock_tab_move_left->set_icon(theme->get_icon("Back", "EditorIcons"));
dock_tab_move_left->set_focus_mode(Control::FOCUS_NONE);
- dock_tab_move_left->connect_compat("pressed", this, "_dock_move_left");
+ dock_tab_move_left->connect("pressed", callable_mp(this, &EditorNode::_dock_move_left));
dock_hb->add_child(dock_tab_move_left);
Label *dock_label = memnew(Label);
@@ -5968,16 +5912,16 @@ EditorNode::EditorNode() {
dock_tab_move_right = memnew(ToolButton);
dock_tab_move_right->set_icon(theme->get_icon("Forward", "EditorIcons"));
dock_tab_move_right->set_focus_mode(Control::FOCUS_NONE);
- dock_tab_move_right->connect_compat("pressed", this, "_dock_move_right");
+ dock_tab_move_right->connect("pressed", callable_mp(this, &EditorNode::_dock_move_right));
dock_hb->add_child(dock_tab_move_right);
dock_vb->add_child(dock_hb);
dock_select = memnew(Control);
dock_select->set_custom_minimum_size(Size2(128, 64) * EDSCALE);
- dock_select->connect_compat("gui_input", this, "_dock_select_input");
- dock_select->connect_compat("draw", this, "_dock_select_draw");
- dock_select->connect_compat("mouse_exited", this, "_dock_popup_exit");
+ dock_select->connect("gui_input", callable_mp(this, &EditorNode::_dock_select_input));
+ dock_select->connect("draw", callable_mp(this, &EditorNode::_dock_select_draw));
+ dock_select->connect("mouse_exited", callable_mp(this, &EditorNode::_dock_popup_exit));
dock_select->set_v_size_flags(Control::SIZE_EXPAND_FILL);
dock_vb->add_child(dock_select);
@@ -5988,11 +5932,11 @@ EditorNode::EditorNode() {
dock_slot[i]->set_custom_minimum_size(Size2(170, 0) * EDSCALE);
dock_slot[i]->set_v_size_flags(Control::SIZE_EXPAND_FILL);
dock_slot[i]->set_popup(dock_select_popup);
- dock_slot[i]->connect_compat("pre_popup_pressed", this, "_dock_pre_popup", varray(i));
+ dock_slot[i]->connect("pre_popup_pressed", callable_mp(this, &EditorNode::_dock_pre_popup), varray(i));
dock_slot[i]->set_tab_align(TabContainer::ALIGN_LEFT);
dock_slot[i]->set_drag_to_rearrange_enabled(true);
dock_slot[i]->set_tabs_rearrange_group(1);
- dock_slot[i]->connect_compat("tab_changed", this, "_dock_tab_changed");
+ dock_slot[i]->connect("tab_changed", callable_mp(this, &EditorNode::_dock_tab_changed));
dock_slot[i]->set_use_hidden_tabs_for_min_size(true);
}
@@ -6000,7 +5944,7 @@ EditorNode::EditorNode() {
add_child(dock_drag_timer);
dock_drag_timer->set_wait_time(0.5);
dock_drag_timer->set_one_shot(true);
- dock_drag_timer->connect_compat("timeout", this, "_save_docks");
+ dock_drag_timer->connect("timeout", callable_mp(this, &EditorNode::_save_docks));
top_split = memnew(VSplitContainer);
center_split->add_child(top_split);
@@ -6033,21 +5977,21 @@ EditorNode::EditorNode() {
scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/scene_tabs/always_show_close_button", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
scene_tabs->set_min_width(int(EDITOR_DEF("interface/scene_tabs/minimum_width", 50)) * EDSCALE);
scene_tabs->set_drag_to_rearrange_enabled(true);
- scene_tabs->connect_compat("tab_changed", this, "_scene_tab_changed");
- scene_tabs->connect_compat("right_button_pressed", this, "_scene_tab_script_edited");
- scene_tabs->connect_compat("tab_close", this, "_scene_tab_closed", varray(SCENE_TAB_CLOSE));
- scene_tabs->connect_compat("tab_hover", this, "_scene_tab_hover");
- scene_tabs->connect_compat("mouse_exited", this, "_scene_tab_exit");
- scene_tabs->connect_compat("gui_input", this, "_scene_tab_input");
- scene_tabs->connect_compat("reposition_active_tab_request", this, "_reposition_active_tab");
- scene_tabs->connect_compat("resized", this, "_update_scene_tabs");
+ scene_tabs->connect("tab_changed", callable_mp(this, &EditorNode::_scene_tab_changed));
+ scene_tabs->connect("right_button_pressed", callable_mp(this, &EditorNode::_scene_tab_script_edited));
+ scene_tabs->connect("tab_close", callable_mp(this, &EditorNode::_scene_tab_closed), varray(SCENE_TAB_CLOSE));
+ scene_tabs->connect("tab_hover", callable_mp(this, &EditorNode::_scene_tab_hover));
+ scene_tabs->connect("mouse_exited", callable_mp(this, &EditorNode::_scene_tab_exit));
+ scene_tabs->connect("gui_input", callable_mp(this, &EditorNode::_scene_tab_input));
+ scene_tabs->connect("reposition_active_tab_request", callable_mp(this, &EditorNode::_reposition_active_tab));
+ scene_tabs->connect("resized", callable_mp(this, &EditorNode::_update_scene_tabs));
tabbar_container = memnew(HBoxContainer);
scene_tabs->set_h_size_flags(Control::SIZE_EXPAND_FILL);
scene_tabs_context_menu = memnew(PopupMenu);
tabbar_container->add_child(scene_tabs_context_menu);
- scene_tabs_context_menu->connect_compat("id_pressed", this, "_menu_option");
+ scene_tabs_context_menu->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
scene_tabs_context_menu->set_hide_on_window_lose_focus(true);
srt->add_child(tabbar_container);
@@ -6059,7 +6003,7 @@ EditorNode::EditorNode() {
distraction_free->set_shortcut(ED_SHORTCUT("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F11));
#endif
distraction_free->set_tooltip(TTR("Toggle distraction-free mode."));
- distraction_free->connect_compat("pressed", this, "_toggle_distraction_free_mode");
+ distraction_free->connect("pressed", callable_mp(this, &EditorNode::_toggle_distraction_free_mode));
distraction_free->set_icon(gui_base->get_icon("DistractionFree", "EditorIcons"));
distraction_free->set_toggle_mode(true);
@@ -6069,7 +6013,7 @@ EditorNode::EditorNode() {
scene_tab_add->set_tooltip(TTR("Add a new scene."));
scene_tab_add->set_icon(gui_base->get_icon("Add", "EditorIcons"));
scene_tab_add->add_color_override("icon_color_normal", Color(0.6f, 0.6f, 0.6f, 0.8f));
- scene_tab_add->connect_compat("pressed", this, "_menu_option", make_binds(FILE_NEW_SCENE));
+ scene_tab_add->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(FILE_NEW_SCENE));
scene_root_parent = memnew(PanelContainer);
scene_root_parent->set_custom_minimum_size(Size2(0, 80) * EDSCALE);
@@ -6104,14 +6048,14 @@ EditorNode::EditorNode() {
prev_scene->set_icon(gui_base->get_icon("PrevScene", "EditorIcons"));
prev_scene->set_tooltip(TTR("Go to previously opened scene."));
prev_scene->set_disabled(true);
- prev_scene->connect_compat("pressed", this, "_menu_option", make_binds(FILE_OPEN_PREV));
+ prev_scene->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(FILE_OPEN_PREV));
gui_base->add_child(prev_scene);
prev_scene->set_position(Point2(3, 24));
prev_scene->hide();
accept = memnew(AcceptDialog);
gui_base->add_child(accept);
- accept->connect_compat("confirmed", this, "_menu_confirm_current");
+ accept->connect("confirmed", callable_mp(this, &EditorNode::_menu_confirm_current));
project_export = memnew(ProjectExportDialog);
gui_base->add_child(project_export);
@@ -6138,16 +6082,16 @@ EditorNode::EditorNode() {
gui_base->add_child(feature_profile_manager);
about = memnew(EditorAbout);
gui_base->add_child(about);
- feature_profile_manager->connect_compat("current_feature_profile_changed", this, "_feature_profile_changed");
+ feature_profile_manager->connect("current_feature_profile_changed", callable_mp(this, &EditorNode::_feature_profile_changed));
warning = memnew(AcceptDialog);
warning->add_button(TTR("Copy Text"), true, "copy");
gui_base->add_child(warning);
- warning->connect_compat("custom_action", this, "_copy_warning");
+ warning->connect("custom_action", callable_mp(this, &EditorNode::_copy_warning));
ED_SHORTCUT("editor/next_tab", TTR("Next tab"), KEY_MASK_CMD + KEY_TAB);
ED_SHORTCUT("editor/prev_tab", TTR("Previous tab"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_TAB);
- ED_SHORTCUT("editor/filter_files", TTR("Filter Files..."), KEY_MASK_ALT + KEY_MASK_CMD + KEY_P);
+ ED_SHORTCUT("editor/filter_files", TTR("Filter Files..."), KEY_MASK_CMD + KEY_MASK_ALT + KEY_P);
PopupMenu *p;
file_menu->set_tooltip(TTR("Operations with scene files."));
@@ -6162,13 +6106,14 @@ EditorNode::EditorNode() {
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/save_scene", TTR("Save Scene"), KEY_MASK_CMD + KEY_S), FILE_SAVE_SCENE);
- p->add_shortcut(ED_SHORTCUT("editor/save_scene_as", TTR("Save Scene As..."), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_S), FILE_SAVE_AS_SCENE);
- p->add_shortcut(ED_SHORTCUT("editor/save_all_scenes", TTR("Save All Scenes"), KEY_MASK_ALT + KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_S), FILE_SAVE_ALL_SCENES);
+ p->add_shortcut(ED_SHORTCUT("editor/save_scene_as", TTR("Save Scene As..."), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_S), FILE_SAVE_AS_SCENE);
+ p->add_shortcut(ED_SHORTCUT("editor/save_all_scenes", TTR("Save All Scenes"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_S), FILE_SAVE_ALL_SCENES);
p->add_separator();
+
p->add_shortcut(ED_SHORTCUT("editor/quick_open", TTR("Quick Open..."), KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_O), FILE_QUICK_OPEN);
- p->add_shortcut(ED_SHORTCUT("editor/quick_open_scene", TTR("Quick Open Scene..."), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_O), FILE_QUICK_OPEN_SCENE);
- p->add_shortcut(ED_SHORTCUT("editor/quick_open_script", TTR("Quick Open Script..."), KEY_MASK_ALT + KEY_MASK_CMD + KEY_O), FILE_QUICK_OPEN_SCRIPT);
+ p->add_shortcut(ED_SHORTCUT("editor/quick_open_scene", TTR("Quick Open Scene..."), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_O), FILE_QUICK_OPEN_SCENE);
+ p->add_shortcut(ED_SHORTCUT("editor/quick_open_script", TTR("Quick Open Script..."), KEY_MASK_CMD + KEY_MASK_ALT + KEY_O), FILE_QUICK_OPEN_SCRIPT);
p->add_separator();
PopupMenu *pm_export = memnew(PopupMenu);
@@ -6177,20 +6122,20 @@ EditorNode::EditorNode() {
p->add_submenu_item(TTR("Convert To..."), "Export");
pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_MeshLibrary", TTR("MeshLibrary...")), FILE_EXPORT_MESH_LIBRARY);
pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_TileSet", TTR("TileSet...")), FILE_EXPORT_TILESET);
- pm_export->connect_compat("id_pressed", this, "_menu_option");
+ pm_export->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/undo", TTR("Undo"), KEY_MASK_CMD + KEY_Z), EDIT_UNDO, true);
- p->add_shortcut(ED_SHORTCUT("editor/redo", TTR("Redo"), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_Z), EDIT_REDO, true);
+ p->add_shortcut(ED_SHORTCUT("editor/redo", TTR("Redo"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_Z), EDIT_REDO, true);
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/revert_scene", TTR("Revert Scene")), EDIT_REVERT);
- p->add_shortcut(ED_SHORTCUT("editor/close_scene", TTR("Close Scene"), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_W), FILE_CLOSE);
+ p->add_shortcut(ED_SHORTCUT("editor/close_scene", TTR("Close Scene"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_W), FILE_CLOSE);
recent_scenes = memnew(PopupMenu);
recent_scenes->set_name("RecentScenes");
p->add_child(recent_scenes);
- recent_scenes->connect_compat("id_pressed", this, "_open_recent_scene");
+ recent_scenes->connect("id_pressed", callable_mp(this, &EditorNode::_open_recent_scene));
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/file_quit", TTR("Quit"), KEY_MASK_CMD + KEY_Q), FILE_QUIT, true);
@@ -6206,11 +6151,11 @@ EditorNode::EditorNode() {
p = project_menu->get_popup();
p->set_hide_on_window_lose_focus(true);
p->add_shortcut(ED_SHORTCUT("editor/project_settings", TTR("Project Settings...")), RUN_SETTINGS);
- p->connect_compat("id_pressed", this, "_menu_option");
+ p->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
vcs_actions_menu = VersionControlEditorPlugin::get_singleton()->get_version_control_actions_panel();
vcs_actions_menu->set_name("Version Control");
- vcs_actions_menu->connect_compat("index_pressed", this, "_version_control_menu_option");
+ vcs_actions_menu->connect("index_pressed", callable_mp(this, &EditorNode::_version_control_menu_option));
p->add_separator();
p->add_child(vcs_actions_menu);
p->add_submenu_item(TTR("Version Control"), "Version Control");
@@ -6223,12 +6168,12 @@ EditorNode::EditorNode() {
p->add_item(TTR("Open Project Data Folder"), RUN_PROJECT_DATA_FOLDER);
plugin_config_dialog = memnew(PluginConfigDialog);
- plugin_config_dialog->connect_compat("plugin_ready", this, "_on_plugin_ready");
+ plugin_config_dialog->connect("plugin_ready", callable_mp(this, &EditorNode::_on_plugin_ready));
gui_base->add_child(plugin_config_dialog);
tool_menu = memnew(PopupMenu);
tool_menu->set_name("Tools");
- tool_menu->connect_compat("index_pressed", this, "_tool_menu_option");
+ tool_menu->connect("index_pressed", callable_mp(this, &EditorNode::_tool_menu_option));
p->add_child(tool_menu);
p->add_submenu_item(TTR("Tools"), "Tools");
tool_menu->add_item(TTR("Orphan Resource Explorer..."), TOOLS_ORPHAN_RESOURCES);
@@ -6237,7 +6182,7 @@ EditorNode::EditorNode() {
#ifdef OSX_ENABLED
p->add_shortcut(ED_SHORTCUT("editor/quit_to_project_list", TTR("Quit to Project List"), KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q), RUN_PROJECT_MANAGER, true);
#else
- p->add_shortcut(ED_SHORTCUT("editor/quit_to_project_list", TTR("Quit to Project List"), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_Q), RUN_PROJECT_MANAGER, true);
+ p->add_shortcut(ED_SHORTCUT("editor/quit_to_project_list", TTR("Quit to Project List"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_Q), RUN_PROJECT_MANAGER, true);
#endif
menu_hb->add_spacer();
@@ -6279,7 +6224,7 @@ EditorNode::EditorNode() {
p->add_radio_check_item(TTR("Debug 2 instances"), RUN_DEBUG_TWO);
p->set_item_checked(p->get_item_index(RUN_DEBUG_ONE), true);
- p->connect_compat("id_pressed", this, "_menu_option");
+ p->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
menu_hb->add_spacer();
@@ -6298,7 +6243,7 @@ EditorNode::EditorNode() {
editor_layouts = memnew(PopupMenu);
editor_layouts->set_name("Layouts");
p->add_child(editor_layouts);
- editor_layouts->connect_compat("id_pressed", this, "_layout_menu_option");
+ editor_layouts->connect("id_pressed", callable_mp(this, &EditorNode::_layout_menu_option));
p->add_submenu_item(TTR("Editor Layout"), "Layouts");
p->add_separator();
#ifdef OSX_ENABLED
@@ -6340,7 +6285,7 @@ EditorNode::EditorNode() {
p = help_menu->get_popup();
p->set_hide_on_window_lose_focus(true);
- p->connect_compat("id_pressed", this, "_menu_option");
+ p->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
p->add_icon_shortcut(gui_base->get_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("editor/editor_help", TTR("Search"), KEY_MASK_SHIFT | KEY_F1), HELP_SEARCH);
p->add_separator();
p->add_icon_shortcut(gui_base->get_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/online_docs", TTR("Online Docs")), HELP_DOCS);
@@ -6358,7 +6303,7 @@ EditorNode::EditorNode() {
play_button->set_toggle_mode(true);
play_button->set_icon(gui_base->get_icon("MainPlay", "EditorIcons"));
play_button->set_focus_mode(Control::FOCUS_NONE);
- play_button->connect_compat("pressed", this, "_menu_option", make_binds(RUN_PLAY));
+ play_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY));
play_button->set_tooltip(TTR("Play the project."));
#ifdef OSX_ENABLED
play_button->set_shortcut(ED_SHORTCUT("editor/play", TTR("Play"), KEY_MASK_CMD | KEY_B));
@@ -6383,7 +6328,7 @@ EditorNode::EditorNode() {
play_hb->add_child(stop_button);
stop_button->set_focus_mode(Control::FOCUS_NONE);
stop_button->set_icon(gui_base->get_icon("Stop", "EditorIcons"));
- stop_button->connect_compat("pressed", this, "_menu_option", make_binds(RUN_STOP));
+ stop_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_STOP));
stop_button->set_tooltip(TTR("Stop the scene."));
stop_button->set_disabled(true);
#ifdef OSX_ENABLED
@@ -6394,14 +6339,14 @@ EditorNode::EditorNode() {
run_native = memnew(EditorRunNative);
play_hb->add_child(run_native);
- run_native->connect_compat("native_run", this, "_menu_option", varray(RUN_PLAY_NATIVE));
+ run_native->connect("native_run", callable_mp(this, &EditorNode::_menu_option), varray(RUN_PLAY_NATIVE));
play_scene_button = memnew(ToolButton);
play_hb->add_child(play_scene_button);
play_scene_button->set_toggle_mode(true);
play_scene_button->set_focus_mode(Control::FOCUS_NONE);
play_scene_button->set_icon(gui_base->get_icon("PlayScene", "EditorIcons"));
- play_scene_button->connect_compat("pressed", this, "_menu_option", make_binds(RUN_PLAY_SCENE));
+ play_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY_SCENE));
play_scene_button->set_tooltip(TTR("Play the edited scene."));
#ifdef OSX_ENABLED
play_scene_button->set_shortcut(ED_SHORTCUT("editor/play_scene", TTR("Play Scene"), KEY_MASK_CMD | KEY_R));
@@ -6414,7 +6359,7 @@ EditorNode::EditorNode() {
play_custom_scene_button->set_toggle_mode(true);
play_custom_scene_button->set_focus_mode(Control::FOCUS_NONE);
play_custom_scene_button->set_icon(gui_base->get_icon("PlayCustom", "EditorIcons"));
- play_custom_scene_button->connect_compat("pressed", this, "_menu_option", make_binds(RUN_PLAY_CUSTOM_SCENE));
+ play_custom_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY_CUSTOM_SCENE));
play_custom_scene_button->set_tooltip(TTR("Play custom scene"));
#ifdef OSX_ENABLED
play_custom_scene_button->set_shortcut(ED_SHORTCUT("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_R));
@@ -6429,7 +6374,7 @@ EditorNode::EditorNode() {
video_driver = memnew(OptionButton);
video_driver->set_flat(true);
video_driver->set_focus_mode(Control::FOCUS_NONE);
- video_driver->connect_compat("item_selected", this, "_video_driver_selected");
+ video_driver->connect("item_selected", callable_mp(this, &EditorNode::_video_driver_selected));
video_driver->add_font_override("font", gui_base->get_font("bold", "EditorFonts"));
// TODO re-enable when GLES2 is ported
video_driver->set_disabled(true);
@@ -6454,7 +6399,7 @@ EditorNode::EditorNode() {
video_restart_dialog = memnew(ConfirmationDialog);
video_restart_dialog->set_text(TTR("Changing the video driver requires restarting the editor."));
video_restart_dialog->get_ok()->set_text(TTR("Save & Restart"));
- video_restart_dialog->connect_compat("confirmed", this, "_menu_option", varray(SET_VIDEO_DRIVER_SAVE_AND_RESTART));
+ video_restart_dialog->connect("confirmed", callable_mp(this, &EditorNode::_menu_option), varray(SET_VIDEO_DRIVER_SAVE_AND_RESTART));
gui_base->add_child(video_restart_dialog);
progress_hb = memnew(BackgroundProgress);
@@ -6463,13 +6408,13 @@ EditorNode::EditorNode() {
gui_base->add_child(layout_dialog);
layout_dialog->set_hide_on_ok(false);
layout_dialog->set_size(Size2(225, 270) * EDSCALE);
- layout_dialog->connect_compat("name_confirmed", this, "_dialog_action");
+ layout_dialog->connect("name_confirmed", callable_mp(this, &EditorNode::_dialog_action));
update_spinner = memnew(MenuButton);
update_spinner->set_tooltip(TTR("Spins when the editor window redraws."));
right_menu_hb->add_child(update_spinner);
update_spinner->set_icon(gui_base->get_icon("Progress1", "EditorIcons"));
- update_spinner->get_popup()->connect_compat("id_pressed", this, "_menu_option");
+ update_spinner->get_popup()->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
p = update_spinner->get_popup();
p->add_radio_check_item(TTR("Update Continuously"), SETTINGS_UPDATE_CONTINUOUSLY);
p->add_radio_check_item(TTR("Update When Changed"), SETTINGS_UPDATE_WHEN_CHANGED);
@@ -6485,9 +6430,9 @@ EditorNode::EditorNode() {
node_dock = memnew(NodeDock);
filesystem_dock = memnew(FileSystemDock(this));
- filesystem_dock->connect_compat("inherit", this, "_inherit_request");
- filesystem_dock->connect_compat("instance", this, "_instance_request");
- filesystem_dock->connect_compat("display_mode_changed", this, "_save_docks");
+ filesystem_dock->connect("inherit", callable_mp(this, &EditorNode::_inherit_request));
+ filesystem_dock->connect("instance", callable_mp(this, &EditorNode::_instance_request));
+ filesystem_dock->connect("display_mode_changed", callable_mp(this, &EditorNode::_save_docks));
// Scene: Top left
dock_slot[DOCK_SLOT_LEFT_UR]->add_child(scene_tree_dock);
@@ -6573,7 +6518,7 @@ EditorNode::EditorNode() {
bottom_panel_hb->add_child(bottom_panel_raise);
bottom_panel_raise->hide();
bottom_panel_raise->set_toggle_mode(true);
- bottom_panel_raise->connect_compat("toggled", this, "_bottom_panel_raise_toggled");
+ bottom_panel_raise->connect("toggled", callable_mp(this, &EditorNode::_bottom_panel_raise_toggled));
log = memnew(EditorLog);
ToolButton *output_button = add_bottom_panel_item(TTR("Output"), log);
@@ -6581,37 +6526,37 @@ EditorNode::EditorNode() {
old_split_ofs = 0;
- center_split->connect_compat("resized", this, "_vp_resized");
+ center_split->connect("resized", callable_mp(this, &EditorNode::_vp_resized));
orphan_resources = memnew(OrphanResourcesDialog);
gui_base->add_child(orphan_resources);
confirmation = memnew(ConfirmationDialog);
gui_base->add_child(confirmation);
- confirmation->connect_compat("confirmed", this, "_menu_confirm_current");
+ confirmation->connect("confirmed", callable_mp(this, &EditorNode::_menu_confirm_current));
save_confirmation = memnew(ConfirmationDialog);
save_confirmation->add_button(TTR("Don't Save"), OS::get_singleton()->get_swap_ok_cancel(), "discard");
gui_base->add_child(save_confirmation);
- save_confirmation->connect_compat("confirmed", this, "_menu_confirm_current");
- save_confirmation->connect_compat("custom_action", this, "_discard_changes");
+ save_confirmation->connect("confirmed", callable_mp(this, &EditorNode::_menu_confirm_current));
+ save_confirmation->connect("custom_action", callable_mp(this, &EditorNode::_discard_changes));
custom_build_manage_templates = memnew(ConfirmationDialog);
custom_build_manage_templates->set_text(TTR("Android build template is missing, please install relevant templates."));
custom_build_manage_templates->get_ok()->set_text(TTR("Manage Templates"));
- custom_build_manage_templates->connect_compat("confirmed", this, "_menu_option", varray(SETTINGS_MANAGE_EXPORT_TEMPLATES));
+ custom_build_manage_templates->connect("confirmed", callable_mp(this, &EditorNode::_menu_option), varray(SETTINGS_MANAGE_EXPORT_TEMPLATES));
gui_base->add_child(custom_build_manage_templates);
install_android_build_template = memnew(ConfirmationDialog);
install_android_build_template->set_text(TTR("This will set up your project for custom Android builds by installing the source template to \"res://android/build\".\nYou can then apply modifications and build your own custom APK on export (adding modules, changing the AndroidManifest.xml, etc.).\nNote that in order to make custom builds instead of using pre-built APKs, the \"Use Custom Build\" option should be enabled in the Android export preset."));
install_android_build_template->get_ok()->set_text(TTR("Install"));
- install_android_build_template->connect_compat("confirmed", this, "_menu_confirm_current");
+ install_android_build_template->connect("confirmed", callable_mp(this, &EditorNode::_menu_confirm_current));
gui_base->add_child(install_android_build_template);
remove_android_build_template = memnew(ConfirmationDialog);
remove_android_build_template->set_text(TTR("The Android build template is already installed in this project and it won't be overwritten.\nRemove the \"res://android/build\" directory manually before attempting this operation again."));
remove_android_build_template->get_ok()->set_text(TTR("Show in File Manager"));
- remove_android_build_template->connect_compat("confirmed", this, "_menu_option", varray(FILE_EXPLORE_ANDROID_BUILD_TEMPLATES));
+ remove_android_build_template->connect("confirmed", callable_mp(this, &EditorNode::_menu_option), varray(FILE_EXPLORE_ANDROID_BUILD_TEMPLATES));
gui_base->add_child(remove_android_build_template);
file_templates = memnew(EditorFileDialog);
@@ -6630,7 +6575,7 @@ EditorNode::EditorNode() {
file_export_lib = memnew(EditorFileDialog);
file_export_lib->set_title(TTR("Export Library"));
file_export_lib->set_mode(EditorFileDialog::MODE_SAVE_FILE);
- file_export_lib->connect_compat("file_selected", this, "_dialog_action");
+ file_export_lib->connect("file_selected", callable_mp(this, &EditorNode::_dialog_action));
file_export_lib_merge = memnew(CheckBox);
file_export_lib_merge->set_text(TTR("Merge With Existing"));
file_export_lib_merge->set_pressed(true);
@@ -6647,16 +6592,16 @@ EditorNode::EditorNode() {
file_script->add_filter("*." + E->get());
}
gui_base->add_child(file_script);
- file_script->connect_compat("file_selected", this, "_dialog_action");
+ file_script->connect("file_selected", callable_mp(this, &EditorNode::_dialog_action));
- file_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option");
- file_menu->connect_compat("about_to_show", this, "_update_file_menu_opened");
- file_menu->get_popup()->connect_compat("popup_hide", this, "_update_file_menu_closed");
+ file_menu->get_popup()->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
+ file_menu->connect("about_to_show", callable_mp(this, &EditorNode::_update_file_menu_opened));
+ file_menu->get_popup()->connect("popup_hide", callable_mp(this, &EditorNode::_update_file_menu_closed));
- settings_menu->get_popup()->connect_compat("id_pressed", this, "_menu_option");
+ settings_menu->get_popup()->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
- file->connect_compat("file_selected", this, "_dialog_action");
- file_templates->connect_compat("file_selected", this, "_dialog_action");
+ file->connect("file_selected", callable_mp(this, &EditorNode::_dialog_action));
+ file_templates->connect("file_selected", callable_mp(this, &EditorNode::_dialog_action));
preview_gen = memnew(AudioStreamPreviewGenerator);
add_child(preview_gen);
@@ -6793,8 +6738,8 @@ EditorNode::EditorNode() {
open_imported = memnew(ConfirmationDialog);
open_imported->get_ok()->set_text(TTR("Open Anyway"));
new_inherited_button = open_imported->add_button(TTR("New Inherited"), !OS::get_singleton()->get_swap_ok_cancel(), "inherit");
- open_imported->connect_compat("confirmed", this, "_open_imported");
- open_imported->connect_compat("custom_action", this, "_inherit_imported");
+ open_imported->connect("confirmed", callable_mp(this, &EditorNode::_open_imported));
+ open_imported->connect("custom_action", callable_mp(this, &EditorNode::_inherit_imported));
gui_base->add_child(open_imported);
saved_version = 1;
@@ -6803,11 +6748,11 @@ EditorNode::EditorNode() {
quick_open = memnew(EditorQuickOpen);
gui_base->add_child(quick_open);
- quick_open->connect_compat("quick_open", this, "_quick_opened");
+ quick_open->connect("quick_open", callable_mp(this, &EditorNode::_quick_opened));
quick_run = memnew(EditorQuickOpen);
gui_base->add_child(quick_run);
- quick_run->connect_compat("quick_open", this, "_quick_run");
+ quick_run->connect("quick_open", callable_mp(this, &EditorNode::_quick_run));
_update_recent_scenes();
@@ -6829,10 +6774,10 @@ EditorNode::EditorNode() {
execute_output_dialog->set_title("");
gui_base->add_child(execute_output_dialog);
- EditorFileSystem::get_singleton()->connect_compat("sources_changed", this, "_sources_changed");
- EditorFileSystem::get_singleton()->connect_compat("filesystem_changed", this, "_fs_changed");
- EditorFileSystem::get_singleton()->connect_compat("resources_reimported", this, "_resources_reimported");
- EditorFileSystem::get_singleton()->connect_compat("resources_reload", this, "_resources_changed");
+ EditorFileSystem::get_singleton()->connect("sources_changed", callable_mp(this, &EditorNode::_sources_changed));
+ EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &EditorNode::_fs_changed));
+ EditorFileSystem::get_singleton()->connect("resources_reimported", callable_mp(this, &EditorNode::_resources_reimported));
+ EditorFileSystem::get_singleton()->connect("resources_reload", callable_mp(this, &EditorNode::_resources_changed));
_build_icon_type_cache();
@@ -6841,7 +6786,7 @@ EditorNode::EditorNode() {
pick_main_scene = memnew(ConfirmationDialog);
gui_base->add_child(pick_main_scene);
pick_main_scene->get_ok()->set_text(TTR("Select"));
- pick_main_scene->connect_compat("confirmed", this, "_menu_option", varray(SETTINGS_PICK_MAIN_SCENE));
+ pick_main_scene->connect("confirmed", callable_mp(this, &EditorNode::_menu_option), varray(SETTINGS_PICK_MAIN_SCENE));
for (int i = 0; i < _init_callbacks.size(); i++)
_init_callbacks[i]();
@@ -6881,7 +6826,7 @@ EditorNode::EditorNode() {
screenshot_timer = memnew(Timer);
screenshot_timer->set_one_shot(true);
screenshot_timer->set_wait_time(settings_menu->get_popup()->get_submenu_popup_delay() + 0.1f);
- screenshot_timer->connect_compat("timeout", this, "_request_screenshot");
+ screenshot_timer->connect("timeout", callable_mp(this, &EditorNode::_request_screenshot));
add_child(screenshot_timer);
screenshot_timer->set_owner(get_owner());
}