diff options
Diffstat (limited to 'editor')
76 files changed, 950 insertions, 853 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index e4a1498305..48218c91dd 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -3443,7 +3443,7 @@ void AnimationTrackEditor::_query_insert(const InsertData &p_id) { if (insert_frame != Engine::get_singleton()->get_frames_drawn()) { //clear insert list for the frame if frame changed - if (insert_confirm->is_visible_in_tree()) + if (insert_confirm->is_visible()) return; //do nothing insert_data.clear(); insert_query = false; @@ -3496,7 +3496,7 @@ void AnimationTrackEditor::_query_insert(const InsertData &p_id) { insert_confirm_bezier->set_visible(all_bezier); insert_confirm->get_ok()->set_text(TTR("Create")); - insert_confirm->popup_centered_minsize(); + insert_confirm->popup_centered(); insert_query = true; } else { call_deferred("_insert_delay"); @@ -5309,7 +5309,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { it->set_metadata(0, md); } - track_copy_dialog->popup_centered_minsize(Size2(350, 500) * EDSCALE); + track_copy_dialog->popup_centered(Size2(350, 500) * EDSCALE); } break; case EDIT_COPY_TRACKS_CONFIRM: { @@ -5578,7 +5578,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { } break; case EDIT_CLEAN_UP_ANIMATION: { - cleanup_dialog->popup_centered_minsize(Size2(300, 0) * EDSCALE); + cleanup_dialog->popup_centered(Size2(300, 0) * EDSCALE); } break; case EDIT_CLEAN_UP_ANIMATION_CONFIRM: { diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 76ad590e14..33743cecaf 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -69,10 +69,10 @@ GotoLineDialog::GotoLineDialog() { set_title(TTR("Go to Line")); VBoxContainer *vbc = memnew(VBoxContainer); - vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE); - vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE); - vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE); - vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE); + vbc->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE); + vbc->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 8 * EDSCALE); + vbc->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -8 * EDSCALE); + vbc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -8 * EDSCALE); add_child(vbc); Label *l = memnew(Label); diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 60a15984ee..9df75de8e8 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -115,7 +115,7 @@ void ConnectDialog::ok_pressed() { if (dst_method->get_text() == "") { error->set_text(TTR("Method in target node must be specified.")); - error->popup_centered_minsize(); + error->popup_centered(); return; } Node *target = tree->get_selected(); @@ -125,7 +125,7 @@ void ConnectDialog::ok_pressed() { if (target->get_script().is_null()) { if (!target->has_method(dst_method->get_text())) { error->set_text(TTR("Target method not found. Specify a valid method or attach a script to the target node.")); - error->popup_centered_minsize(); + error->popup_centered(); return; } } @@ -341,7 +341,7 @@ void ConnectDialog::init(ConnectionData c, bool bEdit) { void ConnectDialog::popup_dialog(const String &p_for_signal) { from_signal->set_text(p_for_signal); - error_label->add_color_override("font_color", get_color("error_color", "Editor")); + error_label->add_color_override("font_color", error_label->get_color("error_color", "Editor")); if (!advanced->is_pressed()) error_label->set_visible(!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root())); @@ -351,14 +351,14 @@ void ConnectDialog::popup_dialog(const String &p_for_signal) { void ConnectDialog::_advanced_pressed() { if (advanced->is_pressed()) { - set_custom_minimum_size(Size2(900, 500) * EDSCALE); + set_min_size(Size2(900, 500) * EDSCALE); connect_to_label->set_text(TTR("Connect to Node:")); tree->set_connect_to_script_mode(false); vbc_right->show(); error_label->hide(); } else { - set_custom_minimum_size(Size2(600, 500) * EDSCALE); + set_min_size(Size2(600, 500) * EDSCALE); set_size(Size2()); connect_to_label->set_text(TTR("Connect to Script:")); tree->set_connect_to_script_mode(true); @@ -369,23 +369,23 @@ void ConnectDialog::_advanced_pressed() { _update_ok_enabled(); - set_position((get_viewport_rect().size - get_custom_minimum_size()) / 2); + popup_centered(); } ConnectDialog::ConnectDialog() { - set_custom_minimum_size(Size2(600, 500) * EDSCALE); + set_min_size(Size2(600, 500) * EDSCALE); VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); HBoxContainer *main_hb = memnew(HBoxContainer); vbc->add_child(main_hb); - main_hb->set_v_size_flags(SIZE_EXPAND_FILL); + main_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL); VBoxContainer *vbc_left = memnew(VBoxContainer); main_hb->add_child(vbc_left); - vbc_left->set_h_size_flags(SIZE_EXPAND_FILL); + vbc_left->set_h_size_flags(Control::SIZE_EXPAND_FILL); from_signal = memnew(LineEdit); from_signal->set_editable(false); @@ -407,13 +407,13 @@ ConnectDialog::ConnectDialog() { vbc_right = memnew(VBoxContainer); main_hb->add_child(vbc_right); - vbc_right->set_h_size_flags(SIZE_EXPAND_FILL); + vbc_right->set_h_size_flags(Control::SIZE_EXPAND_FILL); vbc_right->hide(); HBoxContainer *add_bind_hb = memnew(HBoxContainer); type_list = memnew(OptionButton); - type_list->set_h_size_flags(SIZE_EXPAND_FILL); + type_list->set_h_size_flags(Control::SIZE_EXPAND_FILL); add_bind_hb->add_child(type_list); type_list->add_item("bool", Variant::BOOL); type_list->add_item("int", Variant::INT); @@ -451,7 +451,7 @@ ConnectDialog::ConnectDialog() { vbc_left->add_margin_child(TTR("Receiver Method:"), dstm_hb); dst_method = memnew(LineEdit); - dst_method->set_h_size_flags(SIZE_EXPAND_FILL); + dst_method->set_h_size_flags(Control::SIZE_EXPAND_FILL); dst_method->connect("text_entered", callable_mp(this, &ConnectDialog::_text_entered)); dstm_hb->add_child(dst_method); @@ -477,8 +477,6 @@ ConnectDialog::ConnectDialog() { oneshot->set_tooltip(TTR("Disconnects the signal after its first emission.")); vbc_right->add_child(oneshot); - set_as_toplevel(true); - cdbinds = memnew(ConnectDialogBinds); error = memnew(AcceptDialog); @@ -1072,7 +1070,7 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) { tree->set_select_mode(Tree::SELECT_ROW); tree->set_hide_root(true); vbc->add_child(tree); - tree->set_v_size_flags(SIZE_EXPAND_FILL); + tree->set_v_size_flags(Control::SIZE_EXPAND_FILL); tree->set_allow_rmb_select(true); connect_button = memnew(Button); @@ -1083,11 +1081,9 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) { connect_button->connect("pressed", callable_mp(this, &ConnectionsDock::_connect_pressed)); connect_dialog = memnew(ConnectDialog); - connect_dialog->set_as_toplevel(true); add_child(connect_dialog); disconnect_all_dialog = memnew(ConfirmationDialog); - disconnect_all_dialog->set_as_toplevel(true); add_child(disconnect_all_dialog); disconnect_all_dialog->connect("confirmed", callable_mp(this, &ConnectionsDock::_disconnect_all)); disconnect_all_dialog->set_text(TTR("Are you sure you want to remove all connections from this signal?")); diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index b220e82f6c..4524816a79 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -193,7 +193,7 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p item->set_text(0, p_type + " (" + ScriptServer::get_global_class_path(p_type).get_file() + ")"); } if (!can_instance) { - item->set_custom_color(0, get_color("disabled_font_color", "Editor")); + item->set_custom_color(0, search_options->get_color("disabled_font_color", "Editor")); item->set_selectable(0, false); } else if (!(*to_select && (*to_select)->get_text(0) == search_box->get_text())) { String search_term = search_box->get_text().to_lower(); @@ -310,8 +310,8 @@ void CreateDialog::_update_search() { EditorData &ed = EditorNode::get_editor_data(); root->set_text(0, base_type); - if (has_icon(base_type, "EditorIcons")) { - root->set_icon(0, get_icon(base_type, "EditorIcons")); + if (search_options->has_icon(base_type, "EditorIcons")) { + root->set_icon(0, search_options->get_icon(base_type, "EditorIcons")); } TreeItem *to_select = search_box->get_text() == base_type ? root : NULL; @@ -460,23 +460,22 @@ void CreateDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { connect("confirmed", callable_mp(this, &CreateDialog::_confirmed)); - search_box->set_right_icon(get_icon("Search", "EditorIcons")); + search_box->set_right_icon(search_options->get_icon("Search", "EditorIcons")); search_box->set_clear_button_enabled(true); - favorite->set_icon(get_icon("Favorites", "EditorIcons")); + favorite->set_icon(search_options->get_icon("Favorites", "EditorIcons")); } break; case NOTIFICATION_EXIT_TREE: { disconnect("confirmed", callable_mp(this, &CreateDialog::_confirmed)); } break; case NOTIFICATION_VISIBILITY_CHANGED: { - if (is_visible_in_tree()) { + if (is_visible()) { search_box->call_deferred("grab_focus"); // still not visible search_box->select_all(); + } else { + EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2(get_position(), get_size())); + search_loaded_scripts.clear(); } } break; - case NOTIFICATION_POPUP_HIDE: { - EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", get_rect()); - search_loaded_scripts.clear(); - } break; } } @@ -562,7 +561,7 @@ void CreateDialog::_item_selected() { } void CreateDialog::_hide_requested() { - _closed(); // From WindowDialog. + _cancel_pressed(); // From AcceptDialog. } void CreateDialog::_favorite_toggled() { @@ -662,7 +661,7 @@ Variant CreateDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) { ToolButton *tb = memnew(ToolButton); tb->set_icon(ti->get_icon(0)); tb->set_text(ti->get_text(0)); - set_drag_preview(tb); + favorites->set_drag_preview(tb); return d; } @@ -743,8 +742,6 @@ CreateDialog::CreateDialog() { is_replace_mode = false; - set_resizable(true); - HSplitContainer *hsc = memnew(HSplitContainer); add_child(hsc); @@ -754,7 +751,7 @@ CreateDialog::CreateDialog() { VBoxContainer *fav_vb = memnew(VBoxContainer); vsc->add_child(fav_vb); fav_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE); - fav_vb->set_v_size_flags(SIZE_EXPAND_FILL); + fav_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL); favorites = memnew(Tree); fav_vb->add_margin_child(TTR("Favorites:"), favorites, true); @@ -763,13 +760,16 @@ CreateDialog::CreateDialog() { favorites->set_allow_reselect(true); favorites->connect("cell_selected", callable_mp(this, &CreateDialog::_favorite_selected)); favorites->connect("item_activated", callable_mp(this, &CreateDialog::_favorite_activated)); - favorites->set_drag_forwarding(this); +#ifndef _MSC_VER +#warning cant forward drag data to a non control, must be fixed +#endif + //favorites->set_drag_forwarding(this); favorites->add_constant_override("draw_guides", 1); VBoxContainer *rec_vb = memnew(VBoxContainer); vsc->add_child(rec_vb); rec_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE); - rec_vb->set_v_size_flags(SIZE_EXPAND_FILL); + rec_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL); recent = memnew(Tree); rec_vb->add_margin_child(TTR("Recent:"), recent, true); @@ -783,10 +783,10 @@ CreateDialog::CreateDialog() { VBoxContainer *vbc = memnew(VBoxContainer); hsc->add_child(vbc); vbc->set_custom_minimum_size(Size2(300, 0) * EDSCALE); - vbc->set_h_size_flags(SIZE_EXPAND_FILL); + vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); HBoxContainer *search_hb = memnew(HBoxContainer); search_box = memnew(LineEdit); - search_box->set_h_size_flags(SIZE_EXPAND_FILL); + search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); search_hb->add_child(search_box); favorite = memnew(Button); favorite->set_flat(true); diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index 51242667ac..adc106eb81 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -230,7 +230,7 @@ void EditorDebuggerTree::_item_menu_id_pressed(int p_option) { case ITEM_MENU_SAVE_REMOTE_NODE: { file_dialog->set_access(EditorFileDialog::ACCESS_RESOURCES); - file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); List<String> extensions; Ref<PackedScene> sd = memnew(PackedScene); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 9a15902982..cf36397a9a 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -979,7 +979,7 @@ void ScriptEditorDebugger::_stack_dump_frame_selected() { void ScriptEditorDebugger::_export_csv() { - file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); file_dialog->popup_centered_ratio(); } diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 5a0accd45c..d0efa66124 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -174,7 +174,7 @@ void DependencyEditor::_update_list() { TreeItem *root = tree->create_item(); - Ref<Texture2D> folder = get_icon("folder", "FileDialog"); + Ref<Texture2D> folder = tree->get_icon("folder", "FileDialog"); bool broken = false; @@ -256,7 +256,7 @@ DependencyEditor::DependencyEditor() { vb->add_child(hbc); MarginContainer *mc = memnew(MarginContainer); - mc->set_v_size_flags(SIZE_EXPAND_FILL); + mc->set_v_size_flags(Control::SIZE_EXPAND_FILL); mc->add_child(tree); vb->add_child(mc); @@ -264,7 +264,7 @@ DependencyEditor::DependencyEditor() { set_title(TTR("Dependency Editor")); search = memnew(EditorFileDialog); search->connect("file_selected", callable_mp(this, &DependencyEditor::_searched)); - search->set_mode(EditorFileDialog::MODE_OPEN_FILE); + search->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); search->set_title(TTR("Search Replacement Resource:")); add_child(search); } @@ -422,17 +422,17 @@ void DependencyRemoveDialog::_build_removed_dependency_tree(const Vector<Removed if (!tree_items.has(rd.dependency_folder)) { TreeItem *folder_item = owners->create_item(owners->get_root()); folder_item->set_text(0, rd.dependency_folder); - folder_item->set_icon(0, get_icon("Folder", "EditorIcons")); + folder_item->set_icon(0, owners->get_icon("Folder", "EditorIcons")); tree_items[rd.dependency_folder] = folder_item; } TreeItem *dependency_item = owners->create_item(tree_items[rd.dependency_folder]); dependency_item->set_text(0, rd.dependency); - dependency_item->set_icon(0, get_icon("Warning", "EditorIcons")); + dependency_item->set_icon(0, owners->get_icon("Warning", "EditorIcons")); tree_items[rd.dependency] = dependency_item; } else { TreeItem *dependency_item = owners->create_item(owners->get_root()); dependency_item->set_text(0, rd.dependency); - dependency_item->set_icon(0, get_icon("Warning", "EditorIcons")); + dependency_item->set_icon(0, owners->get_icon("Warning", "EditorIcons")); tree_items[rd.dependency] = dependency_item; } } @@ -580,7 +580,7 @@ DependencyRemoveDialog::DependencyRemoveDialog() { owners = memnew(Tree); owners->set_hide_root(true); vb->add_child(owners); - owners->set_v_size_flags(SIZE_EXPAND_FILL); + owners->set_v_size_flags(Control::SIZE_EXPAND_FILL); } ////////////// @@ -636,9 +636,9 @@ DependencyErrorDialog::DependencyErrorDialog() { files = memnew(Tree); files->set_hide_root(true); vb->add_margin_child(TTR("Load failed due to missing dependencies:"), files, true); - files->set_v_size_flags(SIZE_EXPAND_FILL); + files->set_v_size_flags(Control::SIZE_EXPAND_FILL); - set_custom_minimum_size(Size2(500, 220) * EDSCALE); + set_min_size(Size2(500, 220) * EDSCALE); get_ok()->set_text(TTR("Open Anyway")); get_cancel()->set_text(TTR("Close")); @@ -662,7 +662,7 @@ void OrphanResourcesDialog::ok_pressed() { return; delete_confirm->set_text(vformat(TTR("Permanently delete %d item(s)? (No undo!)"), paths.size())); - delete_confirm->popup_centered_clamped(delete_confirm->get_minimum_size()); + delete_confirm->popup_centered(); } bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMap<String, int> &refs, TreeItem *p_parent) { @@ -678,7 +678,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa if (p_parent) { dir_item = files->create_item(p_parent); dir_item->set_text(0, efsd->get_subdir(i)->get_name()); - dir_item->set_icon(0, get_icon("folder", "FileDialog")); + dir_item->set_icon(0, files->get_icon("folder", "FileDialog")); } bool children = _fill_owners(efsd->get_subdir(i), refs, dir_item); @@ -717,7 +717,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa int ds = efsd->get_file_deps(i).size(); ti->set_text(1, itos(ds)); if (ds) { - ti->add_button(1, get_icon("GuiVisibilityVisible", "EditorIcons"), -1, false, TTR("Show Dependencies")); + ti->add_button(1, files->get_icon("GuiVisibilityVisible", "EditorIcons"), -1, false, TTR("Show Dependencies")); } ti->set_metadata(0, path); has_children = true; diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index a223cee360..ea1918be59 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -37,20 +37,23 @@ #include "core/version.h" #include "core/version_hash.gen.h" +void EditorAbout::_theme_changed() { + + Control *base = EditorNode::get_singleton()->get_gui_base(); + Ref<Font> font = base->get_font("source", "EditorFonts"); + _tpl_text->add_font_override("normal_font", font); + _tpl_text->add_constant_override("line_separation", 6 * EDSCALE); + _license_text->add_font_override("normal_font", font); + _license_text->add_constant_override("line_separation", 6 * EDSCALE); + _logo->set_texture(base->get_icon("Logo", "EditorIcons")); +} + void EditorAbout::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: - case NOTIFICATION_THEME_CHANGED: { - - Control *base = EditorNode::get_singleton()->get_gui_base(); - Ref<Font> font = base->get_font("source", "EditorFonts"); - _tpl_text->add_font_override("normal_font", font); - _tpl_text->add_constant_override("line_separation", 6 * EDSCALE); - _license_text->add_font_override("normal_font", font); - _license_text->add_constant_override("line_separation", 6 * EDSCALE); - _logo->set_texture(base->get_icon("Logo", "EditorIcons")); + case NOTIFICATION_ENTER_TREE: { + _theme_changed(); } break; } } @@ -115,9 +118,9 @@ EditorAbout::EditorAbout() { set_title(TTR("Thanks from the Godot community!")); set_hide_on_ok(true); - set_resizable(true); VBoxContainer *vbc = memnew(VBoxContainer); + vbc->connect("theme_changed", callable_mp(this, &EditorAbout::_theme_changed)); HBoxContainer *hbc = memnew(HBoxContainer); hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); hbc->set_alignment(BoxContainer::ALIGN_CENTER); diff --git a/editor/editor_about.h b/editor/editor_about.h index 51438ee953..83e9e9f490 100644 --- a/editor/editor_about.h +++ b/editor/editor_about.h @@ -57,6 +57,8 @@ private: RichTextLabel *_tpl_text; TextureRect *_logo; + void _theme_changed(); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index e26d44025f..cbec6a18d8 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -112,17 +112,17 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { Map<String, Ref<Texture2D>> extension_guess; { - extension_guess["png"] = get_icon("ImageTexture", "EditorIcons"); - extension_guess["jpg"] = get_icon("ImageTexture", "EditorIcons"); - extension_guess["atlastex"] = get_icon("AtlasTexture", "EditorIcons"); - extension_guess["scn"] = get_icon("PackedScene", "EditorIcons"); - extension_guess["tscn"] = get_icon("PackedScene", "EditorIcons"); - extension_guess["shader"] = get_icon("Shader", "EditorIcons"); - extension_guess["gd"] = get_icon("GDScript", "EditorIcons"); - extension_guess["vs"] = get_icon("VisualScript", "EditorIcons"); + extension_guess["png"] = tree->get_icon("ImageTexture", "EditorIcons"); + extension_guess["jpg"] = tree->get_icon("ImageTexture", "EditorIcons"); + extension_guess["atlastex"] = tree->get_icon("AtlasTexture", "EditorIcons"); + extension_guess["scn"] = tree->get_icon("PackedScene", "EditorIcons"); + extension_guess["tscn"] = tree->get_icon("PackedScene", "EditorIcons"); + extension_guess["shader"] = tree->get_icon("Shader", "EditorIcons"); + extension_guess["gd"] = tree->get_icon("GDScript", "EditorIcons"); + extension_guess["vs"] = tree->get_icon("VisualScript", "EditorIcons"); } - Ref<Texture2D> generic_extension = get_icon("Object", "EditorIcons"); + Ref<Texture2D> generic_extension = tree->get_icon("Object", "EditorIcons"); unzClose(pkg); @@ -131,7 +131,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { TreeItem *root = tree->create_item(); root->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); root->set_checked(0, true); - root->set_icon(0, get_icon("folder", "FileDialog")); + root->set_icon(0, tree->get_icon("folder", "FileDialog")); root->set_text(0, "res://"); root->set_editable(0, true); Map<String, TreeItem *> dir_map; @@ -180,7 +180,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { if (isdir) { dir_map[path] = ti; ti->set_text(0, path.get_file() + "/"); - ti->set_icon(0, get_icon("folder", "FileDialog")); + ti->set_icon(0, tree->get_icon("folder", "FileDialog")); ti->set_metadata(0, String()); } else { String file = path.get_file(); @@ -194,7 +194,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { String res_path = "res://" + path; if (FileAccess::exists(res_path)) { - ti->set_custom_color(0, get_color("error_color", "Editor")); + ti->set_custom_color(0, tree->get_color("error_color", "Editor")); ti->set_tooltip(0, vformat(TTR("%s (Already Exists)"), res_path)); ti->set_checked(0, false); } else { diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 7feebafe45..04f19a48ed 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -1204,7 +1204,7 @@ void EditorAudioBuses::_select_layout() { void EditorAudioBuses::_save_as_layout() { - file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_dialog->set_title(TTR("Save Audio Bus Layout As...")); file_dialog->set_current_path(edited_path); file_dialog->popup_centered_ratio(); @@ -1213,7 +1213,7 @@ void EditorAudioBuses::_save_as_layout() { void EditorAudioBuses::_new_layout() { - file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_dialog->set_title(TTR("Location for New Layout...")); file_dialog->set_current_path(edited_path); file_dialog->popup_centered_ratio(); @@ -1222,7 +1222,7 @@ void EditorAudioBuses::_new_layout() { void EditorAudioBuses::_load_layout() { - file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); file_dialog->set_title(TTR("Open Audio Bus Layout")); file_dialog->set_current_path(edited_path); file_dialog->popup_centered_ratio(); @@ -1249,7 +1249,7 @@ void EditorAudioBuses::_load_default_layout() { void EditorAudioBuses::_file_dialog_callback(const String &p_string) { - if (file_dialog->get_mode() == EditorFileDialog::MODE_OPEN_FILE) { + if (file_dialog->get_file_mode() == EditorFileDialog::FILE_MODE_OPEN_FILE) { Ref<AudioBusLayout> state = ResourceLoader::load(p_string, "", true); if (state.is_null()) { EditorNode::get_singleton()->show_warning(TTR("Invalid file, not an audio bus layout.")); @@ -1263,7 +1263,7 @@ void EditorAudioBuses::_file_dialog_callback(const String &p_string) { EditorNode::get_singleton()->get_undo_redo()->clear_history(); call_deferred("_select_layout"); - } else if (file_dialog->get_mode() == EditorFileDialog::MODE_SAVE_FILE) { + } else if (file_dialog->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) { if (new_layout) { Ref<AudioBusLayout> empty_state; diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index a02346c872..5c9fd675d4 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -825,7 +825,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() { autoload_add_path = memnew(EditorLineEditFileChooser); autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL); - autoload_add_path->get_file_dialog()->set_mode(EditorFileDialog::MODE_OPEN_FILE); + autoload_add_path->get_file_dialog()->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); autoload_add_path->get_file_dialog()->connect("file_selected", callable_mp(this, &EditorAutoloadSettings::_autoload_file_callback)); autoload_add_path->get_line_edit()->connect("text_changed", callable_mp(this, &EditorAutoloadSettings::_autoload_path_text_changed)); diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp index 2e71fdb75e..3162bea2ff 100644 --- a/editor/editor_dir_dialog.cpp +++ b/editor/editor_dir_dialog.cpp @@ -44,7 +44,7 @@ void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p String path = p_dir->get_path(); p_item->set_metadata(0, p_dir->get_path()); - p_item->set_icon(0, get_icon("Folder", "EditorIcons")); + p_item->set_icon(0, tree->get_icon("Folder", "EditorIcons")); if (!p_item->get_parent()) { p_item->set_text(0, "res://"); @@ -69,7 +69,7 @@ void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p void EditorDirDialog::reload(const String &p_path) { - if (!is_visible_in_tree()) { + if (!is_visible()) { must_reload = true; return; } @@ -103,7 +103,7 @@ void EditorDirDialog::_notification(int p_what) { } if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { - if (must_reload && is_visible_in_tree()) { + if (must_reload && is_visible()) { reload(); } } @@ -142,11 +142,11 @@ void EditorDirDialog::_make_dir() { TreeItem *ti = tree->get_selected(); if (!ti) { mkdirerr->set_text(TTR("Please select a base directory first.")); - mkdirerr->popup_centered_minsize(); + mkdirerr->popup_centered(); return; } - makedialog->popup_centered_minsize(Size2(250, 80)); + makedialog->popup_centered(Size2(250, 80)); makedirname->grab_focus(); } @@ -163,7 +163,7 @@ void EditorDirDialog::_make_dir_confirm() { Error err = d->make_dir(makedirname->get_text()); if (err != OK) { - mkdirerr->popup_centered_minsize(Size2(250, 80) * EDSCALE); + mkdirerr->popup_centered(Size2(250, 80) * EDSCALE); } else { opened_paths.insert(dir); //reload(dir.plus_file(makedirname->get_text())); diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 4b0bbdcec2..d572280d91 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -420,7 +420,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) { } break; case PROFILE_NEW: { - new_profile_dialog->popup_centered_minsize(); + new_profile_dialog->popup_centered(); new_profile_name->clear(); new_profile_name->grab_focus(); } break; @@ -430,7 +430,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) { ERR_FAIL_COND(selected == String()); erase_profile_dialog->set_text(vformat(TTR("Erase profile '%s'? (no undo)"), selected)); - erase_profile_dialog->popup_centered_minsize(); + erase_profile_dialog->popup_centered(); } break; } } @@ -485,7 +485,7 @@ void EditorFeatureProfileManager::_fill_classes_from(TreeItem *p_parent, const S bool disabled_editor = edited->is_class_editor_disabled(p_class); bool disabled_properties = edited->has_class_properties_disabled(p_class); if (disabled) { - class_item->set_custom_color(0, get_color("disabled_font_color", "Editor")); + class_item->set_custom_color(0, class_list->get_color("disabled_font_color", "Editor")); } else if (disabled_editor && disabled_properties) { text += " " + TTR("(Editor Disabled, Properties Disabled)"); } else if (disabled_properties) { @@ -805,7 +805,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { current_profile_name = memnew(LineEdit); name_hbc->add_child(current_profile_name); current_profile_name->set_editable(false); - current_profile_name->set_h_size_flags(SIZE_EXPAND_FILL); + current_profile_name->set_h_size_flags(Control::SIZE_EXPAND_FILL); profile_actions[PROFILE_CLEAR] = memnew(Button(TTR("Unset"))); name_hbc->add_child(profile_actions[PROFILE_CLEAR]); profile_actions[PROFILE_CLEAR]->set_disabled(true); @@ -815,7 +815,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { HBoxContainer *profiles_hbc = memnew(HBoxContainer); profile_list = memnew(OptionButton); - profile_list->set_h_size_flags(SIZE_EXPAND_FILL); + profile_list->set_h_size_flags(Control::SIZE_EXPAND_FILL); profiles_hbc->add_child(profile_list); profile_list->connect("item_selected", callable_mp(this, &EditorFeatureProfileManager::_profile_selected)); @@ -849,12 +849,12 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { main_vbc->add_margin_child(TTR("Available Profiles:"), profiles_hbc); h_split = memnew(HSplitContainer); - h_split->set_v_size_flags(SIZE_EXPAND_FILL); + h_split->set_v_size_flags(Control::SIZE_EXPAND_FILL); main_vbc->add_child(h_split); VBoxContainer *class_list_vbc = memnew(VBoxContainer); h_split->add_child(class_list_vbc); - class_list_vbc->set_h_size_flags(SIZE_EXPAND_FILL); + class_list_vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); class_list = memnew(Tree); class_list_vbc->add_margin_child(TTR("Enabled Classes:"), class_list, true); @@ -865,7 +865,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { VBoxContainer *property_list_vbc = memnew(VBoxContainer); h_split->add_child(property_list_vbc); - property_list_vbc->set_h_size_flags(SIZE_EXPAND_FILL); + property_list_vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); property_list = memnew(Tree); property_list_vbc->add_margin_child(TTR("Class Options"), property_list, true); @@ -891,7 +891,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { import_profiles = memnew(EditorFileDialog); add_child(import_profiles); - import_profiles->set_mode(EditorFileDialog::MODE_OPEN_FILES); + import_profiles->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILES); import_profiles->add_filter("*.profile; " + TTR("Godot Feature Profile")); import_profiles->connect("files_selected", callable_mp(this, &EditorFeatureProfileManager::_import_profiles)); import_profiles->set_title(TTR("Import Profile(s)")); @@ -899,7 +899,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { export_profile = memnew(EditorFileDialog); add_child(export_profile); - export_profile->set_mode(EditorFileDialog::MODE_SAVE_FILE); + export_profile->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); export_profile->add_filter("*.profile; " + TTR("Godot Feature Profile")); export_profile->connect("file_selected", callable_mp(this, &EditorFeatureProfileManager::_export_profile)); export_profile->set_title(TTR("Export Profile")); diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index ff2b8dfd1e..3e45855207 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -59,17 +59,17 @@ void EditorFileDialog::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { // update icons - mode_thumbnails->set_icon(get_icon("FileThumbnail", "EditorIcons")); - mode_list->set_icon(get_icon("FileList", "EditorIcons")); - dir_prev->set_icon(get_icon("Back", "EditorIcons")); - dir_next->set_icon(get_icon("Forward", "EditorIcons")); - dir_up->set_icon(get_icon("ArrowUp", "EditorIcons")); - refresh->set_icon(get_icon("Reload", "EditorIcons")); - favorite->set_icon(get_icon("Favorites", "EditorIcons")); - show_hidden->set_icon(get_icon("GuiVisibilityVisible", "EditorIcons")); - - fav_up->set_icon(get_icon("MoveUp", "EditorIcons")); - fav_down->set_icon(get_icon("MoveDown", "EditorIcons")); + mode_thumbnails->set_icon(item_list->get_icon("FileThumbnail", "EditorIcons")); + mode_list->set_icon(item_list->get_icon("FileList", "EditorIcons")); + dir_prev->set_icon(item_list->get_icon("Back", "EditorIcons")); + dir_next->set_icon(item_list->get_icon("Forward", "EditorIcons")); + dir_up->set_icon(item_list->get_icon("ArrowUp", "EditorIcons")); + refresh->set_icon(item_list->get_icon("Reload", "EditorIcons")); + favorite->set_icon(item_list->get_icon("Favorites", "EditorIcons")); + show_hidden->set_icon(item_list->get_icon("GuiVisibilityVisible", "EditorIcons")); + + fav_up->set_icon(item_list->get_icon("MoveUp", "EditorIcons")); + fav_down->set_icon(item_list->get_icon("MoveDown", "EditorIcons")); } else if (p_what == NOTIFICATION_PROCESS) { @@ -79,14 +79,11 @@ void EditorFileDialog::_notification(int p_what) { preview_wheel_index++; if (preview_wheel_index >= 8) preview_wheel_index = 0; - Ref<Texture2D> frame = get_icon("Progress" + itos(preview_wheel_index + 1), "EditorIcons"); + Ref<Texture2D> frame = item_list->get_icon("Progress" + itos(preview_wheel_index + 1), "EditorIcons"); preview->set_texture(frame); preview_wheel_timeout = 0.1; } } - } else if (p_what == NOTIFICATION_POPUP_HIDE) { - - set_process_unhandled_input(false); } else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { @@ -96,18 +93,23 @@ void EditorFileDialog::_notification(int p_what) { set_display_mode((DisplayMode)EditorSettings::get_singleton()->get("filesystem/file_dialog/display_mode").operator int()); // update icons - mode_thumbnails->set_icon(get_icon("FileThumbnail", "EditorIcons")); - mode_list->set_icon(get_icon("FileList", "EditorIcons")); - dir_prev->set_icon(get_icon("Back", "EditorIcons")); - dir_next->set_icon(get_icon("Forward", "EditorIcons")); - dir_up->set_icon(get_icon("ArrowUp", "EditorIcons")); - refresh->set_icon(get_icon("Reload", "EditorIcons")); - favorite->set_icon(get_icon("Favorites", "EditorIcons")); - - fav_up->set_icon(get_icon("MoveUp", "EditorIcons")); - fav_down->set_icon(get_icon("MoveDown", "EditorIcons")); + mode_thumbnails->set_icon(item_list->get_icon("FileThumbnail", "EditorIcons")); + mode_list->set_icon(item_list->get_icon("FileList", "EditorIcons")); + dir_prev->set_icon(item_list->get_icon("Back", "EditorIcons")); + dir_next->set_icon(item_list->get_icon("Forward", "EditorIcons")); + dir_up->set_icon(item_list->get_icon("ArrowUp", "EditorIcons")); + refresh->set_icon(item_list->get_icon("Reload", "EditorIcons")); + favorite->set_icon(item_list->get_icon("Favorites", "EditorIcons")); + + fav_up->set_icon(item_list->get_icon("MoveUp", "EditorIcons")); + fav_down->set_icon(item_list->get_icon("MoveDown", "EditorIcons")); // DO NOT CALL UPDATE FILE LIST HERE, ALL HUNDREDS OF HIDDEN DIALOGS WILL RESPOND, CALL INVALIDATE INSTEAD invalidate(); + } else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { + + if (!is_visible()) { + set_process_unhandled_input(false); + } } } @@ -115,7 +117,7 @@ void EditorFileDialog::_unhandled_input(const Ref<InputEvent> &p_event) { Ref<InputEventKey> k = p_event; - if (k.is_valid() && is_window_modal_on_top()) { + if (k.is_valid()) { if (k->is_pressed()) { @@ -177,7 +179,7 @@ void EditorFileDialog::_unhandled_input(const Ref<InputEvent> &p_event) { } if (handled) { - accept_event(); + set_input_as_handled(); } } } @@ -209,15 +211,15 @@ void EditorFileDialog::update_dir() { get_ok()->set_disabled(_is_open_should_be_disabled()); switch (mode) { - case MODE_OPEN_FILE: - case MODE_OPEN_FILES: + case FILE_MODE_OPEN_FILE: + case FILE_MODE_OPEN_FILES: get_ok()->set_text(TTR("Open")); break; - case MODE_OPEN_DIR: + case FILE_MODE_OPEN_DIR: get_ok()->set_text(TTR("Select Current Folder")); break; - case MODE_OPEN_ANY: - case MODE_SAVE_FILE: + case FILE_MODE_OPEN_ANY: + case FILE_MODE_SAVE_FILE: // FIXME: Implement, or refactor to avoid duplication with set_mode break; } @@ -252,23 +254,23 @@ void EditorFileDialog::_post_popup() { update_file_list(); invalidated = false; } - if (mode == MODE_SAVE_FILE) + if (mode == FILE_MODE_SAVE_FILE) file->grab_focus(); else item_list->grab_focus(); - if (mode == MODE_OPEN_DIR) { + if (mode == FILE_MODE_OPEN_DIR) { file_box->set_visible(false); } else { file_box->set_visible(true); } - if (is_visible_in_tree() && get_current_file() != "") + if (is_visible() && get_current_file() != "") _request_single_thumbnail(get_current_dir().plus_file(get_current_file())); - if (is_visible_in_tree()) { - Ref<Texture2D> folder = get_icon("folder", "FileDialog"); - const Color folder_color = get_color("folder_icon_modulate", "FileDialog"); + if (is_visible()) { + Ref<Texture2D> folder = item_list->get_icon("folder", "FileDialog"); + const Color folder_color = item_list->get_color("folder_icon_modulate", "FileDialog"); recent->clear(); bool res = access == ACCESS_RESOURCES; @@ -347,7 +349,7 @@ void EditorFileDialog::_request_single_thumbnail(const String &p_path) { void EditorFileDialog::_action_pressed() { - if (mode == MODE_OPEN_FILES) { + if (mode == FILE_MODE_OPEN_FILES) { String fbase = dir_access->get_current_dir(); @@ -368,11 +370,11 @@ void EditorFileDialog::_action_pressed() { String f = dir_access->get_current_dir().plus_file(file->get_text()); - if ((mode == MODE_OPEN_ANY || mode == MODE_OPEN_FILE) && dir_access->file_exists(f)) { + if ((mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_FILE) && dir_access->file_exists(f)) { _save_to_recent(); hide(); emit_signal("file_selected", f); - } else if (mode == MODE_OPEN_ANY || mode == MODE_OPEN_DIR) { + } else if (mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_DIR) { String path = dir_access->get_current_dir(); @@ -394,7 +396,7 @@ void EditorFileDialog::_action_pressed() { emit_signal("dir_selected", path); } - if (mode == MODE_SAVE_FILE) { + if (mode == FILE_MODE_SAVE_FILE) { bool valid = false; @@ -447,7 +449,7 @@ void EditorFileDialog::_action_pressed() { if (!valid) { - exterr->popup_centered_minsize(Size2(250, 80) * EDSCALE); + exterr->popup_centered(Size2(250, 80) * EDSCALE); return; } @@ -482,7 +484,7 @@ void EditorFileDialog::_item_selected(int p_item) { file->set_text(d["name"]); _request_single_thumbnail(get_current_dir().plus_file(get_current_file())); - } else if (mode == MODE_OPEN_DIR) { + } else if (mode == FILE_MODE_OPEN_DIR) { get_ok()->set_text(TTR("Select This Folder")); } @@ -513,19 +515,19 @@ void EditorFileDialog::_items_clear_selection() { // If nothing is selected, then block Open button. switch (mode) { - case MODE_OPEN_FILE: - case MODE_OPEN_FILES: + case FILE_MODE_OPEN_FILE: + case FILE_MODE_OPEN_FILES: get_ok()->set_text(TTR("Open")); get_ok()->set_disabled(!item_list->is_anything_selected()); break; - case MODE_OPEN_DIR: + case FILE_MODE_OPEN_DIR: get_ok()->set_disabled(false); get_ok()->set_text(TTR("Select Current Folder")); break; - case MODE_OPEN_ANY: - case MODE_SAVE_FILE: + case FILE_MODE_OPEN_ANY: + case FILE_MODE_SAVE_FILE: // FIXME: Implement, or refactor to avoid duplication with set_mode break; } @@ -587,16 +589,16 @@ void EditorFileDialog::_item_list_item_rmb_selected(int p_item, const Vector2 &p } if (single_item_selected) { - item_menu->add_icon_item(get_icon("ActionCopy", "EditorIcons"), TTR("Copy Path"), ITEM_MENU_COPY_PATH); + item_menu->add_icon_item(item_list->get_icon("ActionCopy", "EditorIcons"), TTR("Copy Path"), ITEM_MENU_COPY_PATH); } if (allow_delete) { - item_menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete"), ITEM_MENU_DELETE, KEY_DELETE); + item_menu->add_icon_item(item_list->get_icon("Remove", "EditorIcons"), TTR("Delete"), ITEM_MENU_DELETE, KEY_DELETE); } if (single_item_selected) { item_menu->add_separator(); Dictionary item_meta = item_list->get_item_metadata(p_item); String item_text = item_meta["dir"] ? TTR("Open in File Manager") : TTR("Show in File Manager"); - item_menu->add_icon_item(get_icon("Filesystem", "EditorIcons"), item_text, ITEM_MENU_SHOW_IN_EXPLORER); + item_menu->add_icon_item(item_list->get_icon("Filesystem", "EditorIcons"), item_text, ITEM_MENU_SHOW_IN_EXPLORER); } if (item_menu->get_item_count() > 0) { @@ -616,11 +618,11 @@ void EditorFileDialog::_item_list_rmb_clicked(const Vector2 &p_pos) { item_menu->set_size(Size2(1, 1)); if (can_create_dir) { - item_menu->add_icon_item(get_icon("folder", "FileDialog"), TTR("New Folder..."), ITEM_MENU_NEW_FOLDER, KEY_MASK_CMD | KEY_N); + item_menu->add_icon_item(item_list->get_icon("folder", "FileDialog"), TTR("New Folder..."), ITEM_MENU_NEW_FOLDER, KEY_MASK_CMD | KEY_N); } - item_menu->add_icon_item(get_icon("Reload", "EditorIcons"), TTR("Refresh"), ITEM_MENU_REFRESH, KEY_F5); + item_menu->add_icon_item(item_list->get_icon("Reload", "EditorIcons"), TTR("Refresh"), ITEM_MENU_REFRESH, KEY_F5); item_menu->add_separator(); - item_menu->add_icon_item(get_icon("Filesystem", "EditorIcons"), TTR("Open in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER); + item_menu->add_icon_item(item_list->get_icon("Filesystem", "EditorIcons"), TTR("Open in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER); item_menu->set_position(item_list->get_global_position() + p_pos); item_menu->popup(); @@ -668,18 +670,18 @@ void EditorFileDialog::_item_menu_id_pressed(int p_option) { bool EditorFileDialog::_is_open_should_be_disabled() { - if (mode == MODE_OPEN_ANY || mode == MODE_SAVE_FILE) + if (mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_SAVE_FILE) return false; Vector<int> items = item_list->get_selected_items(); if (items.size() == 0) - return mode != MODE_OPEN_DIR; // In "Open folder" mode, having nothing selected picks the current folder. + return mode != FILE_MODE_OPEN_DIR; // In "Open folder" mode, having nothing selected picks the current folder. for (int i = 0; i < items.size(); i++) { Dictionary d = item_list->get_item_metadata(items.get(i)); - if (((mode == MODE_OPEN_FILE || mode == MODE_OPEN_FILES) && d["dir"]) || (mode == MODE_OPEN_DIR && !d["dir"])) + if (((mode == FILE_MODE_OPEN_FILE || mode == FILE_MODE_OPEN_FILES) && d["dir"]) || (mode == FILE_MODE_OPEN_DIR && !d["dir"])) return true; } @@ -725,11 +727,11 @@ void EditorFileDialog::update_file_list() { item_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); if (thumbnail_size < 64) { - folder_thumbnail = get_icon("FolderMediumThumb", "EditorIcons"); - file_thumbnail = get_icon("FileMediumThumb", "EditorIcons"); + folder_thumbnail = item_list->get_icon("FolderMediumThumb", "EditorIcons"); + file_thumbnail = item_list->get_icon("FileMediumThumb", "EditorIcons"); } else { - folder_thumbnail = get_icon("FolderBigThumb", "EditorIcons"); - file_thumbnail = get_icon("FileBigThumb", "EditorIcons"); + folder_thumbnail = item_list->get_icon("FolderBigThumb", "EditorIcons"); + file_thumbnail = item_list->get_icon("FileBigThumb", "EditorIcons"); } preview_vb->hide(); @@ -749,8 +751,8 @@ void EditorFileDialog::update_file_list() { dir_access->list_dir_begin(); - Ref<Texture2D> folder = get_icon("folder", "FileDialog"); - const Color folder_color = get_color("folder_icon_modulate", "FileDialog"); + Ref<Texture2D> folder = item_list->get_icon("folder", "FileDialog"); + const Color folder_color = item_list->get_color("folder_icon_modulate", "FileDialog"); List<String> files; List<String> dirs; @@ -979,7 +981,7 @@ void EditorFileDialog::set_current_file(const String &p_file) { file->grab_focus(); } - if (is_visible_in_tree()) + if (is_visible()) _request_single_thumbnail(get_current_dir().plus_file(get_current_file())); } void EditorFileDialog::set_current_path(const String &p_path) { @@ -999,39 +1001,39 @@ void EditorFileDialog::set_current_path(const String &p_path) { } } -void EditorFileDialog::set_mode(Mode p_mode) { +void EditorFileDialog::set_file_mode(FileMode p_mode) { mode = p_mode; switch (mode) { - case MODE_OPEN_FILE: + case FILE_MODE_OPEN_FILE: get_ok()->set_text(TTR("Open")); set_title(TTR("Open a File")); can_create_dir = false; break; - case MODE_OPEN_FILES: + case FILE_MODE_OPEN_FILES: get_ok()->set_text(TTR("Open")); set_title(TTR("Open File(s)")); can_create_dir = false; break; - case MODE_OPEN_DIR: + case FILE_MODE_OPEN_DIR: get_ok()->set_text(TTR("Open")); set_title(TTR("Open a Directory")); can_create_dir = true; break; - case MODE_OPEN_ANY: + case FILE_MODE_OPEN_ANY: get_ok()->set_text(TTR("Open")); set_title(TTR("Open a File or Directory")); can_create_dir = true; break; - case MODE_SAVE_FILE: + case FILE_MODE_SAVE_FILE: get_ok()->set_text(TTR("Save")); set_title(TTR("Save a File")); can_create_dir = true; break; } - if (mode == MODE_OPEN_FILES) { + if (mode == FILE_MODE_OPEN_FILES) { item_list->set_select_mode(ItemList::SELECT_MULTI); } else { item_list->set_select_mode(ItemList::SELECT_SINGLE); @@ -1044,7 +1046,7 @@ void EditorFileDialog::set_mode(Mode p_mode) { } } -EditorFileDialog::Mode EditorFileDialog::get_mode() const { +EditorFileDialog::FileMode EditorFileDialog::get_file_mode() const { return mode; } @@ -1078,7 +1080,7 @@ void EditorFileDialog::set_access(Access p_access) { void EditorFileDialog::invalidate() { - if (is_visible_in_tree()) { + if (is_visible()) { update_file_list(); _update_favorites(); invalidated = false; @@ -1103,14 +1105,14 @@ void EditorFileDialog::_make_dir_confirm() { _push_history(); EditorFileSystem::get_singleton()->scan_changes(); //we created a dir, so rescan changes } else { - mkdirerr->popup_centered_minsize(Size2(250, 50) * EDSCALE); + mkdirerr->popup_centered(Size2(250, 50) * EDSCALE); } makedirname->set_text(""); // reset label } void EditorFileDialog::_make_dir() { - makedialog->popup_centered_minsize(Size2(250, 80) * EDSCALE); + makedialog->popup_centered(Size2(250, 80) * EDSCALE); makedirname->grab_focus(); } @@ -1225,8 +1227,8 @@ void EditorFileDialog::_update_favorites() { bool res = access == ACCESS_RESOURCES; String current = get_current_dir(); - Ref<Texture2D> folder_icon = get_icon("Folder", "EditorIcons"); - const Color folder_color = get_color("folder_icon_modulate", "FileDialog"); + Ref<Texture2D> folder_icon = item_list->get_icon("Folder", "EditorIcons"); + const Color folder_color = item_list->get_color("folder_icon_modulate", "FileDialog"); favorites->clear(); favorite->set_pressed(false); @@ -1384,8 +1386,8 @@ void EditorFileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("set_current_dir", "dir"), &EditorFileDialog::set_current_dir); ClassDB::bind_method(D_METHOD("set_current_file", "file"), &EditorFileDialog::set_current_file); ClassDB::bind_method(D_METHOD("set_current_path", "path"), &EditorFileDialog::set_current_path); - ClassDB::bind_method(D_METHOD("set_mode", "mode"), &EditorFileDialog::set_mode); - ClassDB::bind_method(D_METHOD("get_mode"), &EditorFileDialog::get_mode); + ClassDB::bind_method(D_METHOD("set_file_mode", "mode"), &EditorFileDialog::set_file_mode); + ClassDB::bind_method(D_METHOD("get_file_mode"), &EditorFileDialog::get_file_mode); ClassDB::bind_method(D_METHOD("get_vbox"), &EditorFileDialog::get_vbox); ClassDB::bind_method(D_METHOD("set_access", "access"), &EditorFileDialog::set_access); ClassDB::bind_method(D_METHOD("get_access"), &EditorFileDialog::get_access); @@ -1409,18 +1411,18 @@ void EditorFileDialog::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "access", PROPERTY_HINT_ENUM, "Resources,User data,File system"), "set_access", "get_access"); ADD_PROPERTY(PropertyInfo(Variant::INT, "display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List"), "set_display_mode", "get_display_mode"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Open one,Open many,Open folder,Open any,Save"), "set_mode", "get_mode"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "file_mode", PROPERTY_HINT_ENUM, "Open one,Open many,Open folder,Open any,Save"), "set_file_mode", "get_file_mode"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_dir", PROPERTY_HINT_DIR), "set_current_dir", "get_current_dir"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_file", PROPERTY_HINT_FILE, "*"), "set_current_file", "get_current_file"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_path"), "set_current_path", "get_current_path"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_hidden_files"), "set_show_hidden_files", "is_showing_hidden_files"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_overwrite_warning"), "set_disable_overwrite_warning", "is_overwrite_warning_disabled"); - BIND_ENUM_CONSTANT(MODE_OPEN_FILE); - BIND_ENUM_CONSTANT(MODE_OPEN_FILES); - BIND_ENUM_CONSTANT(MODE_OPEN_DIR); - BIND_ENUM_CONSTANT(MODE_OPEN_ANY); - BIND_ENUM_CONSTANT(MODE_SAVE_FILE); + BIND_ENUM_CONSTANT(FILE_MODE_OPEN_FILE); + BIND_ENUM_CONSTANT(FILE_MODE_OPEN_FILES); + BIND_ENUM_CONSTANT(FILE_MODE_OPEN_DIR); + BIND_ENUM_CONSTANT(FILE_MODE_OPEN_ANY); + BIND_ENUM_CONSTANT(FILE_MODE_SAVE_FILE); BIND_ENUM_CONSTANT(ACCESS_RESOURCES); BIND_ENUM_CONSTANT(ACCESS_USERDATA); @@ -1484,8 +1486,6 @@ bool EditorFileDialog::is_overwrite_warning_disabled() const { EditorFileDialog::EditorFileDialog() { - set_resizable(true); - show_hidden_files = default_show_hidden_files; display_mode = default_display_mode; local_history_pos = 0; @@ -1493,7 +1493,7 @@ EditorFileDialog::EditorFileDialog() { VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); - mode = MODE_SAVE_FILE; + mode = FILE_MODE_SAVE_FILE; set_title(TTR("Save a File")); ED_SHORTCUT("file_dialog/go_back", TTR("Go Back"), KEY_MASK_ALT | KEY_LEFT); @@ -1533,7 +1533,7 @@ EditorFileDialog::EditorFileDialog() { dir = memnew(LineEdit); pathhb->add_child(dir); - dir->set_h_size_flags(SIZE_EXPAND_FILL); + dir->set_h_size_flags(Control::SIZE_EXPAND_FILL); refresh = memnew(ToolButton); refresh->set_tooltip(TTR("Refresh files.")); @@ -1589,7 +1589,7 @@ EditorFileDialog::EditorFileDialog() { vbc->add_child(pathhb); vbc->add_child(list_hb); - list_hb->set_v_size_flags(SIZE_EXPAND_FILL); + list_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL); VSplitContainer *vsc = memnew(VSplitContainer); list_hb->add_child(vsc); @@ -1597,7 +1597,7 @@ EditorFileDialog::EditorFileDialog() { VBoxContainer *fav_vb = memnew(VBoxContainer); vsc->add_child(fav_vb); fav_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE); - fav_vb->set_v_size_flags(SIZE_EXPAND_FILL); + fav_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL); HBoxContainer *fav_hb = memnew(HBoxContainer); fav_vb->add_child(fav_hb); fav_hb->add_child(memnew(Label(TTR("Favorites:")))); @@ -1611,13 +1611,13 @@ EditorFileDialog::EditorFileDialog() { favorites = memnew(ItemList); fav_vb->add_child(favorites); - favorites->set_v_size_flags(SIZE_EXPAND_FILL); + favorites->set_v_size_flags(Control::SIZE_EXPAND_FILL); favorites->connect("item_selected", callable_mp(this, &EditorFileDialog::_favorite_selected)); VBoxContainer *rec_vb = memnew(VBoxContainer); vsc->add_child(rec_vb); rec_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE); - rec_vb->set_v_size_flags(SIZE_EXPAND_FILL); + rec_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL); recent = memnew(ItemList); recent->set_allow_reselect(true); rec_vb->add_margin_child(TTR("Recent:"), recent, true); @@ -1628,18 +1628,18 @@ EditorFileDialog::EditorFileDialog() { item_vb->set_custom_minimum_size(Size2(320, 0) * EDSCALE); HBoxContainer *preview_hb = memnew(HBoxContainer); - preview_hb->set_v_size_flags(SIZE_EXPAND_FILL); + preview_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL); item_vb->add_child(preview_hb); VBoxContainer *list_vb = memnew(VBoxContainer); - list_vb->set_h_size_flags(SIZE_EXPAND_FILL); + list_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL); list_vb->add_child(memnew(Label(TTR("Directories & Files:")))); preview_hb->add_child(list_vb); // Item (files and folders) list with context menu. item_list = memnew(ItemList); - item_list->set_v_size_flags(SIZE_EXPAND_FILL); + item_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); item_list->connect("item_rmb_selected", callable_mp(this, &EditorFileDialog::_item_list_item_rmb_selected)); item_list->connect("rmb_clicked", callable_mp(this, &EditorFileDialog::_item_list_rmb_clicked)); item_list->set_allow_rmb_select(true); @@ -1663,14 +1663,14 @@ EditorFileDialog::EditorFileDialog() { file_box->add_child(memnew(Label(TTR("File:")))); file = memnew(LineEdit); file->set_stretch_ratio(4); - file->set_h_size_flags(SIZE_EXPAND_FILL); + file->set_h_size_flags(Control::SIZE_EXPAND_FILL); file_box->add_child(file); filter = memnew(OptionButton); filter->set_stretch_ratio(3); - filter->set_h_size_flags(SIZE_EXPAND_FILL); + filter->set_h_size_flags(Control::SIZE_EXPAND_FILL); filter->set_clip_text(true); // Too many extensions overflow it. file_box->add_child(filter); - file_box->set_h_size_flags(SIZE_EXPAND_FILL); + file_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); item_vb->add_child(file_box); dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES); @@ -1687,7 +1687,7 @@ EditorFileDialog::EditorFileDialog() { filter->connect("item_selected", callable_mp(this, &EditorFileDialog::_filter_selected)); confirm_save = memnew(ConfirmationDialog); - confirm_save->set_as_toplevel(true); + //confirm_save->set_as_toplevel(true); add_child(confirm_save); confirm_save->connect("confirmed", callable_mp(this, &EditorFileDialog::_save_confirm_pressed)); @@ -1762,7 +1762,7 @@ EditorLineEditFileChooser::EditorLineEditFileChooser() { line_edit = memnew(LineEdit); add_child(line_edit); - line_edit->set_h_size_flags(SIZE_EXPAND_FILL); + line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); button = memnew(Button); add_child(button); button->connect("pressed", callable_mp(this, &EditorLineEditFileChooser::_browse)); diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h index 998ac33761..ed23f14ebe 100644 --- a/editor/editor_file_dialog.h +++ b/editor/editor_file_dialog.h @@ -60,12 +60,12 @@ public: ACCESS_FILESYSTEM }; - enum Mode { - MODE_OPEN_FILE, - MODE_OPEN_FILES, - MODE_OPEN_DIR, - MODE_OPEN_ANY, - MODE_SAVE_FILE + enum FileMode { + FILE_MODE_OPEN_FILE, + FILE_MODE_OPEN_FILES, + FILE_MODE_OPEN_DIR, + FILE_MODE_OPEN_ANY, + FILE_MODE_SAVE_FILE }; typedef Ref<Texture2D> (*GetIconFunc)(const String &); @@ -92,7 +92,7 @@ private: Access access; //Button *action; VBoxContainer *vbox; - Mode mode; + FileMode mode; bool can_create_dir; LineEdit *dir; @@ -221,8 +221,8 @@ public: void set_display_mode(DisplayMode p_mode); DisplayMode get_display_mode() const; - void set_mode(Mode p_mode); - Mode get_mode() const; + void set_file_mode(FileMode p_mode); + FileMode get_file_mode() const; VBoxContainer *get_vbox(); LineEdit *get_line_edit() { return file; } @@ -267,7 +267,7 @@ public: EditorLineEditFileChooser(); }; -VARIANT_ENUM_CAST(EditorFileDialog::Mode); +VARIANT_ENUM_CAST(EditorFileDialog::FileMode); VARIANT_ENUM_CAST(EditorFileDialog::Access); VARIANT_ENUM_CAST(EditorFileDialog::DisplayMode); diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index f7ce2dd4fc..9a0a26fb0a 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -37,13 +37,13 @@ void EditorHelpSearch::_update_icons() { - search_box->set_right_icon(get_icon("Search", "EditorIcons")); + search_box->set_right_icon(results_tree->get_icon("Search", "EditorIcons")); search_box->set_clear_button_enabled(true); - search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons")); - case_sensitive_button->set_icon(get_icon("MatchCase", "EditorIcons")); - hierarchy_button->set_icon(get_icon("ClassList", "EditorIcons")); + search_box->add_icon_override("right_icon", results_tree->get_icon("Search", "EditorIcons")); + case_sensitive_button->set_icon(results_tree->get_icon("MatchCase", "EditorIcons")); + hierarchy_button->set_icon(results_tree->get_icon("ClassList", "EditorIcons")); - if (is_visible_in_tree()) + if (is_visible()) _update_results(); } @@ -57,7 +57,7 @@ void EditorHelpSearch::_update_results() { if (hierarchy_button->is_pressed()) search_flags |= SEARCH_SHOW_HIERARCHY; - search = Ref<Runner>(memnew(Runner(this, results_tree, term, search_flags))); + search = Ref<Runner>(memnew(Runner(results_tree, results_tree, term, search_flags))); set_process(true); } @@ -105,6 +105,13 @@ void EditorHelpSearch::_confirmed() { void EditorHelpSearch::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_VISIBILITY_CHANGED: { + if (!is_visible()) { + results_tree->call_deferred("clear"); // Wait for the Tree's mouse event propagation. + get_ok()->set_disabled(true); + EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", Rect2(get_position(), get_size())); + } + } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { _update_icons(); @@ -114,12 +121,7 @@ void EditorHelpSearch::_notification(int p_what) { connect("confirmed", callable_mp(this, &EditorHelpSearch::_confirmed)); _update_icons(); } break; - case NOTIFICATION_POPUP_HIDE: { - results_tree->call_deferred("clear"); // Wait for the Tree's mouse event propagation. - get_ok()->set_disabled(true); - EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", get_rect()); - } break; case NOTIFICATION_PROCESS: { // Update background search. @@ -184,7 +186,7 @@ EditorHelpSearch::EditorHelpSearch() { old_search = false; set_hide_on_ok(false); - set_resizable(true); + set_title(TTR("Search Help")); get_ok()->set_disabled(true); @@ -200,7 +202,7 @@ EditorHelpSearch::EditorHelpSearch() { search_box = memnew(LineEdit); search_box->set_custom_minimum_size(Size2(200, 0) * EDSCALE); - search_box->set_h_size_flags(SIZE_EXPAND_FILL); + search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); search_box->connect("gui_input", callable_mp(this, &EditorHelpSearch::_search_box_gui_input)); search_box->connect("text_changed", callable_mp(this, &EditorHelpSearch::_search_box_text_changed)); register_text_enter(search_box); @@ -210,7 +212,7 @@ EditorHelpSearch::EditorHelpSearch() { case_sensitive_button->set_tooltip(TTR("Case Sensitive")); case_sensitive_button->connect("pressed", callable_mp(this, &EditorHelpSearch::_update_results)); case_sensitive_button->set_toggle_mode(true); - case_sensitive_button->set_focus_mode(FOCUS_NONE); + case_sensitive_button->set_focus_mode(Control::FOCUS_NONE); hbox->add_child(case_sensitive_button); hierarchy_button = memnew(ToolButton); @@ -218,7 +220,7 @@ EditorHelpSearch::EditorHelpSearch() { hierarchy_button->connect("pressed", callable_mp(this, &EditorHelpSearch::_update_results)); hierarchy_button->set_toggle_mode(true); hierarchy_button->set_pressed(true); - hierarchy_button->set_focus_mode(FOCUS_NONE); + hierarchy_button->set_focus_mode(Control::FOCUS_NONE); hbox->add_child(hierarchy_button); filter_combo = memnew(OptionButton); @@ -237,7 +239,7 @@ EditorHelpSearch::EditorHelpSearch() { // Create the results tree. results_tree = memnew(Tree); - results_tree->set_v_size_flags(SIZE_EXPAND_FILL); + results_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL); results_tree->set_columns(2); results_tree->set_column_title(0, TTR("Name")); results_tree->set_column_title(1, TTR("Member Type")); diff --git a/editor/editor_layouts_dialog.cpp b/editor/editor_layouts_dialog.cpp index 776fbd9314..dbd043c494 100644 --- a/editor/editor_layouts_dialog.cpp +++ b/editor/editor_layouts_dialog.cpp @@ -52,12 +52,12 @@ void EditorLayoutsDialog::_line_gui_input(const Ref<InputEvent> &p_event) { if (get_hide_on_ok()) hide(); ok_pressed(); - accept_event(); + set_input_as_handled(); } break; case KEY_ESCAPE: { hide(); - accept_event(); + set_input_as_handled(); } break; } } @@ -110,15 +110,15 @@ EditorLayoutsDialog::EditorLayoutsDialog() { makevb = memnew(VBoxContainer); add_child(makevb); - makevb->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5); - makevb->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5); + makevb->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 5); + makevb->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -5); layout_names = memnew(ItemList); makevb->add_child(layout_names); layout_names->set_visible(true); layout_names->set_margin(MARGIN_TOP, 5); - layout_names->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5); - layout_names->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5); + layout_names->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 5); + layout_names->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -5); layout_names->set_v_size_flags(Control::SIZE_EXPAND_FILL); layout_names->set_select_mode(ItemList::SELECT_MULTI); layout_names->set_allow_rmb_select(true); @@ -126,8 +126,8 @@ EditorLayoutsDialog::EditorLayoutsDialog() { name = memnew(LineEdit); makevb->add_child(name); name->set_margin(MARGIN_TOP, 5); - name->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5); - name->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5); + name->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 5); + name->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -5); name->connect("gui_input", callable_mp(this, &EditorLayoutsDialog::_line_gui_input)); name->connect("focus_entered", callable_mp(layout_names, &ItemList::unselect_all)); } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index b353a049bd..a053bc39f2 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -828,7 +828,7 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String } } - file->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); saving_resource = p_resource; current_option = RESOURCE_SAVE_AS; @@ -1472,7 +1472,7 @@ void EditorNode::_dialog_action(String p_file) { int scene_idx = (current_option == FILE_SAVE_SCENE || current_option == FILE_SAVE_AS_SCENE) ? -1 : tab_closing; - if (file->get_mode() == EditorFileDialog::MODE_SAVE_FILE) { + if (file->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) { bool same_open_scene = false; for (int i = 0; i < editor_data.get_edited_scene_count(); i++) { if (editor_data.get_scene_path(i) == p_file && i != scene_idx) @@ -1496,7 +1496,7 @@ void EditorNode::_dialog_action(String p_file) { } break; case FILE_SAVE_AND_RUN: { - if (file->get_mode() == EditorFileDialog::MODE_SAVE_FILE) { + if (file->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) { _save_default_environment(); _save_scene_with_preview(p_file); @@ -1626,7 +1626,7 @@ void EditorNode::_dialog_action(String p_file) { } break; default: { //save scene? - if (file->get_mode() == EditorFileDialog::MODE_SAVE_FILE) { + if (file->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) { _save_scene_with_preview(p_file); } @@ -2091,7 +2091,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { case FILE_NEW_INHERITED_SCENE: case FILE_OPEN_SCENE: { - file->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); List<String> extensions; ResourceLoader::get_recognized_extensions_for_type("PackedScene", &extensions); file->clear_filters(); @@ -2164,7 +2164,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { String scene_filename = editor_data.get_edited_scene_root(tab_closing)->get_filename(); save_confirmation->get_ok()->set_text(TTR("Save & Close")); save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene")); - save_confirmation->popup_centered_minsize(); + save_confirmation->popup_centered(); break; } } else if (p_option == FILE_CLOSE) { @@ -2218,7 +2218,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { break; } - file->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); List<String> extensions; Ref<PackedScene> sd = memnew(PackedScene); @@ -2260,7 +2260,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { confirmation->get_cancel()->set_text(TTR("No")); confirmation->get_ok()->set_text(TTR("Yes")); confirmation->set_text(TTR("This scene has never been saved. Save before running?")); - confirmation->popup_centered_minsize(); + confirmation->popup_centered(); break; } @@ -2332,7 +2332,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { confirmation->get_ok()->set_text(TTR("Open")); confirmation->set_text(TTR("Current scene not saved. Open anyway?")); - confirmation->popup_centered_minsize(); + confirmation->popup_centered(); break; } @@ -2390,7 +2390,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { if (unsaved_cache && !p_confirmed) { confirmation->get_ok()->set_text(TTR("Revert")); confirmation->set_text(TTR("This action cannot be undone. Revert anyway?")); - confirmation->popup_centered_minsize(); + confirmation->popup_centered(); break; } @@ -2493,11 +2493,11 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { export_template_manager->install_android_template(); } else { if (DirAccess::exists("res://android/build")) { - remove_android_build_template->popup_centered_minsize(); + remove_android_build_template->popup_centered(); } else if (export_template_manager->can_install_android_template()) { - install_android_build_template->popup_centered_minsize(); + install_android_build_template->popup_centered(); } else { - custom_build_manage_templates->popup_centered_minsize(); + custom_build_manage_templates->popup_centered(); } } } break; @@ -2519,7 +2519,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { confirmation->get_ok()->set_text(p_option == FILE_QUIT ? TTR("Quit") : TTR("Yes")); confirmation->set_text(p_option == FILE_QUIT ? TTR("Exit the editor?") : TTR("Open Project Manager?")); - confirmation->popup_centered_minsize(); + confirmation->popup_centered(); } else { _discard_changes(); break; @@ -2540,7 +2540,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { save_confirmation->get_ok()->set_text(TTR("Save & Quit")); save_confirmation->set_text((p_option == FILE_QUIT ? TTR("Save changes to the following scene(s) before quitting?") : TTR("Save changes the following scene(s) before opening Project Manager?")) + unsaved_scenes); - save_confirmation->popup_centered_minsize(); + save_confirmation->popup_centered(); } } @@ -2607,7 +2607,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { } break; case SETTINGS_PICK_MAIN_SCENE: { - file->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); List<String> extensions; ResourceLoader::get_recognized_extensions_for_type("PackedScene", &extensions); file->clear_filters(); @@ -2640,7 +2640,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { OS::get_singleton()->shell_open("https://godotengine.org/community"); } break; case HELP_ABOUT: { - about->popup_centered_minsize(Size2(780, 500) * EDSCALE); + about->popup_centered(Size2(780, 500) * EDSCALE); } break; case SET_VIDEO_DRIVER_SAVE_AND_RESTART: { @@ -3275,7 +3275,7 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b if (!p_force_open_imported && FileAccess::exists(p_scene + ".import")) { open_imported->set_text(vformat(TTR("Scene '%s' was automatically imported, so it can't be modified.\nTo make changes to it, a new inherited scene can be created."), p_scene.get_file())); - open_imported->popup_centered_minsize(); + open_imported->popup_centered(); new_inherited_button->grab_focus(); open_import_request = p_scene; return OK; @@ -3928,7 +3928,7 @@ void EditorNode::show_accept(const String &p_text, const String &p_title) { current_option = -1; accept->get_ok()->set_text(p_title); accept->set_text(p_text); - accept->popup_centered_minsize(); + accept->popup_centered(); } void EditorNode::show_warning(const String &p_text, const String &p_title) { @@ -3936,7 +3936,7 @@ void EditorNode::show_warning(const String &p_text, const String &p_title) { if (warning->is_inside_tree()) { warning->set_text(p_text); warning->set_title(p_title); - warning->popup_centered_minsize(); + warning->popup_centered(); } else { WARN_PRINT(p_title + " " + p_text); } @@ -3947,6 +3947,76 @@ void EditorNode::_copy_warning(const String &p_str) { DisplayServer::get_singleton()->clipboard_set(warning->get_text()); } +void EditorNode::_dock_floating_close_request(Control *p_control) { + Window *window = (Window *)p_control->get_parent(); + int window_slot = window->get_meta("dock_slot"); + + window->remove_child(p_control); + dock_slot[window_slot]->add_child(p_control); + + window->queue_delete(); + + _update_dock_containers(); + + floating_docks.erase(p_control); +} + +void EditorNode::_dock_make_float() { + Control *dock = dock_slot[dock_popup_selected]->get_current_tab_control(); + ERR_FAIL_COND(!dock); + + Size2 dock_size = dock->get_size(); //remember size + Point2 dock_screen_pos = dock->get_global_position() + get_tree()->get_root()->get_position(); + + dock_slot[dock_popup_selected]->remove_child(dock); + + Window *window = memnew(Window); + window->set_title(dock->get_name()); + Panel *p = memnew(Panel); + p->set_mode(Panel::MODE_FOREGROUND); + p->set_anchors_and_margins_preset(Control::PRESET_WIDE); + window->add_child(p); + dock->set_anchors_and_margins_preset(Control::PRESET_WIDE); + window->add_child(dock); + window->set_wrap_controls(true); + window->set_size(dock_size); + window->set_position(dock_screen_pos); + window->set_transient(true); + window->connect("close_requested", callable_mp(this, &EditorNode::_dock_floating_close_request), varray(dock)); + window->set_meta("dock_slot", dock_popup_selected); + gui_base->add_child(window); + + dock_select_popup->hide(); + + _update_dock_containers(); + + floating_docks.push_back(dock); +} + +void EditorNode::_update_dock_containers() { + + for (int i = 0; i < DOCK_SLOT_MAX; i++) { + if (dock_slot[i]->get_tab_count() == 0 && dock_slot[i]->is_visible()) { + dock_slot[i]->hide(); + } + if (dock_slot[i]->get_tab_count() > 0 && !dock_slot[i]->is_visible()) { + dock_slot[i]->show(); + } + } + for (int i = 0; i < vsplits.size(); i++) { + bool in_use = dock_slot[i * 2 + 0]->get_tab_count() || dock_slot[i * 2 + 1]->get_tab_count(); + if (in_use) + vsplits[i]->show(); + else + vsplits[i]->hide(); + } + + if (right_l_vsplit->is_visible() || right_r_vsplit->is_visible()) + right_hsplit->show(); + else + right_hsplit->hide(); +} + void EditorNode::_dock_select_input(const Ref<InputEvent> &p_input) { Ref<InputEventMouse> me = p_input; @@ -3992,18 +4062,7 @@ void EditorNode::_dock_select_input(const Ref<InputEvent> &p_input) { dock_slot[nrect]->show(); dock_select->update(); - for (int i = 0; i < vsplits.size(); i++) { - bool in_use = dock_slot[i * 2 + 0]->get_tab_count() || dock_slot[i * 2 + 1]->get_tab_count(); - if (in_use) - vsplits[i]->show(); - else - vsplits[i]->hide(); - } - - if (right_l_vsplit->is_visible() || right_r_vsplit->is_visible()) - right_hsplit->show(); - else - right_hsplit->hide(); + _update_dock_containers(); _edit_current(); _save_docks(); @@ -4460,7 +4519,7 @@ bool EditorNode::ensure_main_scene(bool p_from_native) { current_option = -1; pick_main_scene->set_text(TTR("No main scene has ever been defined, select one?\nYou can change it later in \"Project Settings\" under the 'application' category.")); - pick_main_scene->popup_centered_minsize(); + pick_main_scene->popup_centered(); return false; } @@ -4468,7 +4527,7 @@ bool EditorNode::ensure_main_scene(bool p_from_native) { current_option = -1; pick_main_scene->set_text(vformat(TTR("Selected scene '%s' does not exist, select a valid one?\nYou can change it later in \"Project Settings\" under the 'application' category."), main_scene)); - pick_main_scene->popup_centered_minsize(); + pick_main_scene->popup_centered(); return false; } @@ -4476,7 +4535,7 @@ bool EditorNode::ensure_main_scene(bool p_from_native) { current_option = -1; pick_main_scene->set_text(vformat(TTR("Selected scene '%s' is not a scene file, select a valid one?\nYou can change it later in \"Project Settings\" under the 'application' category."), main_scene)); - pick_main_scene->popup_centered_minsize(); + pick_main_scene->popup_centered(); return false; } @@ -4596,7 +4655,7 @@ void EditorNode::_scene_tab_closed(int p_tab, int option) { if (unsaved) { save_confirmation->get_ok()->set_text(TTR("Save & Close")); save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene->get_filename() != "" ? scene->get_filename() : "unsaved scene")); - save_confirmation->popup_centered_minsize(); + save_confirmation->popup_centered(); } else { _discard_changes(); } @@ -5300,7 +5359,7 @@ void EditorNode::_video_driver_selected(int p_which) { } video_driver_request = driver; - video_restart_dialog->popup_centered_minsize(); + video_restart_dialog->popup_centered(); video_driver->select(video_driver_current); _update_video_driver_color(); } @@ -5845,6 +5904,14 @@ EditorNode::EditorNode() { dock_select->set_v_size_flags(Control::SIZE_EXPAND_FILL); dock_vb->add_child(dock_select); + dock_float = memnew(Button); + dock_float->set_text("Make Floating"); + dock_float->set_focus_mode(Control::FOCUS_NONE); + dock_float->set_h_size_flags(Control::SIZE_SHRINK_CENTER); + dock_float->connect("pressed", callable_mp(this, &EditorNode::_dock_make_float)); + + dock_vb->add_child(dock_float); + dock_select_popup->set_as_minsize(); dock_select_rect_over = -1; dock_popup_selected = -1; @@ -6458,7 +6525,7 @@ EditorNode::EditorNode() { file_templates->set_title(TTR("Import Templates From ZIP File")); gui_base->add_child(file_templates); - file_templates->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file_templates->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); file_templates->set_access(EditorFileDialog::ACCESS_FILESYSTEM); file_templates->clear_filters(); file_templates->add_filter("*.tpz ; " + TTR("Template Package")); @@ -6469,7 +6536,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->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); 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")); @@ -6480,7 +6547,7 @@ EditorNode::EditorNode() { file_script = memnew(EditorFileDialog); file_script->set_title(TTR("Open & Run a Script")); file_script->set_access(EditorFileDialog::ACCESS_FILESYSTEM); - file_script->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file_script->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); List<String> sexts; ResourceLoader::get_recognized_extensions_for_type("Script", &sexts); for (List<String>::Element *E = sexts.front(); E; E = E->next()) { diff --git a/editor/editor_node.h b/editor/editor_node.h index c670d4954b..88ebf4d475 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -350,11 +350,14 @@ private: Button *new_inherited_button; String open_import_request; + Vector<Control *> floating_docks; + TabContainer *dock_slot[DOCK_SLOT_MAX]; Rect2 dock_select_rect[DOCK_SLOT_MAX]; int dock_select_rect_over; PopupPanel *dock_select_popup; Control *dock_select; + Button *dock_float; ToolButton *dock_tab_move_left; ToolButton *dock_tab_move_right; int dock_popup_selected; @@ -562,6 +565,8 @@ private: bool _find_scene_in_use(Node *p_node, const String &p_path) const; + void _update_dock_containers(); + void _dock_select_input(const Ref<InputEvent> &p_input); void _dock_move_left(); void _dock_move_right(); @@ -569,6 +574,8 @@ private: void _dock_pre_popup(int p_which); void _dock_split_dragged(int ofs); void _dock_popup_exit(); + void _dock_floating_close_request(Control *p_control); + void _dock_make_float(); void _scene_tab_changed(int p_tab); void _scene_tab_closed(int p_tab, int option = SCENE_TAB_CLOSE); void _scene_tab_hover(int p_tab); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index cc89f1c16a..dcafeaf8f5 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -240,10 +240,10 @@ void EditorPropertyPath::_path_pressed() { } if (folder) { - dialog->set_mode(EditorFileDialog::MODE_OPEN_DIR); + dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_DIR); dialog->set_current_dir(full_path); } else { - dialog->set_mode(save_mode ? EditorFileDialog::MODE_SAVE_FILE : EditorFileDialog::MODE_OPEN_FILE); + dialog->set_file_mode(save_mode ? EditorFileDialog::FILE_MODE_SAVE_FILE : EditorFileDialog::FILE_MODE_OPEN_FILE); for (int i = 0; i < extensions.size(); i++) { String e = extensions[i].strip_edges(); if (e != String()) { @@ -2074,7 +2074,7 @@ void EditorPropertyResource::_menu_option(int p_which) { file->connect("file_selected", callable_mp(this, &EditorPropertyResource::_file_selected)); add_child(file); } - file->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); String type = base_type; List<String> extensions; diff --git a/editor/editor_sub_scene.cpp b/editor/editor_sub_scene.cpp index 3ebd8f0475..cd5768551f 100644 --- a/editor/editor_sub_scene.cpp +++ b/editor/editor_sub_scene.cpp @@ -70,11 +70,11 @@ void EditorSubScene::_path_browse() { } void EditorSubScene::_notification(int p_what) { - if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { - if (is_visible() && scene == NULL) + if (is_visible() && scene == NULL) { _path_browse(); + } } } @@ -240,7 +240,7 @@ EditorSubScene::EditorSubScene() { path = memnew(LineEdit); path->connect("text_entered", callable_mp(this, &EditorSubScene::_path_changed)); hb->add_child(path); - path->set_h_size_flags(SIZE_EXPAND_FILL); + path->set_h_size_flags(Control::SIZE_EXPAND_FILL); Button *b = memnew(Button); b->set_text(TTR("Browse")); hb->add_child(b); @@ -248,7 +248,7 @@ EditorSubScene::EditorSubScene() { vb->add_margin_child(TTR("Scene Path:"), hb); tree = memnew(Tree); - tree->set_v_size_flags(SIZE_EXPAND_FILL); + tree->set_v_size_flags(Control::SIZE_EXPAND_FILL); vb->add_margin_child(TTR("Import From Node:"), tree, true); tree->set_select_mode(Tree::SELECT_MULTI); tree->connect("multi_selected", callable_mp(this, &EditorSubScene::_item_multi_selected)); @@ -266,7 +266,7 @@ EditorSubScene::EditorSubScene() { file_dialog->add_filter("*." + E->get()); } - file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); add_child(file_dialog); file_dialog->connect("file_selected", callable_mp(this, &EditorSubScene::_path_selected)); } diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 1263eb166b..c7f353f6fb 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -910,14 +910,16 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { style_window->set_border_color(tab_color); style_window->set_border_width(MARGIN_TOP, 24 * EDSCALE); style_window->set_expand_margin_size(MARGIN_TOP, 24 * EDSCALE); - theme->set_stylebox("panel", "WindowDialog", style_window); - theme->set_color("title_color", "WindowDialog", font_color); - theme->set_icon("close", "WindowDialog", theme->get_icon("GuiClose", "EditorIcons")); - theme->set_icon("close_highlight", "WindowDialog", theme->get_icon("GuiClose", "EditorIcons")); - theme->set_constant("close_h_ofs", "WindowDialog", 22 * EDSCALE); - theme->set_constant("close_v_ofs", "WindowDialog", 20 * EDSCALE); - theme->set_constant("title_height", "WindowDialog", 24 * EDSCALE); - theme->set_font("title_font", "WindowDialog", theme->get_font("title", "EditorFonts")); + + theme->set_stylebox("panel", "AcceptDialog", style_default); + theme->set_stylebox("panel_window", "AcceptDialog", style_window); + theme->set_color("title_color", "AcceptDialog", font_color); + theme->set_icon("close", "AcceptDialog", theme->get_icon("GuiClose", "EditorIcons")); + theme->set_icon("close_highlight", "AcceptDialog", theme->get_icon("GuiClose", "EditorIcons")); + theme->set_constant("close_h_ofs", "AcceptDialog", 22 * EDSCALE); + theme->set_constant("close_v_ofs", "AcceptDialog", 20 * EDSCALE); + theme->set_constant("title_height", "AcceptDialog", 24 * EDSCALE); + theme->set_font("title_font", "AcceptDialog", theme->get_font("title", "EditorFonts")); // complex window, for now only Editor settings and Project settings Ref<StyleBoxFlat> style_complex_window = style_window->duplicate(); @@ -978,6 +980,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // Panel theme->set_stylebox("panel", "Panel", make_flat_stylebox(dark_color_1, 6, 4, 6, 4)); + theme->set_stylebox("panel_fg", "Panel", style_default); // Label theme->set_stylebox("normal", "Label", style_empty); diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index 41547f1ec6..151efc1f5e 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -82,11 +82,11 @@ void ExportTemplateManager::_update_template_list() { String(VERSION_STATUS) != String("rc"); Label *current = memnew(Label); - current->set_h_size_flags(SIZE_EXPAND_FILL); + current->set_h_size_flags(Control::SIZE_EXPAND_FILL); current_hb->add_child(current); if (templates.has(current_version)) { - current->add_color_override("font_color", get_color("success_color", "Editor")); + current->add_color_override("font_color", current->get_color("success_color", "Editor")); // Only display a redownload button if it can be downloaded in the first place if (downloads_available) { @@ -103,7 +103,7 @@ void ExportTemplateManager::_update_template_list() { uninstall->connect("pressed", callable_mp(this, &ExportTemplateManager::_uninstall_template), varray(current_version)); } else { - current->add_color_override("font_color", get_color("error_color", "Editor")); + current->add_color_override("font_color", current->get_color("error_color", "Editor")); Button *redownload = memnew(Button); redownload->set_text(TTR("Download")); @@ -121,13 +121,13 @@ void ExportTemplateManager::_update_template_list() { HBoxContainer *hbc = memnew(HBoxContainer); Label *version = memnew(Label); - version->set_modulate(get_color("disabled_font_color", "Editor")); + version->set_modulate(current->get_color("disabled_font_color", "Editor")); String text = E->get(); if (text == current_version) { text += " " + TTR("(Current)"); } version->set_text(text); - version->set_h_size_flags(SIZE_EXPAND_FILL); + version->set_h_size_flags(Control::SIZE_EXPAND_FILL); hbc->add_child(version); Button *uninstall = memnew(Button); @@ -145,7 +145,7 @@ void ExportTemplateManager::_download_template(const String &p_version) { while (template_list->get_child_count()) { memdelete(template_list->get_child(0)); } - template_downloader->popup_centered_minsize(); + template_downloader->popup_centered(); template_list_state->set_text(TTR("Retrieving mirrors, please wait...")); template_download_progress->set_max(100); template_download_progress->set_value(0); @@ -157,7 +157,7 @@ void ExportTemplateManager::_download_template(const String &p_version) { void ExportTemplateManager::_uninstall_template(const String &p_version) { remove_confirm->set_text(vformat(TTR("Remove template version '%s'?"), p_version)); - remove_confirm->popup_centered_minsize(); + remove_confirm->popup_centered(); to_remove = p_version; } @@ -342,7 +342,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_ void ExportTemplateManager::popup_manager() { _update_template_list(); - popup_centered_minsize(Size2(400, 400) * EDSCALE); + popup_centered(Size2(400, 400) * EDSCALE); } void ExportTemplateManager::ok_pressed() { @@ -483,6 +483,11 @@ void ExportTemplateManager::_window_template_downloader_closed() { void ExportTemplateManager::_notification(int p_what) { + if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { + if (!is_visible()) { + set_process(false); + } + } if (p_what == NOTIFICATION_PROCESS) { update_countdown -= get_process_delta_time(); @@ -536,12 +541,6 @@ void ExportTemplateManager::_notification(int p_what) { set_process(false); } } - - if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { - if (!is_visible_in_tree()) { - set_process(false); - } - } } bool ExportTemplateManager::can_install_android_template() { @@ -674,7 +673,7 @@ ExportTemplateManager::ExportTemplateManager() { installed_scroll->add_child(installed_vb); installed_scroll->set_enable_v_scroll(true); installed_scroll->set_enable_h_scroll(false); - installed_vb->set_h_size_flags(SIZE_EXPAND_FILL); + installed_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL); get_cancel()->set_text(TTR("Close")); get_ok()->set_text(TTR("Install From File")); @@ -688,7 +687,7 @@ ExportTemplateManager::ExportTemplateManager() { template_open->set_title(TTR("Select Template File")); template_open->add_filter("*.tpz ; " + TTR("Godot Export Templates")); template_open->set_access(FileDialog::ACCESS_FILESYSTEM); - template_open->set_mode(FileDialog::MODE_OPEN_FILE); + template_open->set_file_mode(FileDialog::FILE_MODE_OPEN_FILE); template_open->connect("file_selected", callable_mp(this, &ExportTemplateManager::_install_from_file), varray(true)); add_child(template_open); @@ -708,7 +707,7 @@ ExportTemplateManager::ExportTemplateManager() { template_downloader->get_ok()->set_text(TTR("Close")); template_downloader->set_exclusive(true); add_child(template_downloader); - template_downloader->connect("popup_hide", callable_mp(this, &ExportTemplateManager::_window_template_downloader_closed)); + template_downloader->connect("cancelled", callable_mp(this, &ExportTemplateManager::_window_template_downloader_closed)); VBoxContainer *vbc = memnew(VBoxContainer); template_downloader->add_child(vbc); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index d52a7f25be..019b1a73f9 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1413,7 +1413,7 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool p_ove bool can_move = _check_existing(); if (!can_move) { // Ask to do something. - overwrite_dialog->popup_centered_minsize(); + overwrite_dialog->popup_centered(); return; } } @@ -1677,7 +1677,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected rename_dialog_text->set_text(name); rename_dialog_text->select(0, name.length()); } - rename_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE); + rename_dialog->popup_centered(Size2(250, 80) * EDSCALE); rename_dialog_text->grab_focus(); } } @@ -1721,7 +1721,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected duplicate_dialog_text->set_text(name); duplicate_dialog_text->select(0, name.length()); } - duplicate_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE); + duplicate_dialog->popup_centered(Size2(250, 80) * EDSCALE); duplicate_dialog_text->grab_focus(); } } break; @@ -1743,14 +1743,14 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected case FILE_NEW_FOLDER: { make_dir_dialog_text->set_text("new folder"); make_dir_dialog_text->select_all(); - make_dir_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE); + make_dir_dialog->popup_centered(Size2(250, 80) * EDSCALE); make_dir_dialog_text->grab_focus(); } break; case FILE_NEW_SCENE: { make_scene_dialog_text->set_text("new scene"); make_scene_dialog_text->select_all(); - make_scene_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE); + make_scene_dialog->popup_centered(Size2(250, 80) * EDSCALE); make_scene_dialog_text->grab_focus(); } break; diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 5a7d4cede7..83c5263dda 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -299,14 +299,14 @@ const char *FindInFilesDialog::SIGNAL_REPLACE_REQUESTED = "replace_requested"; FindInFilesDialog::FindInFilesDialog() { - set_custom_minimum_size(Size2(500 * EDSCALE, 0)); + set_min_size(Size2(500 * EDSCALE, 0)); set_title(TTR("Find in Files")); VBoxContainer *vbc = memnew(VBoxContainer); - vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE); - vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE); - vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE); - vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE); + vbc->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE); + vbc->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 8 * EDSCALE); + vbc->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -8 * EDSCALE); + vbc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -8 * EDSCALE); add_child(vbc); GridContainer *gc = memnew(GridContainer); @@ -318,7 +318,7 @@ FindInFilesDialog::FindInFilesDialog() { gc->add_child(find_label); _search_text_line_edit = memnew(LineEdit); - _search_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL); + _search_text_line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); _search_text_line_edit->connect("text_changed", callable_mp(this, &FindInFilesDialog::_on_search_text_modified)); _search_text_line_edit->connect("text_entered", callable_mp(this, &FindInFilesDialog::_on_search_text_entered)); gc->add_child(_search_text_line_edit); @@ -329,7 +329,7 @@ FindInFilesDialog::FindInFilesDialog() { gc->add_child(_replace_label); _replace_text_line_edit = memnew(LineEdit); - _replace_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL); + _replace_text_line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); _replace_text_line_edit->connect("text_entered", callable_mp(this, &FindInFilesDialog::_on_replace_text_entered)); _replace_text_line_edit->hide(); gc->add_child(_replace_text_line_edit); @@ -362,7 +362,7 @@ FindInFilesDialog::FindInFilesDialog() { hbc->add_child(prefix_label); _folder_line_edit = memnew(LineEdit); - _folder_line_edit->set_h_size_flags(SIZE_EXPAND_FILL); + _folder_line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); hbc->add_child(_folder_line_edit); Button *folder_button = memnew(Button); @@ -371,7 +371,7 @@ FindInFilesDialog::FindInFilesDialog() { hbc->add_child(folder_button); _folder_dialog = memnew(FileDialog); - _folder_dialog->set_mode(FileDialog::MODE_OPEN_DIR); + _folder_dialog->set_file_mode(FileDialog::FILE_MODE_OPEN_DIR); _folder_dialog->connect("dir_selected", callable_mp(this, &FindInFilesDialog::_on_folder_selected)); add_child(_folder_dialog); @@ -464,6 +464,7 @@ Set<String> FindInFilesDialog::get_filter() const { void FindInFilesDialog::_notification(int p_what) { if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { + if (is_visible()) { // Doesn't work more than once if not deferred... _search_text_line_edit->call_deferred("grab_focus"); diff --git a/editor/find_in_files.h b/editor/find_in_files.h index 7002f750b7..41adb156b6 100644 --- a/editor/find_in_files.h +++ b/editor/find_in_files.h @@ -120,10 +120,11 @@ public: Set<String> get_filter() const; protected: - static void _bind_methods(); - void _notification(int p_what); + + void _visibility_changed(); void custom_action(const String &p_action); + static void _bind_methods(); private: void _on_folder_button_pressed(); diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp index b4c9a01f2a..530a95b280 100644 --- a/editor/groups_editor.cpp +++ b/editor/groups_editor.cpp @@ -94,7 +94,7 @@ void GroupDialog::_load_nodes(Node *p_current) { if (!_can_edit(p_current, selected_group)) { node->set_selectable(0, false); - node->set_custom_color(0, get_color("disabled_font_color", "Editor")); + node->set_custom_color(0, groups->get_color("disabled_font_color", "Editor")); } } @@ -204,7 +204,7 @@ void GroupDialog::_add_group(String p_name) { TreeItem *new_group = groups->create_item(groups_root); new_group->set_text(0, name); - new_group->add_button(0, get_icon("Remove", "EditorIcons"), 0); + new_group->add_button(0, groups->get_icon("Remove", "EditorIcons"), 0); new_group->set_editable(0, true); new_group->select(0); groups->ensure_cursor_is_visible(); @@ -361,12 +361,12 @@ void GroupDialog::_delete_group_item(const String &p_name) { void GroupDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - add_button->set_icon(get_icon("Forward", "EditorIcons")); - remove_button->set_icon(get_icon("Back", "EditorIcons")); + add_button->set_icon(groups->get_icon("Forward", "EditorIcons")); + remove_button->set_icon(groups->get_icon("Back", "EditorIcons")); - add_filter->set_right_icon(get_icon("Search", "EditorIcons")); + add_filter->set_right_icon(groups->get_icon("Search", "EditorIcons")); add_filter->set_clear_button_enabled(true); - remove_filter->set_right_icon(get_icon("Search", "EditorIcons")); + remove_filter->set_right_icon(groups->get_icon("Search", "EditorIcons")); remove_filter->set_clear_button_enabled(true); } break; } @@ -399,21 +399,21 @@ void GroupDialog::_bind_methods() { } GroupDialog::GroupDialog() { - set_custom_minimum_size(Size2(600, 400) * EDSCALE); + set_min_size(Size2(600, 400) * EDSCALE); scene_tree = SceneTree::get_singleton(); VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); - vbc->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE); + vbc->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_KEEP_SIZE, 8 * EDSCALE); HBoxContainer *hbc = memnew(HBoxContainer); vbc->add_child(hbc); - hbc->set_v_size_flags(SIZE_EXPAND_FILL); + hbc->set_v_size_flags(Control::SIZE_EXPAND_FILL); VBoxContainer *vbc_left = memnew(VBoxContainer); hbc->add_child(vbc_left); - vbc_left->set_h_size_flags(SIZE_EXPAND_FILL); + vbc_left->set_h_size_flags(Control::SIZE_EXPAND_FILL); Label *group_title = memnew(Label); group_title->set_text(TTR("Groups")); @@ -425,7 +425,7 @@ GroupDialog::GroupDialog() { groups->set_select_mode(Tree::SELECT_SINGLE); groups->set_allow_reselect(true); groups->set_allow_rmb_select(true); - groups->set_v_size_flags(SIZE_EXPAND_FILL); + groups->set_v_size_flags(Control::SIZE_EXPAND_FILL); groups->add_constant_override("draw_guides", 1); groups->connect("item_selected", callable_mp(this, &GroupDialog::_group_selected)); groups->connect("button_pressed", callable_mp(this, &GroupDialog::_delete_group_pressed)); @@ -433,11 +433,11 @@ GroupDialog::GroupDialog() { HBoxContainer *chbc = memnew(HBoxContainer); vbc_left->add_child(chbc); - chbc->set_h_size_flags(SIZE_EXPAND_FILL); + chbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); add_group_text = memnew(LineEdit); chbc->add_child(add_group_text); - add_group_text->set_h_size_flags(SIZE_EXPAND_FILL); + add_group_text->set_h_size_flags(Control::SIZE_EXPAND_FILL); add_group_text->connect("text_entered", callable_mp(this, &GroupDialog::_add_group_pressed)); Button *add_group_button = memnew(Button); @@ -447,7 +447,7 @@ GroupDialog::GroupDialog() { VBoxContainer *vbc_add = memnew(VBoxContainer); hbc->add_child(vbc_add); - vbc_add->set_h_size_flags(SIZE_EXPAND_FILL); + vbc_add->set_h_size_flags(Control::SIZE_EXPAND_FILL); Label *out_of_group_title = memnew(Label); out_of_group_title->set_text(TTR("Nodes Not in Group")); @@ -458,7 +458,7 @@ GroupDialog::GroupDialog() { nodes_to_add->set_hide_root(true); nodes_to_add->set_hide_folding(true); nodes_to_add->set_select_mode(Tree::SELECT_MULTI); - nodes_to_add->set_v_size_flags(SIZE_EXPAND_FILL); + nodes_to_add->set_v_size_flags(Control::SIZE_EXPAND_FILL); nodes_to_add->add_constant_override("draw_guides", 1); HBoxContainer *add_filter_hbc = memnew(HBoxContainer); @@ -466,15 +466,15 @@ GroupDialog::GroupDialog() { vbc_add->add_child(add_filter_hbc); add_filter = memnew(LineEdit); - add_filter->set_h_size_flags(SIZE_EXPAND_FILL); + add_filter->set_h_size_flags(Control::SIZE_EXPAND_FILL); add_filter->set_placeholder(TTR("Filter nodes")); add_filter_hbc->add_child(add_filter); add_filter->connect("text_changed", callable_mp(this, &GroupDialog::_add_filter_changed)); VBoxContainer *vbc_buttons = memnew(VBoxContainer); hbc->add_child(vbc_buttons); - vbc_buttons->set_h_size_flags(SIZE_SHRINK_CENTER); - vbc_buttons->set_v_size_flags(SIZE_SHRINK_CENTER); + vbc_buttons->set_h_size_flags(Control::SIZE_SHRINK_CENTER); + vbc_buttons->set_v_size_flags(Control::SIZE_SHRINK_CENTER); add_button = memnew(ToolButton); add_button->set_text(TTR("Add")); @@ -493,7 +493,7 @@ GroupDialog::GroupDialog() { VBoxContainer *vbc_remove = memnew(VBoxContainer); hbc->add_child(vbc_remove); - vbc_remove->set_h_size_flags(SIZE_EXPAND_FILL); + vbc_remove->set_h_size_flags(Control::SIZE_EXPAND_FILL); Label *in_group_title = memnew(Label); in_group_title->set_text(TTR("Nodes in Group")); @@ -501,7 +501,7 @@ GroupDialog::GroupDialog() { nodes_to_remove = memnew(Tree); vbc_remove->add_child(nodes_to_remove); - nodes_to_remove->set_v_size_flags(SIZE_EXPAND_FILL); + nodes_to_remove->set_v_size_flags(Control::SIZE_EXPAND_FILL); nodes_to_remove->set_hide_root(true); nodes_to_remove->set_hide_folding(true); nodes_to_remove->set_select_mode(Tree::SELECT_MULTI); @@ -512,7 +512,7 @@ GroupDialog::GroupDialog() { vbc_remove->add_child(remove_filter_hbc); remove_filter = memnew(LineEdit); - remove_filter->set_h_size_flags(SIZE_EXPAND_FILL); + remove_filter->set_h_size_flags(Control::SIZE_EXPAND_FILL); remove_filter->set_placeholder(TTR("Filter nodes")); remove_filter_hbc->add_child(remove_filter); remove_filter->connect("text_changed", callable_mp(this, &GroupDialog::_remove_filter_changed)); @@ -524,11 +524,9 @@ GroupDialog::GroupDialog() { group_empty->set_autowrap(true); group_empty->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); nodes_to_remove->add_child(group_empty); - group_empty->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE); + group_empty->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_KEEP_SIZE, 8 * EDSCALE); set_title(TTR("Group Editor")); - set_as_toplevel(true); - set_resizable(true); error = memnew(ConfirmationDialog); add_child(error); @@ -669,7 +667,7 @@ GroupsEditor::GroupsEditor() { VBoxContainer *vbc = this; group_dialog = memnew(GroupDialog); - group_dialog->set_as_toplevel(true); + add_child(group_dialog); group_dialog->connect("group_edited", callable_mp(this, &GroupsEditor::update_tree)); @@ -682,7 +680,7 @@ GroupsEditor::GroupsEditor() { vbc->add_child(hbc); group_name = memnew(LineEdit); - group_name->set_h_size_flags(SIZE_EXPAND_FILL); + group_name->set_h_size_flags(Control::SIZE_EXPAND_FILL); hbc->add_child(group_name); group_name->connect("text_entered", callable_mp(this, &GroupsEditor::_add_group)); @@ -693,7 +691,7 @@ GroupsEditor::GroupsEditor() { tree = memnew(Tree); tree->set_hide_root(true); - tree->set_v_size_flags(SIZE_EXPAND_FILL); + tree->set_v_size_flags(Control::SIZE_EXPAND_FILL); vbc->add_child(tree); tree->connect("button_pressed", callable_mp(this, &GroupsEditor::_remove_group)); tree->add_constant_override("draw_guides", 1); diff --git a/editor/groups_editor.h b/editor/groups_editor.h index 84c653bdea..40c7b3c75a 100644 --- a/editor/groups_editor.h +++ b/editor/groups_editor.h @@ -41,9 +41,9 @@ #include "scene/gui/tool_button.h" #include "scene/gui/tree.h" -class GroupDialog : public WindowDialog { +class GroupDialog : public AcceptDialog { - GDCLASS(GroupDialog, WindowDialog); + GDCLASS(GroupDialog, AcceptDialog); ConfirmationDialog *error; diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index e2e68f0f41..2c59949994 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -424,7 +424,7 @@ void ImportDock::_reimport_attempt() { if (need_restart) { label_warning->set_visible(used_in_resources); - reimport_confirm->popup_centered_minsize(); + reimport_confirm->popup_centered(); return; } diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index 2729d9ecb5..f18d14c3c8 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -140,7 +140,7 @@ void InspectorDock::_new_resource() { } void InspectorDock::_load_resource(const String &p_type) { - load_resource_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE); + load_resource_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); List<String> extensions; ResourceLoader::get_recognized_extensions_for_type(p_type, &extensions); @@ -317,7 +317,7 @@ void InspectorDock::_transform_keyed(Object *sp, const String &p_sub, const Tran } void InspectorDock::_warning_pressed() { - warning_dialog->popup_centered_minsize(); + warning_dialog->popup_centered(); } Container *InspectorDock::get_addon_area() { diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp index 1e7c625abb..4317a5e80f 100644 --- a/editor/plugin_config_dialog.cpp +++ b/editor/plugin_config_dialog.cpp @@ -131,14 +131,15 @@ void PluginConfigDialog::_on_required_text_changed(const String &) { void PluginConfigDialog::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_VISIBILITY_CHANGED: { + if (is_visible()) { + name_edit->grab_focus(); + } + } break; case NOTIFICATION_READY: { connect("confirmed", callable_mp(this, &PluginConfigDialog::_on_confirmed)); get_cancel()->connect("pressed", callable_mp(this, &PluginConfigDialog::_on_cancelled)); } break; - - case NOTIFICATION_POST_POPUP: { - name_edit->grab_focus(); - } break; } } diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index 8d5444db73..2b696b1575 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -310,7 +310,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) { create_resource->set_text(String("No polygon resource on this node.\nCreate and assign one?")); - create_resource->popup_centered_minsize(); + create_resource->popup_centered(); } return (mb.is_valid() && mb->get_button_index() == 1); } diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 7916ac71ea..232f9f9521 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -735,7 +735,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { 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->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); open_file->connect("file_selected", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_file_opened)); undo_redo = EditorNode::get_undo_redo(); diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index f2a51459e6..d95b667f41 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -1042,7 +1042,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { 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->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); open_file->connect("file_selected", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_file_opened)); undo_redo = EditorNode::get_undo_redo(); diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 8339371ca7..ddf996b94c 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -705,7 +705,7 @@ void AnimationNodeBlendTreeEditor::_edit_filters(const String &p_which) { if (!_update_filters(anode)) return; - filter_dialog->popup_centered_minsize(Size2(500, 500) * EDSCALE); + filter_dialog->popup_centered(Size2(500, 500) * EDSCALE); } void AnimationNodeBlendTreeEditor::_removed_from_graph() { @@ -975,7 +975,7 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() { 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->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); 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 5363c64548..71e6529254 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -349,7 +349,7 @@ void AnimationPlayerEditor::_animation_rename() { } void AnimationPlayerEditor::_animation_load() { ERR_FAIL_COND(!player); - file->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); file->clear_filters(); List<String> extensions; @@ -392,7 +392,7 @@ void AnimationPlayerEditor::_animation_save(const Ref<Resource> &p_resource) { void AnimationPlayerEditor::_animation_save_as(const Ref<Resource> &p_resource) { - file->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); List<String> extensions; ResourceSaver::get_recognized_extensions(p_resource, &extensions); @@ -434,7 +434,7 @@ void AnimationPlayerEditor::_animation_remove() { return; delete_dialog->set_text(TTR("Delete Animation?")); - delete_dialog->popup_centered_minsize(); + delete_dialog->popup_centered(); } void AnimationPlayerEditor::_animation_remove_confirmed() { @@ -501,7 +501,7 @@ void AnimationPlayerEditor::_animation_name_edited() { String new_name = name->get_text(); if (new_name == "" || new_name.find(":") != -1 || new_name.find("/") != -1) { error_dialog->set_text(TTR("Invalid animation name!")); - error_dialog->popup_centered_minsize(); + error_dialog->popup_centered(); return; } @@ -512,7 +512,7 @@ void AnimationPlayerEditor::_animation_name_edited() { if (player->has_animation(new_name)) { error_dialog->set_text(TTR("Animation name already exists!")); - error_dialog->popup_centered_minsize(); + error_dialog->popup_centered(); return; } @@ -1058,7 +1058,7 @@ void AnimationPlayerEditor::_animation_player_changed(Object *p_pl) { if (player == p_pl && is_visible_in_tree()) { _update_player(); - if (blend_editor.dialog->is_visible_in_tree()) + if (blend_editor.dialog->is_visible()) _animation_blend(); // Update. } } @@ -1152,7 +1152,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) { if (!animation->get_item_count()) { error_dialog->set_text(TTR("No animation to copy!")); - error_dialog->popup_centered_minsize(); + error_dialog->popup_centered(); return; } @@ -1165,7 +1165,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) { Ref<Animation> anim2 = EditorSettings::get_singleton()->get_resource_clipboard(); if (!anim2.is_valid()) { error_dialog->set_text(TTR("No animation resource on clipboard!")); - error_dialog->popup_centered_minsize(); + error_dialog->popup_centered(); return; } @@ -1195,7 +1195,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) { if (!animation->get_item_count()) { error_dialog->set_text(TTR("No animation to edit!")); - error_dialog->popup_centered_minsize(); + error_dialog->popup_centered(); return; } diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 7de35068fa..6ec619e058 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -1367,7 +1367,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { 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->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); open_file->connect("file_selected", callable_mp(this, &AnimationNodeStateMachineEditor::_file_opened)); undo_redo = EditorNode::get_undo_redo(); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index ed08139e06..a3bfa5e0ea 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -116,7 +116,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() { VBoxContainer *vb = memnew(VBoxContainer); hb->add_child(vb); - vb->set_h_size_flags(SIZE_EXPAND_FILL); + vb->set_h_size_flags(Control::SIZE_EXPAND_FILL); title = memnew(LinkButton); title->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER); @@ -137,7 +137,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() { vb->add_child(price); set_custom_minimum_size(Size2(250, 100) * EDSCALE); - set_h_size_flags(SIZE_EXPAND_FILL); + set_h_size_flags(Control::SIZE_EXPAND_FILL); } ////////////////////////////////////////////////////////////////////////////// @@ -156,7 +156,7 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const for (int i = 0; i < preview_images.size(); i++) { if (preview_images[i].id == p_index) { if (preview_images[i].is_video) { - Ref<Image> overlay = get_icon("PlayOverlay", "EditorIcons")->get_data(); + Ref<Image> overlay = previews->get_icon("PlayOverlay", "EditorIcons")->get_data(); Ref<Image> thumbnail = p_image->get_data(); thumbnail = thumbnail->duplicate(); Point2 overlay_pos = Point2((thumbnail->get_width() - overlay->get_width()) / 2, (thumbnail->get_height() - overlay->get_height()) / 2); @@ -172,7 +172,7 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const preview_images[i].button->set_icon(tex); // Make it clearer that clicking it will open an external link - preview_images[i].button->set_default_cursor_shape(CURSOR_POINTING_HAND); + preview_images[i].button->set_default_cursor_shape(Control::CURSOR_POINTING_HAND); } else { preview_images[i].button->set_icon(p_image); } @@ -198,7 +198,7 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const void EditorAssetLibraryItemDescription::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - previews_bg->add_style_override("panel", get_stylebox("normal", "TextEdit")); + previews_bg->add_style_override("panel", previews->get_stylebox("normal", "TextEdit")); } break; } } @@ -219,7 +219,7 @@ void EditorAssetLibraryItemDescription::_preview_click(int p_id) { if (!preview_images[i].is_video) { if (preview_images[i].image.is_valid()) { preview->set_texture(preview_images[i].image); - minimum_size_changed(); + child_controls_changed(); } } else { _link_click(preview_images[i].video_link); @@ -256,12 +256,12 @@ void EditorAssetLibraryItemDescription::add_preview(int p_id, bool p_video, cons preview.is_video = p_video; preview.button = memnew(Button); preview.button->set_flat(true); - preview.button->set_icon(get_icon("ThumbnailWait", "EditorIcons")); + preview.button->set_icon(previews->get_icon("ThumbnailWait", "EditorIcons")); preview.button->set_toggle_mode(true); 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"); + preview.image = previews->get_icon("ThumbnailWait", "EditorIcons"); } preview_images.push_back(preview); if (preview_images.size() == 1 && !p_video) { @@ -284,14 +284,14 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() { description = memnew(RichTextLabel); desc_vbox->add_child(description); - description->set_v_size_flags(SIZE_EXPAND_FILL); + description->set_v_size_flags(Control::SIZE_EXPAND_FILL); 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); hbox->add_child(previews_vbox); previews_vbox->add_constant_override("separation", 15 * EDSCALE); - previews_vbox->set_v_size_flags(SIZE_EXPAND_FILL); + previews_vbox->set_v_size_flags(Control::SIZE_EXPAND_FILL); preview = memnew(TextureRect); previews_vbox->add_child(preview); @@ -308,7 +308,7 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() { previews->set_enable_v_scroll(false); previews->set_enable_h_scroll(true); preview_hb = memnew(HBoxContainer); - preview_hb->set_v_size_flags(SIZE_EXPAND_FILL); + preview_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL); previews->add_child(preview_hb); get_ok()->set_text(TTR("Download")); @@ -375,7 +375,7 @@ void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int if (error_text != String()) { download_error->set_text(TTR("Asset Download Error:") + "\n" + error_text); - download_error->popup_centered_minsize(); + download_error->popup_centered(); return; } @@ -507,13 +507,13 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { VBoxContainer *vb = memnew(VBoxContainer); hb->add_child(vb); - vb->set_h_size_flags(SIZE_EXPAND_FILL); + vb->set_h_size_flags(Control::SIZE_EXPAND_FILL); HBoxContainer *title_hb = memnew(HBoxContainer); vb->add_child(title_hb); title = memnew(Label); title_hb->add_child(title); - title->set_h_size_flags(SIZE_EXPAND_FILL); + title->set_h_size_flags(Control::SIZE_EXPAND_FILL); dismiss = memnew(TextureButton); dismiss->connect("pressed", callable_mp(this, &EditorAssetLibraryItemDownload::_close)); @@ -1260,7 +1260,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const description = memnew(EditorAssetLibraryItemDescription); add_child(description); - description->popup_centered_minsize(); + description->popup_centered(); 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"]); @@ -1357,7 +1357,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { filter = memnew(LineEdit); search_hb->add_child(filter); - filter->set_h_size_flags(SIZE_EXPAND_FILL); + filter->set_h_size_flags(Control::SIZE_EXPAND_FILL); filter->connect("text_entered", callable_mp(this, &EditorAssetLibrary::_search_text_entered)); search = memnew(Button(TTR("Search"))); search->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search), make_binds(0)); @@ -1392,7 +1392,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { search_hb2->add_child(sort); - sort->set_h_size_flags(SIZE_EXPAND_FILL); + sort->set_h_size_flags(Control::SIZE_EXPAND_FILL); sort->connect("item_selected", callable_mp(this, &EditorAssetLibrary::_rerun_search)); search_hb2->add_child(memnew(VSeparator)); @@ -1401,7 +1401,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { categories = memnew(OptionButton); categories->add_item(TTR("All")); search_hb2->add_child(categories); - categories->set_h_size_flags(SIZE_EXPAND_FILL); + categories->set_h_size_flags(Control::SIZE_EXPAND_FILL); categories->connect("item_selected", callable_mp(this, &EditorAssetLibrary::_rerun_search)); search_hb2->add_child(memnew(VSeparator)); @@ -1417,7 +1417,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { repository->connect("item_selected", callable_mp(this, &EditorAssetLibrary::_repository_changed)); search_hb2->add_child(repository); - repository->set_h_size_flags(SIZE_EXPAND_FILL); + repository->set_h_size_flags(Control::SIZE_EXPAND_FILL); search_hb2->add_child(memnew(VSeparator)); @@ -1435,7 +1435,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { library_scroll_bg = memnew(PanelContainer); library_main->add_child(library_scroll_bg); - library_scroll_bg->set_v_size_flags(SIZE_EXPAND_FILL); + library_scroll_bg->set_v_size_flags(Control::SIZE_EXPAND_FILL); library_scroll = memnew(ScrollContainer); library_scroll->set_enable_v_scroll(true); @@ -1453,10 +1453,10 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { PanelContainer *library_vb_border = memnew(PanelContainer); library_scroll->add_child(library_vb_border); library_vb_border->add_style_override("panel", border2); - library_vb_border->set_h_size_flags(SIZE_EXPAND_FILL); + library_vb_border->set_h_size_flags(Control::SIZE_EXPAND_FILL); library_vb = memnew(VBoxContainer); - library_vb->set_h_size_flags(SIZE_EXPAND_FILL); + library_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL); library_vb_border->add_child(library_vb); @@ -1516,7 +1516,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { asset_open->set_access(EditorFileDialog::ACCESS_FILESYSTEM); asset_open->add_filter("*.zip ; " + TTR("Assets ZIP File")); - asset_open->set_mode(EditorFileDialog::MODE_OPEN_FILE); + asset_open->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); add_child(asset_open); asset_open->connect("file_selected", callable_mp(this, &EditorAssetLibrary::_asset_file_selected)); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 267292a9ee..686a26ce68 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -99,7 +99,7 @@ public: label = memnew(Label); label->set_text(TTR("Grid Offset:")); child_container->add_child(label); - label->set_h_size_flags(SIZE_EXPAND_FILL); + label->set_h_size_flags(Control::SIZE_EXPAND_FILL); grid_offset_x = memnew(SpinBox); grid_offset_x->set_min(-SPIN_BOX_GRID_RANGE); @@ -107,7 +107,7 @@ public: grid_offset_x->set_allow_lesser(true); grid_offset_x->set_allow_greater(true); grid_offset_x->set_suffix("px"); - grid_offset_x->set_h_size_flags(SIZE_EXPAND_FILL); + grid_offset_x->set_h_size_flags(Control::SIZE_EXPAND_FILL); child_container->add_child(grid_offset_x); grid_offset_y = memnew(SpinBox); @@ -116,20 +116,20 @@ public: grid_offset_y->set_allow_lesser(true); grid_offset_y->set_allow_greater(true); grid_offset_y->set_suffix("px"); - grid_offset_y->set_h_size_flags(SIZE_EXPAND_FILL); + grid_offset_y->set_h_size_flags(Control::SIZE_EXPAND_FILL); child_container->add_child(grid_offset_y); label = memnew(Label); label->set_text(TTR("Grid Step:")); child_container->add_child(label); - label->set_h_size_flags(SIZE_EXPAND_FILL); + label->set_h_size_flags(Control::SIZE_EXPAND_FILL); grid_step_x = memnew(SpinBox); grid_step_x->set_min(0.01); grid_step_x->set_max(SPIN_BOX_GRID_RANGE); grid_step_x->set_allow_greater(true); grid_step_x->set_suffix("px"); - grid_step_x->set_h_size_flags(SIZE_EXPAND_FILL); + grid_step_x->set_h_size_flags(Control::SIZE_EXPAND_FILL); child_container->add_child(grid_step_x); grid_step_y = memnew(SpinBox); @@ -137,7 +137,7 @@ public: grid_step_y->set_max(SPIN_BOX_GRID_RANGE); grid_step_y->set_allow_greater(true); grid_step_y->set_suffix("px"); - grid_step_y->set_h_size_flags(SIZE_EXPAND_FILL); + grid_step_y->set_h_size_flags(Control::SIZE_EXPAND_FILL); child_container->add_child(grid_step_y); child_container = memnew(GridContainer); @@ -146,7 +146,7 @@ public: label = memnew(Label); label->set_text(TTR("Primary Line Every:")); - label->set_h_size_flags(SIZE_EXPAND_FILL); + label->set_h_size_flags(Control::SIZE_EXPAND_FILL); child_container->add_child(label); primary_grid_steps = memnew(SpinBox); @@ -155,7 +155,7 @@ public: primary_grid_steps->set_max(100); primary_grid_steps->set_allow_greater(true); primary_grid_steps->set_suffix(TTR("steps")); - primary_grid_steps->set_h_size_flags(SIZE_EXPAND_FILL); + primary_grid_steps->set_h_size_flags(Control::SIZE_EXPAND_FILL); child_container->add_child(primary_grid_steps); container->add_child(memnew(HSeparator)); @@ -169,25 +169,25 @@ public: label = memnew(Label); label->set_text(TTR("Rotation Offset:")); child_container->add_child(label); - label->set_h_size_flags(SIZE_EXPAND_FILL); + label->set_h_size_flags(Control::SIZE_EXPAND_FILL); rotation_offset = memnew(SpinBox); rotation_offset->set_min(-SPIN_BOX_ROTATION_RANGE); rotation_offset->set_max(SPIN_BOX_ROTATION_RANGE); rotation_offset->set_suffix("deg"); - rotation_offset->set_h_size_flags(SIZE_EXPAND_FILL); + rotation_offset->set_h_size_flags(Control::SIZE_EXPAND_FILL); child_container->add_child(rotation_offset); label = memnew(Label); label->set_text(TTR("Rotation Step:")); child_container->add_child(label); - label->set_h_size_flags(SIZE_EXPAND_FILL); + label->set_h_size_flags(Control::SIZE_EXPAND_FILL); rotation_step = memnew(SpinBox); rotation_step->set_min(-SPIN_BOX_ROTATION_RANGE); rotation_step->set_max(SPIN_BOX_ROTATION_RANGE); rotation_step->set_suffix("deg"); - rotation_step->set_h_size_flags(SIZE_EXPAND_FILL); + rotation_step->set_h_size_flags(Control::SIZE_EXPAND_FILL); child_container->add_child(rotation_step); container->add_child(memnew(HSeparator)); @@ -198,13 +198,13 @@ public: label = memnew(Label); label->set_text(TTR("Scale Step:")); child_container->add_child(label); - label->set_h_size_flags(SIZE_EXPAND_FILL); + label->set_h_size_flags(Control::SIZE_EXPAND_FILL); scale_step = memnew(SpinBox); scale_step->set_min(SPIN_BOX_SCALE_MIN); scale_step->set_max(SPIN_BOX_SCALE_MAX); scale_step->set_allow_greater(true); - scale_step->set_h_size_flags(SIZE_EXPAND_FILL); + scale_step->set_h_size_flags(Control::SIZE_EXPAND_FILL); scale_step->set_step(0.01f); child_container->add_child(scale_step); } @@ -5420,18 +5420,18 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { bottom_split = memnew(VSplitContainer); add_child(bottom_split); - bottom_split->set_v_size_flags(SIZE_EXPAND_FILL); + bottom_split->set_v_size_flags(Control::SIZE_EXPAND_FILL); palette_split = memnew(HSplitContainer); bottom_split->add_child(palette_split); - palette_split->set_v_size_flags(SIZE_EXPAND_FILL); + palette_split->set_v_size_flags(Control::SIZE_EXPAND_FILL); viewport_scrollable = memnew(Control); palette_split->add_child(viewport_scrollable); viewport_scrollable->set_mouse_filter(MOUSE_FILTER_PASS); 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->set_v_size_flags(Control::SIZE_EXPAND_FILL); + viewport_scrollable->set_h_size_flags(Control::SIZE_EXPAND_FILL); viewport_scrollable->connect("draw", callable_mp(this, &CanvasItemEditor::_update_scrollbars)); ViewportContainer *scene_tree = memnew(ViewportContainer); @@ -6049,7 +6049,7 @@ void CanvasItemEditorViewport::_perform_drop_data() { // Without root dropping multiple files is not allowed if (!target_node && selected_files.size() > 1) { accept->set_text(TTR("Cannot instantiate multiple nodes without root.")); - accept->popup_centered_minsize(); + accept->popup_centered(); return; } @@ -6110,7 +6110,7 @@ void CanvasItemEditorViewport::_perform_drop_data() { } files_str = files_str.substr(0, files_str.length() - 1); accept->set_text(vformat(TTR("Error instancing scene from %s"), files_str.c_str())); - accept->popup_centered_minsize(); + accept->popup_centered(); } } @@ -6176,7 +6176,7 @@ void CanvasItemEditorViewport::_show_resource_type_selector() { check->set_pressed(check->get_text() == default_type); } selector->set_title(vformat(TTR("Add %s"), default_type)); - selector->popup_centered_minsize(); + selector->popup_centered(); } bool CanvasItemEditorViewport::_only_packed_scenes_selected() const { @@ -6271,12 +6271,12 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte editor->get_gui_base()->add_child(selector); selector->set_title(TTR("Change Default Type")); selector->connect("confirmed", callable_mp(this, &CanvasItemEditorViewport::_on_change_type_confirmed)); - selector->connect("popup_hide", callable_mp(this, &CanvasItemEditorViewport::_on_change_type_closed)); + selector->connect("cancelled", callable_mp(this, &CanvasItemEditorViewport::_on_change_type_closed)); VBoxContainer *vbc = memnew(VBoxContainer); selector->add_child(vbc); - vbc->set_h_size_flags(SIZE_EXPAND_FILL); - vbc->set_v_size_flags(SIZE_EXPAND_FILL); + vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); + vbc->set_v_size_flags(Control::SIZE_EXPAND_FILL); vbc->set_custom_minimum_size(Size2(200, 260) * EDSCALE); btn_group = memnew(VBoxContainer); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 3c4cacf5c8..f109b06aa3 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -687,7 +687,7 @@ class CanvasItemEditorViewport : public Control { CanvasItemEditor *canvas_item_editor; Node2D *preview_node; AcceptDialog *accept; - WindowDialog *selector; + AcceptDialog *selector; Label *selector_label; Label *label; Label *label_desc; diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp index 119528dfc8..317fd581be 100644 --- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp @@ -60,7 +60,7 @@ void CPUParticles2DEditorPlugin::make_visible(bool p_visible) { void CPUParticles2DEditorPlugin::_file_selected(const String &p_file) { source_emission_file = p_file; - emission_mask->popup_centered_minsize(); + emission_mask->popup_centered(); } void CPUParticles2DEditorPlugin::_menu_callback(int p_idx) { @@ -73,7 +73,7 @@ void CPUParticles2DEditorPlugin::_menu_callback(int p_idx) { } break; case MENU_CLEAR_EMISSION_MASK: { - emission_mask->popup_centered_minsize(); + emission_mask->popup_centered(); } break; case MENU_RESTART: { @@ -276,7 +276,7 @@ CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) { for (List<String>::Element *E = ext.front(); E; E = E->next()) { file->add_filter("*." + E->get() + "; " + E->get().to_upper()); } - file->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); toolbar->add_child(file); epoints = memnew(SpinBox); diff --git a/editor/plugins/gi_probe_editor_plugin.cpp b/editor/plugins/gi_probe_editor_plugin.cpp index c077c23e8a..88a824cc24 100644 --- a/editor/plugins/gi_probe_editor_plugin.cpp +++ b/editor/plugins/gi_probe_editor_plugin.cpp @@ -165,7 +165,7 @@ GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) { add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, bake_hb); gi_probe = NULL; probe_file = memnew(EditorFileDialog); - probe_file->set_mode(EditorFileDialog::MODE_SAVE_FILE); + probe_file->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); probe_file->add_filter("*.res"); probe_file->connect("file_selected", callable_mp(this, &GIProbeEditorPlugin::_giprobe_save_path_and_bake)); get_editor_interface()->get_base_control()->add_child(probe_file); diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp index 6025e7dd9d..c0a083bf1d 100644 --- a/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_editor_plugin.cpp @@ -55,7 +55,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { Ref<Mesh> mesh = node->get_mesh(); if (mesh.is_null()) { err_dialog->set_text(TTR("Mesh is empty!")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -71,7 +71,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { Ref<Shape> shape = mesh->create_trimesh_shape(); if (shape.is_null()) { err_dialog->set_text(TTR("Couldn't create a Trimesh collision shape.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -130,7 +130,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { if (node == get_tree()->get_edited_scene_root()) { err_dialog->set_text(TTR("This doesn't work on scene root!")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -158,7 +158,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { if (node == get_tree()->get_edited_scene_root()) { err_dialog->set_text(TTR("Can't create a single convex collision shape for the scene root.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -166,7 +166,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { if (shape.is_null()) { err_dialog->set_text(TTR("Couldn't create a single convex collision shape.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); @@ -192,7 +192,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { if (node == get_tree()->get_edited_scene_root()) { err_dialog->set_text(TTR("Can't create multiple convex collision shapes for the scene root.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -200,7 +200,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { if (!shapes.size()) { err_dialog->set_text(TTR("Couldn't create any collision shapes.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); @@ -258,14 +258,14 @@ void MeshInstanceEditor::_menu_option(int p_option) { Ref<ArrayMesh> mesh2 = node->get_mesh(); if (!mesh2.is_valid()) { err_dialog->set_text(TTR("Contained Mesh is not of type ArrayMesh.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } Error err = mesh2->lightmap_unwrap(node->get_global_transform()); if (err != OK) { err_dialog->set_text(TTR("UV Unwrap failed, mesh may not be manifold?")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -274,7 +274,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { Ref<Mesh> mesh2 = node->get_mesh(); if (!mesh2.is_valid()) { err_dialog->set_text(TTR("No mesh to debug.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } _create_uv_lines(0); @@ -283,7 +283,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { Ref<Mesh> mesh2 = node->get_mesh(); if (!mesh2.is_valid()) { err_dialog->set_text(TTR("No mesh to debug.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } _create_uv_lines(1); @@ -330,7 +330,7 @@ void MeshInstanceEditor::_create_uv_lines(int p_layer) { Vector<Vector2> uv = a[p_layer == 0 ? Mesh::ARRAY_TEX_UV : Mesh::ARRAY_TEX_UV2]; if (uv.size() == 0) { err_dialog->set_text(TTR("Model has no UV in this layer")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -374,7 +374,7 @@ void MeshInstanceEditor::_create_uv_lines(int p_layer) { } } - debug_uv_dialog->popup_centered_minsize(); + debug_uv_dialog->popup_centered(); } void MeshInstanceEditor::_debug_uv_draw() { @@ -393,17 +393,17 @@ void MeshInstanceEditor::_create_outline_mesh() { Ref<Mesh> mesh = node->get_mesh(); if (mesh.is_null()) { err_dialog->set_text(TTR("MeshInstance lacks a Mesh!")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } if (mesh->get_surface_count() == 0) { err_dialog->set_text(TTR("Mesh has not surface to create outlines from!")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } else if (mesh->get_surface_count() == 1 && mesh->surface_get_primitive_type(0) != Mesh::PRIMITIVE_TRIANGLES) { err_dialog->set_text(TTR("Mesh primitive type is not PRIMITIVE_TRIANGLES!")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -411,7 +411,7 @@ void MeshInstanceEditor::_create_outline_mesh() { if (mesho.is_null()) { err_dialog->set_text(TTR("Could not create outline!")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index f341d9ca86..918d35554d 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -253,7 +253,7 @@ void MeshLibraryEditor::_bind_methods() { MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) { file = memnew(EditorFileDialog); - file->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); //not for now? List<String> extensions; ResourceLoader::get_recognized_extensions_for_type("PackedScene", &extensions); diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index 27d400c035..3e5c10c461 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -56,13 +56,13 @@ void MultiMeshEditor::_populate() { if (multimesh.is_null()) { err_dialog->set_text(TTR("No mesh source specified (and no MultiMesh set in node).")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } if (multimesh->get_mesh().is_null()) { err_dialog->set_text(TTR("No mesh source specified (and MultiMesh contains no Mesh).")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -74,7 +74,7 @@ void MultiMeshEditor::_populate() { if (!ms_node) { err_dialog->set_text(TTR("Mesh source is invalid (invalid path).")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -83,7 +83,7 @@ void MultiMeshEditor::_populate() { if (!ms_instance) { err_dialog->set_text(TTR("Mesh source is invalid (not a MeshInstance).")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -92,7 +92,7 @@ void MultiMeshEditor::_populate() { if (mesh.is_null()) { err_dialog->set_text(TTR("Mesh source is invalid (contains no Mesh resource).")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } } @@ -100,7 +100,7 @@ void MultiMeshEditor::_populate() { if (surface_source->get_text() == "") { err_dialog->set_text(TTR("No surface source specified.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -109,7 +109,7 @@ void MultiMeshEditor::_populate() { if (!ss_node) { err_dialog->set_text(TTR("Surface source is invalid (invalid path).")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -118,7 +118,7 @@ void MultiMeshEditor::_populate() { if (!ss_instance) { err_dialog->set_text(TTR("Surface source is invalid (no geometry).")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -129,7 +129,7 @@ void MultiMeshEditor::_populate() { if (geometry.size() == 0) { err_dialog->set_text(TTR("Surface source is invalid (no faces).")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index 812144742f..fdf1fb43bf 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -60,7 +60,7 @@ void Particles2DEditorPlugin::make_visible(bool p_visible) { void Particles2DEditorPlugin::_file_selected(const String &p_file) { source_emission_file = p_file; - emission_mask->popup_centered_minsize(); + emission_mask->popup_centered(); } void Particles2DEditorPlugin::_menu_callback(int p_idx) { @@ -72,7 +72,7 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) { generate_seconds->set_value(1.0); else generate_seconds->set_value(trunc(gen_time) + 1.0); - generate_visibility_rect->popup_centered_minsize(); + generate_visibility_rect->popup_centered(); } break; case MENU_LOAD_EMISSION_MASK: { @@ -81,7 +81,7 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) { } break; case MENU_CLEAR_EMISSION_MASK: { - emission_mask->popup_centered_minsize(); + emission_mask->popup_centered(); } break; case MENU_OPTION_CONVERT_TO_CPU_PARTICLES: { @@ -389,7 +389,7 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) { for (List<String>::Element *E = ext.front(); E; E = E->next()) { file->add_filter("*." + E->get() + "; " + E->get().to_upper()); } - file->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); toolbar->add_child(file); epoints = memnew(SpinBox); diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index a4d704c6e1..9dfbe54911 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -260,7 +260,7 @@ void ParticlesEditor::_menu_option(int p_option) { generate_seconds->set_value(1.0); else generate_seconds->set_value(trunc(gen_time) + 1.0); - generate_aabb->popup_centered_minsize(); + generate_aabb->popup_centered(); } break; case MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE: { Ref<ParticlesMaterial> material = node->get_process_material(); diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index ddb5e02201..f020007bd0 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -110,7 +110,7 @@ void Polygon2DEditor::_sync_bones() { Skeleton2D *skeleton = NULL; if (!node->has_node(node->get_skeleton())) { error->set_text(TTR("The skeleton property of the Polygon2D does not point to a Skeleton2D node")); - error->popup_centered_minsize(); + error->popup_centered(); } else { Node *sn = node->get_node(node->get_skeleton()); skeleton = Object::cast_to<Skeleton2D>(sn); @@ -121,7 +121,7 @@ void Polygon2DEditor::_sync_bones() { if (!skeleton) { error->set_text(TTR("The skeleton property of the Polygon2D does not point to a Skeleton2D node")); - error->popup_centered_minsize(); + error->popup_centered(); } else { for (int i = 0; i < skeleton->get_bone_count(); i++) { NodePath path = skeleton->get_path_to(skeleton->get_bone(i)); @@ -275,7 +275,7 @@ void Polygon2DEditor::_uv_edit_mode_select(int p_mode) { void Polygon2DEditor::_uv_edit_popup_hide() { - EditorSettings::get_singleton()->set("interface/dialogs/uv_editor_bounds", uv_edit->get_rect()); + EditorSettings::get_singleton()->set("interface/dialogs/uv_editor_bounds", Rect2(uv_edit->get_position(), uv_edit->get_size())); _cancel_editing(); } @@ -289,7 +289,7 @@ void Polygon2DEditor::_menu_option(int p_option) { if (node->get_texture().is_null()) { error->set_text(TTR("No texture in this polygon.\nSet a texture to be able to edit UV.")); - error->popup_centered_minsize(); + error->popup_centered(); return; } @@ -351,7 +351,7 @@ void Polygon2DEditor::_menu_option(int p_option) { } break; case UVEDIT_GRID_SETTINGS: { - grid_settings->popup_centered_minsize(); + grid_settings->popup_centered(); } break; default: { @@ -683,7 +683,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { //close if (polygon_create.size() < 3) { error->set_text(TTR("Invalid Polygon (need 3 different vertices)")); - error->popup_centered_minsize(); + error->popup_centered(); } else { Array polygons = node->get_polygons(); polygons = polygons.duplicate(); //copy because its a reference @@ -1265,8 +1265,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) : uv_edit = memnew(AcceptDialog); add_child(uv_edit); uv_edit->set_title(TTR("Polygon 2D UV Editor")); - uv_edit->set_resizable(true); - uv_edit->connect("popup_hide", callable_mp(this, &Polygon2DEditor::_uv_edit_popup_hide)); + uv_edit->connect("cancelled", callable_mp(this, &Polygon2DEditor::_uv_edit_popup_hide)); VBoxContainer *uv_main_vb = memnew(VBoxContainer); uv_edit->add_child(uv_main_vb); diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index feef505acc..041d4196d4 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -67,7 +67,7 @@ void ResourcePreloaderEditor::_files_load_request(const Vector<String> &p_paths) dialog->set_title(TTR("Error!")); //dialog->get_cancel()->set_text("Close"); dialog->get_ok()->set_text(TTR("Close")); - dialog->popup_centered_minsize(); + dialog->popup_centered(); return; ///beh should show an error i guess } @@ -98,7 +98,7 @@ void ResourcePreloaderEditor::_load_pressed() { for (int i = 0; i < extensions.size(); i++) file->add_filter("*." + extensions[i]); - file->set_mode(EditorFileDialog::MODE_OPEN_FILES); + file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILES); file->popup_centered_ratio(); } @@ -152,7 +152,7 @@ void ResourcePreloaderEditor::_paste_pressed() { dialog->set_text(TTR("Resource clipboard is empty!")); dialog->set_title(TTR("Error!")); dialog->get_ok()->set_text(TTR("Close")); - dialog->popup_centered_minsize(); + dialog->popup_centered(); return; ///beh should show an error i guess } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 826604fa97..009d270fcd 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -215,9 +215,9 @@ void ScriptEditorQuickOpen::_notification(int p_what) { search_box->set_clear_button_enabled(true); [[fallthrough]]; - } - case NOTIFICATION_THEME_CHANGED: { - search_box->set_right_icon(get_icon("Search", "EditorIcons")); + }; + case NOTIFICATION_VISIBILITY_CHANGED: { + search_box->set_right_icon(search_options->get_icon("Search", "EditorIcons")); } break; case NOTIFICATION_EXIT_TREE: { disconnect("confirmed", callable_mp(this, &ScriptEditorQuickOpen::_confirmed)); @@ -557,7 +557,7 @@ void ScriptEditor::_open_recent_script(int p_idx) { void ScriptEditor::_show_error_dialog(String p_path) { error_dialog->set_text(vformat(TTR("Can't open '%s'. The file could have been moved or deleted."), p_path)); - error_dialog->popup_centered_minsize(); + error_dialog->popup_centered(); } void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) { @@ -704,7 +704,7 @@ void ScriptEditor::_close_all_tabs() { void ScriptEditor::_ask_close_current_unsaved_tab(ScriptEditorBase *current) { erase_tab_confirm->set_text(TTR("Close and save changes?") + "\n\"" + current->get_name() + "\""); - erase_tab_confirm->popup_centered_minsize(); + erase_tab_confirm->popup_centered(); } void ScriptEditor::_resave_scripts(const String &p_str) { @@ -996,7 +996,7 @@ void ScriptEditor::_menu_option(int p_option) { script_create_dialog->popup_centered(); } break; case FILE_NEW_TEXTFILE: { - file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); file_dialog_option = FILE_NEW_TEXTFILE; @@ -1005,7 +1005,7 @@ void ScriptEditor::_menu_option(int p_option) { file_dialog->set_title(TTR("New Text File...")); } break; case FILE_OPEN: { - file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); file_dialog_option = FILE_OPEN; @@ -1170,7 +1170,7 @@ void ScriptEditor::_menu_option(int p_option) { Ref<TextFile> text_file = current->get_edited_resource(); if (text_file != NULL) { - file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); file_dialog_option = FILE_SAVE_AS; @@ -1336,7 +1336,7 @@ void ScriptEditor::_menu_option(int p_option) { void ScriptEditor::_theme_option(int p_option) { switch (p_option) { case THEME_IMPORT: { - file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); file_dialog_option = THEME_IMPORT; file_dialog->clear_filters(); @@ -1361,7 +1361,7 @@ void ScriptEditor::_theme_option(int p_option) { } void ScriptEditor::_show_save_theme_as_dialog() { - file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); file_dialog_option = THEME_SAVE_AS; file_dialog->clear_filters(); @@ -2953,7 +2953,7 @@ void ScriptEditor::_on_find_in_files_requested(String text) { find_in_files_dialog->set_find_in_files_mode(FindInFilesDialog::SEARCH_MODE); find_in_files_dialog->set_search_text(text); - find_in_files_dialog->popup_centered_minsize(); + find_in_files_dialog->popup_centered(); } void ScriptEditor::_on_replace_in_files_requested(String text) { @@ -2961,7 +2961,7 @@ void ScriptEditor::_on_replace_in_files_requested(String text) { find_in_files_dialog->set_find_in_files_mode(FindInFilesDialog::REPLACE_MODE); find_in_files_dialog->set_search_text(text); find_in_files_dialog->set_replace_text(""); - find_in_files_dialog->popup_centered_minsize(); + find_in_files_dialog->popup_centered(); } void ScriptEditor::_on_find_in_files_result_selected(String fpath, int line_number, int begin, int end) { diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 176df7efb8..801a2c54ad 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -65,7 +65,8 @@ void ConnectionInfoDialog::popup_connections(String p_method, Vector<Node *> p_n node_item->set_editable(0, false); node_item->set_text(1, connection.signal.get_name()); - node_item->set_icon(1, get_parent_control()->get_icon("Slot", "EditorIcons")); + Control *p = Object::cast_to<Control>(get_parent()); + node_item->set_icon(1, p->get_icon("Slot", "EditorIcons")); node_item->set_selectable(1, false); node_item->set_editable(1, false); @@ -83,10 +84,10 @@ ConnectionInfoDialog::ConnectionInfoDialog() { set_title(TTR("Connections to method:")); VBoxContainer *vbc = memnew(VBoxContainer); - vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE); - vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE); - vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE); - vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE); + vbc->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE); + vbc->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 8 * EDSCALE); + vbc->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -8 * EDSCALE); + vbc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -8 * EDSCALE); add_child(vbc); method = memnew(Label); @@ -101,7 +102,7 @@ ConnectionInfoDialog::ConnectionInfoDialog() { tree->set_column_title(1, TTR("Signal")); tree->set_column_title(2, TTR("Target")); vbc->add_child(tree); - tree->set_v_size_flags(SIZE_EXPAND_FILL); + tree->set_v_size_flags(Control::SIZE_EXPAND_FILL); tree->set_allow_rmb_select(true); } diff --git a/editor/plugins/skeleton_2d_editor_plugin.cpp b/editor/plugins/skeleton_2d_editor_plugin.cpp index 0b77b987bf..a5dc40e3c9 100644 --- a/editor/plugins/skeleton_2d_editor_plugin.cpp +++ b/editor/plugins/skeleton_2d_editor_plugin.cpp @@ -59,7 +59,7 @@ void Skeleton2DEditor::_menu_option(int p_option) { if (node->get_bone_count() == 0) { err_dialog->set_text(TTR("This skeleton has no bones, create some children Bone2D nodes.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); @@ -75,7 +75,7 @@ void Skeleton2DEditor::_menu_option(int p_option) { case MENU_OPTION_SET_REST: { if (node->get_bone_count() == 0) { err_dialog->set_text(TTR("This skeleton has no bones, create some children Bone2D nodes.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index c72b4f1bb1..09980e0d5c 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -3706,7 +3706,7 @@ void SpatialEditorViewport::_perform_drop_data() { } files_str = files_str.substr(0, files_str.length() - 1); accept->set_text(vformat(TTR("Error instancing scene from %s"), files_str.c_str())); - accept->popup_centered_minsize(); + accept->popup_centered(); } } @@ -3786,14 +3786,14 @@ void SpatialEditorViewport::drop_data_fw(const Point2 &p_point, const Variant &p list.push_back(root_node); } else { accept->set_text(TTR("No parent to instance a child at.")); - accept->popup_centered_minsize(); + accept->popup_centered(); _remove_preview(); return; } } if (list.size() != 1) { accept->set_text(TTR("This operation requires a single selected node.")); - accept->popup_centered_minsize(); + accept->popup_centered(); _remove_preview(); return; } diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp index 2897341f06..1d6e6558ba 100644 --- a/editor/plugins/sprite_editor_plugin.cpp +++ b/editor/plugins/sprite_editor_plugin.cpp @@ -170,13 +170,13 @@ void SpriteEditor::_update_mesh_data() { Ref<Texture2D> texture = node->get_texture(); if (texture.is_null()) { err_dialog->set_text(TTR("Sprite is empty!")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } if (node->get_hframes() > 1 || node->get_vframes() > 1) { err_dialog->set_text(TTR("Can't convert a sprite using animation frames to mesh.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -317,7 +317,7 @@ void SpriteEditor::_convert_to_mesh_2d_node() { if (computed_vertices.size() < 3) { err_dialog->set_text(TTR("Invalid geometry, can't replace by mesh.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -348,7 +348,7 @@ void SpriteEditor::_convert_to_polygon_2d_node() { if (computed_outline_lines.empty()) { err_dialog->set_text(TTR("Invalid geometry, can't create polygon.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -407,7 +407,7 @@ void SpriteEditor::_create_collision_polygon_2d_node() { if (computed_outline_lines.empty()) { err_dialog->set_text(TTR("Invalid geometry, can't create collision polygon.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } @@ -431,7 +431,7 @@ void SpriteEditor::_create_light_occluder_2d_node() { if (computed_outline_lines.empty()) { err_dialog->set_text(TTR("Invalid geometry, can't create light occluder.")); - err_dialog->popup_centered_minsize(); + err_dialog->popup_centered(); return; } diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index e6b0e3142c..12a0a3a83d 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -262,7 +262,7 @@ void SpriteFramesEditor::_file_load_request(const Vector<String> &p_path, int p_ //dialog->get_cancel()->set_text("Close"); dialog->get_ok()->set_text(TTR("Close")); - dialog->popup_centered_minsize(); + dialog->popup_centered(); return; ///beh should show an error i guess } @@ -301,7 +301,7 @@ void SpriteFramesEditor::_load_pressed() { for (int i = 0; i < extensions.size(); i++) file->add_filter("*." + extensions[i]); - file->set_mode(EditorFileDialog::MODE_OPEN_FILES); + file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILES); file->popup_centered_ratio(); } @@ -316,7 +316,7 @@ void SpriteFramesEditor::_paste_pressed() { dialog->set_title(TTR("Error!")); //dialog->get_cancel()->set_text("Close"); dialog->get_ok()->set_text(TTR("Close")); - dialog->popup_centered_minsize(); + dialog->popup_centered(); return; ///beh should show an error i guess } @@ -591,7 +591,7 @@ void SpriteFramesEditor::_animation_remove() { return; delete_dialog->set_text(TTR("Delete Animation?")); - delete_dialog->popup_centered_minsize(); + delete_dialog->popup_centered(); } void SpriteFramesEditor::_animation_remove_confirmed() { @@ -1058,7 +1058,7 @@ SpriteFramesEditor::SpriteFramesEditor() { file_split_sheet = memnew(EditorFileDialog); file_split_sheet->set_title(TTR("Create Frames from Sprite Sheet")); - file_split_sheet->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file_split_sheet->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); add_child(file_split_sheet); file_split_sheet->connect("file_selected", callable_mp(this, &SpriteFramesEditor::_prepare_sprite_sheet)); } diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 4d2bddb07a..da0697106c 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -619,7 +619,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { //--------------- texture_dialog = memnew(EditorFileDialog); texture_dialog->set_access(EditorFileDialog::ACCESS_RESOURCES); - texture_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILES); + texture_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILES); texture_dialog->clear_filters(); List<String> extensions; diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index da80eee253..fbd8d3dede 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -412,7 +412,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { set_up_dialog = memnew(AcceptDialog); set_up_dialog->set_title(TTR("Set Up Version Control")); - set_up_dialog->set_custom_minimum_size(Size2(400, 100)); + set_up_dialog->set_min_size(Size2(400, 100)); version_control_actions->add_child(set_up_dialog); set_up_ok_button = set_up_dialog->get_ok(); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index a0cab7fe56..d4db16641a 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -1648,7 +1648,7 @@ void VisualShaderEditor::_show_members_dialog(bool at_mouse_pos) { // keep dialog within window bounds Size2 window_size = DisplayServer::get_singleton()->window_get_size(); - Rect2 dialog_rect = members_dialog->get_global_rect(); + Rect2 dialog_rect = Rect2(members_dialog->get_position(), members_dialog->get_size()); if (dialog_rect.position.y + dialog_rect.size.y > window_size.y) { int difference = dialog_rect.position.y + dialog_rect.size.y - window_size.y; members_dialog->set_position(members_dialog->get_position() - Point2(0, difference)); @@ -2490,13 +2490,10 @@ VisualShaderEditor::VisualShaderEditor() { members_dialog->get_ok()->set_text(TTR("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("hide", callable_mp(this, &VisualShaderEditor::_member_cancel)); + members_dialog->connect("cancelled", callable_mp(this, &VisualShaderEditor::_member_cancel)); add_child(members_dialog); alert = memnew(AcceptDialog); - alert->set_as_minsize(); alert->get_label()->set_autowrap(true); alert->get_label()->set_align(Label::ALIGN_CENTER); alert->get_label()->set_valign(Label::VALIGN_CENTER); diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp index d12fd720a7..74438bb95d 100644 --- a/editor/progress_dialog.cpp +++ b/editor/progress_dialog.cpp @@ -163,7 +163,7 @@ void ProgressDialog::_popup() { main->set_margin(MARGIN_BOTTOM, -style->get_margin(MARGIN_BOTTOM)); raise(); - popup_centered(ms); + popup_centered_size(ms); } void ProgressDialog::add_task(const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) { diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 95e0bba579..30f4111524 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -48,24 +48,26 @@ #include "scene/gui/tab_container.h" #include "servers/display_server.h" +void ProjectExportDialog::_theme_changed() { + duplicate_preset->set_icon(presets->get_icon("Duplicate", "EditorIcons")); + delete_preset->set_icon(presets->get_icon("Remove", "EditorIcons")); + Control *panel = custom_feature_display->get_parent_control(); + if (panel) + panel->add_style_override("panel", patches->get_stylebox("bg", "Tree")); +} void ProjectExportDialog::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_VISIBILITY_CHANGED: { + if (!is_visible()) { + EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "export", Rect2(get_position(), get_size())); + } + } break; case NOTIFICATION_READY: { - duplicate_preset->set_icon(get_icon("Duplicate", "EditorIcons")); - delete_preset->set_icon(get_icon("Remove", "EditorIcons")); + duplicate_preset->set_icon(presets->get_icon("Duplicate", "EditorIcons")); + delete_preset->set_icon(presets->get_icon("Remove", "EditorIcons")); connect("confirmed", callable_mp(this, &ProjectExportDialog::_export_pck_zip)); - custom_feature_display->get_parent_control()->add_style_override("panel", get_stylebox("bg", "Tree")); - } break; - case NOTIFICATION_POPUP_HIDE: { - EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "export", get_rect()); - } break; - case NOTIFICATION_THEME_CHANGED: { - duplicate_preset->set_icon(get_icon("Duplicate", "EditorIcons")); - delete_preset->set_icon(get_icon("Remove", "EditorIcons")); - Control *panel = custom_feature_display->get_parent_control(); - if (panel) - panel->add_style_override("panel", get_stylebox("bg", "Tree")); + custom_feature_display->get_parent_control()->add_style_override("panel", patches->get_stylebox("bg", "Tree")); } break; } } @@ -248,8 +250,8 @@ void ProjectExportDialog::_edit_preset(int p_index) { patch->set_checked(0, true); patch->set_tooltip(0, patchlist[i]); patch->set_metadata(0, i); - patch->add_button(0, get_icon("Remove", "EditorIcons"), 0); - patch->add_button(0, get_icon("folder", "FileDialog"), 1); + patch->add_button(0, presets->get_icon("Remove", "EditorIcons"), 0); + patch->add_button(0, presets->get_icon("folder", "FileDialog"), 1); } TreeItem *patch_add = patches->create_item(patch_root); @@ -259,7 +261,7 @@ void ProjectExportDialog::_edit_preset(int p_index) { else patch_add->set_text(0, TTR("Add previous patches...")); - patch_add->add_button(0, get_icon("folder", "FileDialog"), 1); + patch_add->add_button(0, presets->get_icon("folder", "FileDialog"), 1); _fill_resource_tree(); @@ -300,7 +302,7 @@ void ProjectExportDialog::_edit_preset(int p_index) { custom_features->set_text(current->get_custom_features()); _update_feature_list(); _update_export_all(); - minimum_size_changed(); + child_controls_changed(); int script_export_mode = current->get_script_export_mode(); script_mode->select(script_export_mode); @@ -389,7 +391,7 @@ void ProjectExportDialog::_patch_button_pressed(Object *p_item, int p_column, in Vector<String> patches = current->get_patches(); ERR_FAIL_INDEX(patch_index, patches.size()); patch_erase->set_text(vformat(TTR("Delete patch '%s' from list?"), patches[patch_index].get_file())); - patch_erase->popup_centered_minsize(); + patch_erase->popup_centered(); } else { patch_dialog->popup_centered_ratio(); } @@ -619,7 +621,7 @@ void ProjectExportDialog::_delete_preset() { return; delete_confirm->set_text(vformat(TTR("Delete preset '%s'?"), current->get_name())); - delete_confirm->popup_centered_minsize(); + delete_confirm->popup_centered(); } void ProjectExportDialog::_delete_preset_confirm() { @@ -650,7 +652,7 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_ label->set_text(presets->get_item_text(pos)); drag->add_child(label); - set_drag_preview(drag); + presets->set_drag_preview(drag); return d; } @@ -667,7 +669,7 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_ Label *label = memnew(Label); label->set_text(item->get_text(0)); - set_drag_preview(label); + patches->set_drag_preview(label); return d; } @@ -817,7 +819,7 @@ void ProjectExportDialog::_fill_resource_tree() { bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> ¤t, bool p_only_scenes) { - p_item->set_icon(0, get_icon("folder", "FileDialog")); + p_item->set_icon(0, presets->get_icon("folder", "FileDialog")); p_item->set_text(0, p_dir->get_name() + "/"); bool used = false; @@ -955,7 +957,7 @@ void ProjectExportDialog::_export_project() { export_project->get_line_edit()->connect_compat("text_entered", export_project, "_file_entered"); } - export_project->set_mode(EditorFileDialog::MODE_SAVE_FILE); + export_project->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); export_project->popup_centered_ratio(); } @@ -980,14 +982,14 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) { ERR_PRINT(vformat("Failed to export the project for platform '%s'.", platform->get_name())); error_dialog->show(); - error_dialog->popup_centered_minsize(Size2(300, 80)); + error_dialog->popup_centered(Size2(300, 80)); } } void ProjectExportDialog::_export_all_dialog() { export_all_dialog->show(); - export_all_dialog->popup_centered_minsize(Size2(300, 80)); + export_all_dialog->popup_centered(Size2(300, 80)); } void ProjectExportDialog::_export_all_dialog_action(const String &p_str) { @@ -1018,7 +1020,7 @@ void ProjectExportDialog::_export_all(bool p_debug) { error_dialog->set_text(TTR("Export templates for this platform are missing/corrupted:") + " " + platform->get_name()); } error_dialog->show(); - error_dialog->popup_centered_minsize(Size2(300, 80)); + error_dialog->popup_centered(Size2(300, 80)); ERR_PRINT("Failed to export project"); } } @@ -1040,13 +1042,13 @@ void ProjectExportDialog::_bind_methods() { ProjectExportDialog::ProjectExportDialog() { set_title(TTR("Export")); - set_resizable(true); VBoxContainer *main_vb = memnew(VBoxContainer); + main_vb->connect("theme_changed", callable_mp(this, &ProjectExportDialog::_theme_changed)); add_child(main_vb); HSplitContainer *hbox = memnew(HSplitContainer); main_vb->add_child(hbox); - hbox->set_v_size_flags(SIZE_EXPAND_FILL); + hbox->set_v_size_flags(Control::SIZE_EXPAND_FILL); // Presets list. @@ -1065,9 +1067,12 @@ ProjectExportDialog::ProjectExportDialog() { preset_hb->add_child(add_preset); MarginContainer *mc = memnew(MarginContainer); preset_vb->add_child(mc); - mc->set_v_size_flags(SIZE_EXPAND_FILL); + mc->set_v_size_flags(Control::SIZE_EXPAND_FILL); presets = memnew(ItemList); - presets->set_drag_forwarding(this); +#ifndef _MSC_VER +#warning must reimplement drag forward +#endif + //presets->set_drag_forwarding(this); mc->add_child(presets); presets->connect("item_selected", callable_mp(this, &ProjectExportDialog::_edit_preset)); duplicate_preset = memnew(ToolButton); @@ -1105,14 +1110,14 @@ ProjectExportDialog::ProjectExportDialog() { sections->set_tab_align(TabContainer::ALIGN_LEFT); sections->set_use_hidden_tabs_for_min_size(true); settings_vb->add_child(sections); - sections->set_v_size_flags(SIZE_EXPAND_FILL); + sections->set_v_size_flags(Control::SIZE_EXPAND_FILL); // Main preset parameters. parameters = memnew(EditorInspector); sections->add_child(parameters); parameters->set_name(TTR("Options")); - parameters->set_v_size_flags(SIZE_EXPAND_FILL); + parameters->set_v_size_flags(Control::SIZE_EXPAND_FILL); parameters->connect("property_edited", callable_mp(this, &ProjectExportDialog::_update_parameters)); // Resources export parameters. @@ -1132,7 +1137,7 @@ ProjectExportDialog::ProjectExportDialog() { include_label->set_text(TTR("Resources to export:")); resources_vb->add_child(include_label); include_margin = memnew(MarginContainer); - include_margin->set_v_size_flags(SIZE_EXPAND_FILL); + include_margin->set_v_size_flags(Control::SIZE_EXPAND_FILL); resources_vb->add_child(include_margin); include_files = memnew(Tree); @@ -1164,11 +1169,14 @@ ProjectExportDialog::ProjectExportDialog() { patches = memnew(Tree); patch_vb->add_child(patches); - patches->set_v_size_flags(SIZE_EXPAND_FILL); + patches->set_v_size_flags(Control::SIZE_EXPAND_FILL); patches->set_hide_root(true); patches->connect("button_pressed", callable_mp(this, &ProjectExportDialog::_patch_button_pressed)); patches->connect("item_edited", callable_mp(this, &ProjectExportDialog::_patch_edited)); - patches->set_drag_forwarding(this); +#ifndef _MSC_VER +#warning must reimplement drag forward +#endif + //patches->set_drag_forwarding(this); patches->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true); HBoxContainer *patches_hb = memnew(HBoxContainer); @@ -1181,7 +1189,7 @@ ProjectExportDialog::ProjectExportDialog() { patch_dialog = memnew(EditorFileDialog); patch_dialog->add_filter("*.pck ; " + TTR("Pack File")); - patch_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE); + patch_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); patch_dialog->connect("file_selected", callable_mp(this, &ProjectExportDialog::_patch_selected)); add_child(patch_dialog); @@ -1201,7 +1209,7 @@ ProjectExportDialog::ProjectExportDialog() { custom_feature_display = memnew(RichTextLabel); features_panel->add_child(custom_feature_display); custom_feature_display->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 10 * EDSCALE); - custom_feature_display->set_v_size_flags(SIZE_EXPAND_FILL); + custom_feature_display->set_v_size_flags(Control::SIZE_EXPAND_FILL); feature_vb->add_margin_child(TTR("Feature List:"), features_panel, true); sections->add_child(feature_vb); @@ -1274,7 +1282,7 @@ ProjectExportDialog::ProjectExportDialog() { export_pck_zip->add_filter("*.zip ; " + TTR("ZIP File")); export_pck_zip->add_filter("*.pck ; " + TTR("Godot Game Pack")); export_pck_zip->set_access(EditorFileDialog::ACCESS_FILESYSTEM); - export_pck_zip->set_mode(EditorFileDialog::MODE_SAVE_FILE); + export_pck_zip->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); add_child(export_pck_zip); export_pck_zip->connect("file_selected", callable_mp(this, &ProjectExportDialog::_export_pck_zip_selected)); @@ -1300,7 +1308,7 @@ ProjectExportDialog::ProjectExportDialog() { LinkButton *download_templates = memnew(LinkButton); download_templates->set_text(TTR("Manage Export Templates")); - download_templates->set_v_size_flags(SIZE_SHRINK_CENTER); + download_templates->set_v_size_flags(Control::SIZE_SHRINK_CENTER); export_templates_error->add_child(download_templates); download_templates->connect("pressed", callable_mp(this, &ProjectExportDialog::_open_export_template_manager)); diff --git a/editor/project_export.h b/editor/project_export.h index 00e6dfd6e3..2e311eb3b3 100644 --- a/editor/project_export.h +++ b/editor/project_export.h @@ -167,6 +167,7 @@ private: void _tab_changed(int); protected: + void _theme_changed(); void _notification(int p_what); static void _bind_methods(); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 317201889b..aed7c91d96 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -117,22 +117,22 @@ private: case MESSAGE_ERROR: { - msg->add_color_override("font_color", get_color("error_color", "Editor")); + msg->add_color_override("font_color", msg->get_color("error_color", "Editor")); msg->set_modulate(Color(1, 1, 1, 1)); - new_icon = get_icon("StatusError", "EditorIcons"); + new_icon = msg->get_icon("StatusError", "EditorIcons"); } break; case MESSAGE_WARNING: { - msg->add_color_override("font_color", get_color("warning_color", "Editor")); + msg->add_color_override("font_color", msg->get_color("warning_color", "Editor")); msg->set_modulate(Color(1, 1, 1, 1)); - new_icon = get_icon("StatusWarning", "EditorIcons"); + new_icon = msg->get_icon("StatusWarning", "EditorIcons"); } break; case MESSAGE_SUCCESS: { msg->set_modulate(Color(1, 1, 1, 0)); - new_icon = get_icon("StatusSuccess", "EditorIcons"); + new_icon = msg->get_icon("StatusSuccess", "EditorIcons"); } break; } @@ -379,19 +379,19 @@ private: if (mode == MODE_IMPORT) { - fdialog->set_mode(FileDialog::MODE_OPEN_FILE); + fdialog->set_file_mode(FileDialog::FILE_MODE_OPEN_FILE); fdialog->clear_filters(); fdialog->add_filter(vformat("project.godot ; %s %s", VERSION_NAME, TTR("Project"))); fdialog->add_filter("*.zip ; " + TTR("ZIP File")); } else { - fdialog->set_mode(FileDialog::MODE_OPEN_DIR); + fdialog->set_file_mode(FileDialog::FILE_MODE_OPEN_DIR); } fdialog->popup_centered_ratio(); } void _browse_install_path() { fdialog_install->set_current_dir(install_path->get_text()); - fdialog_install->set_mode(FileDialog::MODE_OPEN_DIR); + fdialog_install->set_file_mode(FileDialog::FILE_MODE_OPEN_DIR); fdialog_install->popup_centered_ratio(); } @@ -418,12 +418,12 @@ private: } else { dialog_error->set_text(TTR("Couldn't create folder.")); - dialog_error->popup_centered_minsize(); + dialog_error->popup_centered(); } } else { dialog_error->set_text(TTR("There is already a folder in this path with the specified name.")); - dialog_error->popup_centered_minsize(); + dialog_error->popup_centered(); } } @@ -500,7 +500,7 @@ private: if (ProjectSettings::get_singleton()->save_custom(dir.plus_file("project.godot"), initial_settings, Vector<String>(), false) != OK) { set_message(TTR("Couldn't create project.godot in project path."), MESSAGE_ERROR); } else { - ResourceSaver::save(dir.plus_file("icon.png"), get_icon("DefaultProjectIcon", "EditorIcons")); + ResourceSaver::save(dir.plus_file("icon.png"), msg->get_icon("DefaultProjectIcon", "EditorIcons")); FileAccess *f = FileAccess::open(dir.plus_file("default_env.tres"), FileAccess::WRITE); if (!f) { @@ -529,7 +529,7 @@ private: if (!pkg) { dialog_error->set_text(TTR("Error opening package file, not in ZIP format.")); - dialog_error->popup_centered_minsize(); + dialog_error->popup_centered(); return; } @@ -607,11 +607,11 @@ private: } dialog_error->set_text(msg); - dialog_error->popup_centered_minsize(); + dialog_error->popup_centered(); } else if (!project_path->get_text().ends_with(".zip")) { dialog_error->set_text(TTR("Package installed successfully!")); - dialog_error->popup_centered_minsize(); + dialog_error->popup_centered(); } } } @@ -649,10 +649,10 @@ private: project_name->clear(); _text_changed(""); - if (status_rect->get_texture() == get_icon("StatusError", "EditorIcons")) + if (status_rect->get_texture() == msg->get_icon("StatusError", "EditorIcons")) msg->show(); - if (install_status_rect->get_texture() == get_icon("StatusError", "EditorIcons")) + if (install_status_rect->get_texture() == msg->get_icon("StatusError", "EditorIcons")) msg->show(); } @@ -788,7 +788,7 @@ public: _test_path(); } - popup_centered_minsize(Size2(500, 0) * EDSCALE); + popup_centered(Size2(500, 0) * EDSCALE); } ProjectDialog() { @@ -807,7 +807,7 @@ public: name_container->add_child(pnhb); project_name = memnew(LineEdit); - project_name->set_h_size_flags(SIZE_EXPAND_FILL); + project_name->set_h_size_flags(Control::SIZE_EXPAND_FILL); pnhb->add_child(project_name); create_dir = memnew(Button); @@ -826,7 +826,7 @@ public: path_container->add_child(pphb); project_path = memnew(LineEdit); - project_path->set_h_size_flags(SIZE_EXPAND_FILL); + project_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); pphb->add_child(project_path); install_path_container = memnew(VBoxContainer); @@ -840,7 +840,7 @@ public: install_path_container->add_child(iphb); install_path = memnew(LineEdit); - install_path->set_h_size_flags(SIZE_EXPAND_FILL); + install_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); iphb->add_child(install_path); // status icon @@ -878,7 +878,7 @@ public: rasterizer_button_group.instance(); Container *rvb = memnew(VBoxContainer); - rvb->set_h_size_flags(SIZE_EXPAND_FILL); + rvb->set_h_size_flags(Control::SIZE_EXPAND_FILL); rshb->add_child(rvb); Button *rs_button = memnew(CheckBox); rs_button->set_button_group(rasterizer_button_group); @@ -897,7 +897,7 @@ public: TTR("The GLES2 renderer is currently unavailable, as it needs to be reworked for Godot 4.0.\nUse Godot 3.2 if you need GLES2 support."); rvb = memnew(VBoxContainer); - rvb->set_h_size_flags(SIZE_EXPAND_FILL); + rvb->set_h_size_flags(Control::SIZE_EXPAND_FILL); rshb->add_child(rvb); rs_button = memnew(CheckBox); rs_button->set_button_group(rasterizer_button_group); @@ -912,7 +912,7 @@ public: // Also set the tooltip on the label so it appears when hovering either the checkbox or label. l->set_tooltip(gles2_unsupported_tooltip); // Required for the tooltip to show. - l->set_mouse_filter(MOUSE_FILTER_STOP); + l->set_mouse_filter(Control::MOUSE_FILTER_STOP); rvb->add_child(l); l = memnew(Label); @@ -1118,7 +1118,7 @@ ProjectList::ProjectList() { _order_option = ProjectListFilter::FILTER_EDIT_DATE; _scroll_children = memnew(VBoxContainer); - _scroll_children->set_h_size_flags(SIZE_EXPAND_FILL); + _scroll_children->set_h_size_flags(Control::SIZE_EXPAND_FILL); add_child(_scroll_children); _icon_load_index = 0; @@ -1359,7 +1359,7 @@ void ProjectList::create_project_item_control(int p_index) { VBoxContainer *vb = memnew(VBoxContainer); if (item.grayed) vb->set_modulate(Color(1, 1, 1, 0.5)); - vb->set_h_size_flags(SIZE_EXPAND_FILL); + vb->set_h_size_flags(Control::SIZE_EXPAND_FILL); hb->add_child(vb); Control *ec = memnew(Control); ec->set_custom_minimum_size(Size2(0, 1)); @@ -1372,7 +1372,7 @@ void ProjectList::create_project_item_control(int p_index) { vb->add_child(title); HBoxContainer *path_hb = memnew(HBoxContainer); - path_hb->set_h_size_flags(SIZE_EXPAND_FILL); + path_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); vb->add_child(path_hb); Button *show = memnew(Button); @@ -1394,7 +1394,7 @@ void ProjectList::create_project_item_control(int p_index) { Label *fpath = memnew(Label(item.path)); path_hb->add_child(fpath); - fpath->set_h_size_flags(SIZE_EXPAND_FILL); + fpath->set_h_size_flags(Control::SIZE_EXPAND_FILL); fpath->set_modulate(Color(1, 1, 1, 0.5)); fpath->add_color_override("font_color", font_color); fpath->set_clip_text(true); @@ -1833,13 +1833,13 @@ void ProjectManager::_notification(int p_what) { case NOTIFICATION_RESIZED: { if (open_templates->is_visible()) { - open_templates->popup_centered_minsize(); + open_templates->popup_centered(); } } break; case NOTIFICATION_READY: { if (_project_list->get_project_count() == 0 && StreamPeerSSL::is_available()) - open_templates->popup_centered_minsize(); + open_templates->popup_centered(); if (_project_list->get_project_count() >= 1) { // Focus on the search box immediately to allow the user @@ -2059,7 +2059,7 @@ void ProjectManager::_open_selected_projects() { if (!FileAccess::exists(conf)) { dialog_error->set_text(vformat(TTR("Can't open project at '%s'."), path)); - dialog_error->popup_centered_minsize(); + dialog_error->popup_centered(); return; } @@ -2097,7 +2097,7 @@ void ProjectManager::_open_selected_projects_ask() { if (selected_list.size() > 1) { multi_open_ask->set_text(TTR("Are you sure to open more than one project?")); - multi_open_ask->popup_centered_minsize(); + multi_open_ask->popup_centered(); return; } @@ -2113,19 +2113,19 @@ void ProjectManager::_open_selected_projects_ask() { // Check if the config_version property was empty or 0 if (config_version == 0) { ask_update_settings->set_text(vformat(TTR("The following project settings file does not specify the version of Godot through which it was created.\n\n%s\n\nIf you proceed with opening it, it will be converted to Godot's current configuration file format.\nWarning: You won't be able to open the project with previous versions of the engine anymore."), conf)); - ask_update_settings->popup_centered_minsize(); + ask_update_settings->popup_centered(); return; } // Check if we need to convert project settings from an earlier engine version if (config_version < ProjectSettings::CONFIG_VERSION) { ask_update_settings->set_text(vformat(TTR("The following project settings file was generated by an older engine version, and needs to be converted for this version:\n\n%s\n\nDo you want to convert it?\nWarning: You won't be able to open the project with previous versions of the engine anymore."), conf)); - ask_update_settings->popup_centered_minsize(); + ask_update_settings->popup_centered(); return; } // Check if the file was generated by a newer, incompatible engine version if (config_version > ProjectSettings::CONFIG_VERSION) { dialog_error->set_text(vformat(TTR("Can't open project at '%s'.") + "\n" + TTR("The project settings were created by a newer engine version, whose settings are not compatible with this version."), project.path)); - dialog_error->popup_centered_minsize(); + dialog_error->popup_centered(); return; } @@ -2185,7 +2185,7 @@ void ProjectManager::_run_project() { if (selected_list.size() > 1) { multi_run_ask->set_text(vformat(TTR("Are you sure to run %d projects at once?"), selected_list.size())); - multi_run_ask->popup_centered_minsize(); + multi_run_ask->popup_centered(); } else { _run_project_confirm(); } @@ -2282,13 +2282,13 @@ void ProjectManager::_erase_project() { } erase_ask->set_text(confirm_message); - erase_ask->popup_centered_minsize(); + erase_ask->popup_centered(); } void ProjectManager::_erase_missing_projects() { erase_missing_ask->set_text(TTR("Remove all missing projects from the list?\nThe project folders' contents won't be modified.")); - erase_missing_ask->popup_centered_minsize(); + erase_missing_ask->popup_centered(); } void ProjectManager::_language_selected(int p_id) { @@ -2363,7 +2363,7 @@ void ProjectManager::_files_dropped(PackedStringArray p_files, int p_screen) { multi_scan_ask->get_ok()->connect("pressed", callable_mp(this, &ProjectManager::_scan_multiple_folders), varray(folders)); multi_scan_ask->set_text( vformat(TTR("Are you sure to scan %s folders for existing Godot projects?\nThis could take a while."), folders.size())); - multi_scan_ask->popup_centered_minsize(); + multi_scan_ask->popup_centered(); } else { _scan_multiple_folders(folders); } @@ -2468,7 +2468,7 @@ ProjectManager::ProjectManager() { DisplayServer::get_singleton()->window_set_title(VERSION_NAME + String(" - ") + TTR("Project Manager") + " - " + cp + " 2007-2020 Juan Linietsky, Ariel Manzur & Godot Contributors"); Control *center_box = memnew(Control); - center_box->set_v_size_flags(SIZE_EXPAND_FILL); + center_box->set_v_size_flags(Control::SIZE_EXPAND_FILL); vb->add_child(center_box); tabs = memnew(TabContainer); @@ -2485,7 +2485,7 @@ ProjectManager::ProjectManager() { VBoxContainer *search_tree_vb = memnew(VBoxContainer); tree_hb->add_child(search_tree_vb); - search_tree_vb->set_h_size_flags(SIZE_EXPAND_FILL); + search_tree_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL); HBoxContainer *sort_filters = memnew(HBoxContainer); Label *sort_label = memnew(Label); @@ -2519,7 +2519,7 @@ ProjectManager::ProjectManager() { PanelContainer *pc = memnew(PanelContainer); pc->add_style_override("panel", gui_base->get_stylebox("bg", "Tree")); search_tree_vb->add_child(pc); - pc->set_v_size_flags(SIZE_EXPAND_FILL); + pc->set_v_size_flags(Control::SIZE_EXPAND_FILL); _project_list = memnew(ProjectList); _project_list->connect(ProjectList::SIGNAL_SELECTION_CHANGED, callable_mp(this, &ProjectManager::_update_project_buttons)); @@ -2553,7 +2553,7 @@ ProjectManager::ProjectManager() { scan_dir = memnew(FileDialog); scan_dir->set_access(FileDialog::ACCESS_FILESYSTEM); - scan_dir->set_mode(FileDialog::MODE_OPEN_DIR); + scan_dir->set_file_mode(FileDialog::FILE_MODE_OPEN_DIR); scan_dir->set_title(TTR("Select a Folder to Scan")); // must be after mode or it's overridden scan_dir->set_current_dir(EditorSettings::get_singleton()->get("filesystem/directories/default_project_path")); gui_base->add_child(scan_dir); @@ -2775,7 +2775,7 @@ void ProjectListFilter::add_search_box() { search_box = memnew(LineEdit); search_box->set_placeholder(TTR("Search")); search_box->connect("text_changed", callable_mp(this, &ProjectListFilter::_search_text_changed)); - search_box->set_h_size_flags(SIZE_EXPAND_FILL); + search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); add_child(search_box); has_search_box = true; diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 47dbbed780..af8ad48aae 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -80,7 +80,7 @@ void ProjectSettingsEditor::_unhandled_input(const Ref<InputEvent> &p_event) { const Ref<InputEventKey> k = p_event; - if (k.is_valid() && is_window_modal_on_top() && k->is_pressed()) { + if (k.is_valid() && k->is_pressed()) { if (k->get_keycode_with_modifiers() == (KEY_MASK_CMD | KEY_F)) { if (search_button->is_pressed()) { @@ -91,7 +91,7 @@ void ProjectSettingsEditor::_unhandled_input(const Ref<InputEvent> &p_event) { search_button->set_pressed(true); } - accept_event(); + set_input_as_handled(); } } } @@ -99,22 +99,28 @@ void ProjectSettingsEditor::_unhandled_input(const Ref<InputEvent> &p_event) { void ProjectSettingsEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_VISIBILITY_CHANGED: { + if (!is_visible()) { + EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "project_settings", Rect2(get_position(), get_size())); + set_process_unhandled_input(false); + } + } break; case NOTIFICATION_ENTER_TREE: { globals_editor->edit(ProjectSettings::get_singleton()); - search_button->set_icon(get_icon("Search", "EditorIcons")); - search_box->set_right_icon(get_icon("Search", "EditorIcons")); + search_button->set_icon(input_editor->get_icon("Search", "EditorIcons")); + search_box->set_right_icon(input_editor->get_icon("Search", "EditorIcons")); search_box->set_clear_button_enabled(true); - action_add_error->add_color_override("font_color", get_color("error_color", "Editor")); + action_add_error->add_color_override("font_color", input_editor->get_color("error_color", "Editor")); translation_list->connect("button_pressed", callable_mp(this, &ProjectSettingsEditor::_translation_delete)); _update_actions(); - popup_add->add_icon_item(get_icon("Keyboard", "EditorIcons"), TTR("Key"), INPUT_KEY); //"Key " - because the word 'key' has already been used as a key animation - popup_add->add_icon_item(get_icon("KeyboardPhysical", "EditorIcons"), TTR("Physical Key"), INPUT_KEY_PHYSICAL); - popup_add->add_icon_item(get_icon("JoyButton", "EditorIcons"), TTR("Joy Button"), INPUT_JOY_BUTTON); - popup_add->add_icon_item(get_icon("JoyAxis", "EditorIcons"), TTR("Joy Axis"), INPUT_JOY_MOTION); - popup_add->add_icon_item(get_icon("Mouse", "EditorIcons"), TTR("Mouse Button"), INPUT_MOUSE_BUTTON); + popup_add->add_icon_item(input_editor->get_icon("Keyboard", "EditorIcons"), TTR("Key"), INPUT_KEY); + popup_add->add_icon_item(input_editor->get_icon("KeyboardPhysical", "EditorIcons"), TTR("Physical Key"), INPUT_KEY_PHYSICAL); + popup_add->add_icon_item(input_editor->get_icon("JoyButton", "EditorIcons"), TTR("Joy Button"), INPUT_JOY_BUTTON); + popup_add->add_icon_item(input_editor->get_icon("JoyAxis", "EditorIcons"), TTR("Joy Axis"), INPUT_JOY_MOTION); + popup_add->add_icon_item(input_editor->get_icon("Mouse", "EditorIcons"), TTR("Mouse Button"), INPUT_MOUSE_BUTTON); List<String> tfn; ResourceLoader::get_recognized_extensions_for_type("Translation", &tfn); @@ -131,26 +137,22 @@ void ProjectSettingsEditor::_notification(int p_what) { translation_res_option_file_open->add_filter("*." + E->get()); } - restart_close_button->set_icon(get_icon("Close", "EditorIcons")); - restart_container->add_style_override("panel", get_stylebox("bg", "Tree")); - restart_icon->set_texture(get_icon("StatusWarning", "EditorIcons")); - restart_label->add_color_override("font_color", get_color("warning_color", "Editor")); + restart_close_button->set_icon(input_editor->get_icon("Close", "EditorIcons")); + restart_container->add_style_override("panel", input_editor->get_stylebox("bg", "Tree")); + restart_icon->set_texture(input_editor->get_icon("StatusWarning", "EditorIcons")); + restart_label->add_color_override("font_color", input_editor->get_color("warning_color", "Editor")); } break; - case NOTIFICATION_POPUP_HIDE: { - EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "project_settings", get_rect()); - set_process_unhandled_input(false); - } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - search_button->set_icon(get_icon("Search", "EditorIcons")); - search_box->set_right_icon(get_icon("Search", "EditorIcons")); + search_button->set_icon(input_editor->get_icon("Search", "EditorIcons")); + search_box->set_right_icon(input_editor->get_icon("Search", "EditorIcons")); search_box->set_clear_button_enabled(true); - action_add_error->add_color_override("font_color", get_color("error_color", "Editor")); - popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY), get_icon("Keyboard", "EditorIcons")); - popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY_PHYSICAL), get_icon("KeyboardPhysical", "EditorIcons")); - popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_BUTTON), get_icon("JoyButton", "EditorIcons")); - popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_MOTION), get_icon("JoyAxis", "EditorIcons")); - popup_add->set_item_icon(popup_add->get_item_index(INPUT_MOUSE_BUTTON), get_icon("Mouse", "EditorIcons")); + action_add_error->add_color_override("font_color", input_editor->get_color("error_color", "Editor")); + popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY), input_editor->get_icon("Keyboard", "EditorIcons")); + popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY_PHYSICAL), input_editor->get_icon("KeyboardPhysical", "EditorIcons")); + popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_BUTTON), input_editor->get_icon("JoyButton", "EditorIcons")); + popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_MOTION), input_editor->get_icon("JoyAxis", "EditorIcons")); + popup_add->set_item_icon(popup_add->get_item_index(INPUT_MOUSE_BUTTON), input_editor->get_icon("Mouse", "EditorIcons")); _update_actions(); } break; } @@ -462,7 +464,7 @@ void ProjectSettingsEditor::_wait_for_key(const Ref<InputEvent> &p_event) { press_a_key_label->set_text(str); press_a_key->get_ok()->set_disabled(false); - press_a_key->accept_event(); + press_a_key->set_input_as_handled(); } } @@ -479,7 +481,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even press_a_key->get_ok()->set_disabled(true); last_wait_for_key = Ref<InputEvent>(); press_a_key->popup_centered(Size2(250, 80) * EDSCALE); - press_a_key->grab_focus(); + //press_a_key->grab_focus(); } break; case INPUT_KEY_PHYSICAL: { @@ -505,7 +507,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even device_index->add_item(TTR("Wheel Right Button")); device_index->add_item(TTR("X Button 1")); device_index->add_item(TTR("X Button 2")); - device_input->popup_centered_minsize(Size2(350, 95) * EDSCALE); + device_input->popup_centered(Size2(350, 95) * EDSCALE); Ref<InputEventMouseButton> mb = p_exiting_event; if (mb.is_valid()) { @@ -527,7 +529,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even String desc = _axis_names[i]; device_index->add_item(TTR("Axis") + " " + itos(i / 2) + " " + ((i & 1) ? "+" : "-") + desc); } - device_input->popup_centered_minsize(Size2(350, 95) * EDSCALE); + device_input->popup_centered(Size2(350, 95) * EDSCALE); Ref<InputEventJoypadMotion> jm = p_exiting_event; if (jm.is_valid()) { @@ -549,7 +551,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even device_index->add_item(itos(i) + ": " + String(_button_names[i])); } - device_input->popup_centered_minsize(Size2(350, 95) * EDSCALE); + device_input->popup_centered(Size2(350, 95) * EDSCALE); Ref<InputEventJoypadButton> jb = p_exiting_event; if (jb.is_valid()) { @@ -738,7 +740,7 @@ void ProjectSettingsEditor::_update_actions() { TreeItem *item = input_editor->create_item(root); item->set_text(0, name); - item->set_custom_bg_color(0, get_color("prop_subsection", "Editor")); + item->set_custom_bg_color(0, input_editor->get_color("prop_subsection", "Editor")); if (collapsed.has(name)) item->set_collapsed(collapsed[name]); @@ -746,12 +748,12 @@ void ProjectSettingsEditor::_update_actions() { item->set_cell_mode(1, TreeItem::CELL_MODE_RANGE); item->set_range_config(1, 0.0, 1.0, 0.01); item->set_range(1, action["deadzone"]); - item->set_custom_bg_color(1, get_color("prop_subsection", "Editor")); + item->set_custom_bg_color(1, input_editor->get_color("prop_subsection", "Editor")); const bool is_builtin_input = ProjectSettings::get_singleton()->get_input_presets().find(pi.name) != NULL; const String tooltip = is_builtin_input ? TTR("Built-in actions can't be removed as they're used for UI navigation.") : TTR("Remove"); - item->add_button(2, get_icon("Add", "EditorIcons"), 1, false, TTR("Add Event")); - item->add_button(2, get_icon("Remove", "EditorIcons"), 2, false, tooltip); + item->add_button(2, input_editor->get_icon("Add", "EditorIcons"), 1, false, TTR("Add Event")); + item->add_button(2, input_editor->get_icon("Remove", "EditorIcons"), 2, false, tooltip); if (is_builtin_input) { // Built-in action (like `ui_up`). Make the action not removable, @@ -778,9 +780,9 @@ void ProjectSettingsEditor::_update_actions() { action2->set_text(0, str); if ((k->get_keycode() != 0)) { - action2->set_icon(0, get_icon("Keyboard", "EditorIcons")); + action2->set_icon(0, input_editor->get_icon("Keyboard", "EditorIcons")); } else { - action2->set_icon(0, get_icon("KeyboardPhysical", "EditorIcons")); + action2->set_icon(0, input_editor->get_icon("KeyboardPhysical", "EditorIcons")); } } @@ -794,7 +796,7 @@ void ProjectSettingsEditor::_update_actions() { } action2->set_text(0, str); - action2->set_icon(0, get_icon("JoyButton", "EditorIcons")); + action2->set_icon(0, input_editor->get_icon("JoyButton", "EditorIcons")); } Ref<InputEventMouseButton> mb = event; @@ -811,7 +813,7 @@ void ProjectSettingsEditor::_update_actions() { } action2->set_text(0, str); - action2->set_icon(0, get_icon("Mouse", "EditorIcons")); + action2->set_icon(0, input_editor->get_icon("Mouse", "EditorIcons")); } Ref<InputEventJoypadMotion> jm = event; @@ -823,13 +825,13 @@ void ProjectSettingsEditor::_update_actions() { String desc = _axis_names[n]; String str = _get_device_string(jm->get_device()) + ", " + TTR("Axis") + " " + itos(ax) + " " + (jm->get_axis_value() < 0 ? "-" : "+") + desc; action2->set_text(0, str); - action2->set_icon(0, get_icon("JoyAxis", "EditorIcons")); + action2->set_icon(0, input_editor->get_icon("JoyAxis", "EditorIcons")); } action2->set_metadata(0, i); action2->set_meta("__input", event); - action2->add_button(2, get_icon("Edit", "EditorIcons"), 3, false, TTR("Edit")); - action2->add_button(2, get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove")); + action2->add_button(2, input_editor->get_icon("Edit", "EditorIcons"), 3, false, TTR("Edit")); + action2->add_button(2, input_editor->get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove")); // Fade out the individual event buttons slightly to make the // Add/Remove buttons stand out more. action2->set_button_color(2, 0, Color(1, 1, 1, 0.75)); @@ -1112,7 +1114,7 @@ Variant ProjectSettingsEditor::get_drag_data_fw(const Point2 &p_point, Control * hb->set_modulate(Color(1, 1, 1, 1.0f)); hb->add_child(label); vb->add_child(hb); - set_drag_preview(vb); + input_editor->set_drag_preview(vb); Dictionary drag_data; drag_data["type"] = "nodes"; @@ -1547,7 +1549,7 @@ void ProjectSettingsEditor::_update_translations() { t->set_text(0, translations[i].replace_first("res://", "")); t->set_tooltip(0, translations[i]); t->set_metadata(0, i); - t->add_button(0, get_icon("Remove", "EditorIcons"), 0, false, TTR("Remove")); + t->add_button(0, input_editor->get_icon("Remove", "EditorIcons"), 0, false, TTR("Remove")); } } @@ -1670,7 +1672,7 @@ void ProjectSettingsEditor::_update_translations() { t->set_text(0, keys[i].replace_first("res://", "")); t->set_tooltip(0, keys[i]); t->set_metadata(0, keys[i]); - t->add_button(0, get_icon("Remove", "EditorIcons"), 0, false, TTR("Remove")); + t->add_button(0, input_editor->get_icon("Remove", "EditorIcons"), 0, false, TTR("Remove")); if (keys[i] == remap_selected) { t->select(0); translation_res_option_add_button->set_disabled(false); @@ -1688,7 +1690,7 @@ void ProjectSettingsEditor::_update_translations() { t2->set_text(0, path.replace_first("res://", "")); t2->set_tooltip(0, path); t2->set_metadata(0, j); - t2->add_button(0, get_icon("Remove", "EditorIcons"), 0, false, TTR("Remove")); + t2->add_button(0, input_editor->get_icon("Remove", "EditorIcons"), 0, false, TTR("Remove")); t2->set_cell_mode(1, TreeItem::CELL_MODE_RANGE); t2->set_text(1, langnames); t2->set_editable(1, true); @@ -1774,7 +1776,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { singleton = this; set_title(TTR("Project Settings (project.godot)")); - set_resizable(true); + undo_redo = &p_data->get_undo_redo(); data = p_data; @@ -1883,7 +1885,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { HBoxContainer *restart_hb = memnew(HBoxContainer); restart_container->add_child(restart_hb); restart_icon = memnew(TextureRect); - restart_icon->set_v_size_flags(SIZE_SHRINK_CENTER); + restart_icon->set_v_size_flags(Control::SIZE_SHRINK_CENTER); restart_hb->add_child(restart_icon); restart_label = memnew(Label); restart_label->set_text(TTR("The editor must be restarted for changes to take effect.")); @@ -1907,10 +1909,10 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { VBoxContainer *vbc = memnew(VBoxContainer); input_base->add_child(vbc); - vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0); - vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0); - vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0); - vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0); + vbc->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 0); + vbc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, 0); + vbc->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 0); + vbc->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, 0); hbc = memnew(HBoxContainer); vbc->add_child(hbc); @@ -1920,7 +1922,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { l->set_text(TTR("Action:")); action_name = memnew(LineEdit); - action_name->set_h_size_flags(SIZE_EXPAND_FILL); + action_name->set_h_size_flags(Control::SIZE_EXPAND_FILL); hbc->add_child(action_name); action_name->connect("text_entered", callable_mp(this, &ProjectSettingsEditor::_action_adds)); action_name->connect("text_changed", callable_mp(this, &ProjectSettingsEditor::_action_check)); @@ -1938,7 +1940,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { input_editor = memnew(Tree); vbc->add_child(input_editor); - input_editor->set_v_size_flags(SIZE_EXPAND_FILL); + input_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); input_editor->set_columns(3); input_editor->set_column_titles_visible(true); input_editor->set_column_title(0, TTR("Action")); @@ -1951,7 +1953,10 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { input_editor->connect("item_activated", callable_mp(this, &ProjectSettingsEditor::_action_activated)); input_editor->connect("cell_selected", callable_mp(this, &ProjectSettingsEditor::_action_selected)); input_editor->connect("button_pressed", callable_mp(this, &ProjectSettingsEditor::_action_button_pressed)); - input_editor->set_drag_forwarding(this); +#ifndef _MSC_VER +#warning need to make drag data forwarding to non controls happen +#endif + //input_editor->set_drag_forwarding(this); popup_add = memnew(PopupMenu); add_child(popup_add); @@ -1960,7 +1965,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { press_a_key_physical = false; press_a_key = memnew(ConfirmationDialog); - press_a_key->set_focus_mode(FOCUS_ALL); + //press_a_key->set_focus_mode(Control::FOCUS_ALL); add_child(press_a_key); l = memnew(Label); @@ -1968,11 +1973,11 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { l->set_anchors_and_margins_preset(Control::PRESET_WIDE); l->set_align(Label::ALIGN_CENTER); l->set_margin(MARGIN_TOP, 20); - l->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_BEGIN, 30); + l->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_BEGIN, 30); press_a_key->get_ok()->set_disabled(true); press_a_key_label = l; press_a_key->add_child(l); - press_a_key->connect("gui_input", callable_mp(this, &ProjectSettingsEditor::_wait_for_key)); + press_a_key->connect("window_input", callable_mp(this, &ProjectSettingsEditor::_wait_for_key)); press_a_key->connect("confirmed", callable_mp(this, &ProjectSettingsEditor::_press_a_key_confirm)); device_input = memnew(ConfirmationDialog); @@ -1998,7 +2003,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { VBoxContainer *vbc_right = memnew(VBoxContainer); hbc->add_child(vbc_right); - vbc_right->set_h_size_flags(SIZE_EXPAND_FILL); + vbc_right->set_h_size_flags(Control::SIZE_EXPAND_FILL); l = memnew(Label); l->set_text(TTR("Index:")); @@ -2035,14 +2040,14 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { thb->add_child(addtr); VBoxContainer *tmc = memnew(VBoxContainer); tvb->add_child(tmc); - tmc->set_v_size_flags(SIZE_EXPAND_FILL); + tmc->set_v_size_flags(Control::SIZE_EXPAND_FILL); translation_list = memnew(Tree); - translation_list->set_v_size_flags(SIZE_EXPAND_FILL); + translation_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); tmc->add_child(translation_list); translation_file_open = memnew(EditorFileDialog); add_child(translation_file_open); - translation_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE); + translation_file_open->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); translation_file_open->connect("file_selected", callable_mp(this, &ProjectSettingsEditor::_translation_add)); } @@ -2059,16 +2064,16 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { thb->add_child(addtr); VBoxContainer *tmc = memnew(VBoxContainer); tvb->add_child(tmc); - tmc->set_v_size_flags(SIZE_EXPAND_FILL); + tmc->set_v_size_flags(Control::SIZE_EXPAND_FILL); translation_remap = memnew(Tree); - translation_remap->set_v_size_flags(SIZE_EXPAND_FILL); + translation_remap->set_v_size_flags(Control::SIZE_EXPAND_FILL); translation_remap->connect("cell_selected", callable_mp(this, &ProjectSettingsEditor::_translation_res_select)); tmc->add_child(translation_remap); translation_remap->connect("button_pressed", callable_mp(this, &ProjectSettingsEditor::_translation_res_delete)); translation_res_file_open = memnew(EditorFileDialog); add_child(translation_res_file_open); - translation_res_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE); + translation_res_file_open->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); translation_res_file_open->connect("file_selected", callable_mp(this, &ProjectSettingsEditor::_translation_res_add)); thb = memnew(HBoxContainer); @@ -2081,9 +2086,9 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { thb->add_child(addtr); tmc = memnew(VBoxContainer); tvb->add_child(tmc); - tmc->set_v_size_flags(SIZE_EXPAND_FILL); + tmc->set_v_size_flags(Control::SIZE_EXPAND_FILL); translation_remap_options = memnew(Tree); - translation_remap_options->set_v_size_flags(SIZE_EXPAND_FILL); + translation_remap_options->set_v_size_flags(Control::SIZE_EXPAND_FILL); tmc->add_child(translation_remap_options); translation_remap_options->set_columns(2); @@ -2098,7 +2103,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { translation_res_option_file_open = memnew(EditorFileDialog); add_child(translation_res_option_file_open); - translation_res_option_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE); + translation_res_option_file_open->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); translation_res_option_file_open->connect("file_selected", callable_mp(this, &ProjectSettingsEditor::_translation_res_option_add)); } @@ -2107,7 +2112,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { translations->add_child(tvb); tvb->set_name(TTR("Locales Filter")); VBoxContainer *tmc = memnew(VBoxContainer); - tmc->set_v_size_flags(SIZE_EXPAND_FILL); + tmc->set_v_size_flags(Control::SIZE_EXPAND_FILL); tvb->add_child(tmc); translation_locale_filter_mode = memnew(OptionButton); @@ -2118,7 +2123,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { translation_locale_filter_mode->connect("item_selected", callable_mp(this, &ProjectSettingsEditor::_translation_filter_mode_changed)); translation_filter = memnew(Tree); - translation_filter->set_v_size_flags(SIZE_EXPAND_FILL); + translation_filter->set_v_size_flags(Control::SIZE_EXPAND_FILL); translation_filter->set_columns(1); tmc->add_child(memnew(Label(TTR("Locales:")))); tmc->add_child(translation_filter); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 1a0586b178..3be067c33a 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -151,7 +151,7 @@ void CustomPropertyEditor::_menu_option(int p_which) { switch (p_which) { case OBJ_MENU_LOAD: { - file->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); String type = (hint == PROPERTY_HINT_RESOURCE_TYPE) ? hint_text : String(); List<String> extensions; @@ -1105,7 +1105,7 @@ void CustomPropertyEditor::_file_selected(String p_file) { RES res = ResourceLoader::load(p_file, type); if (res.is_null()) { error->set_text(TTR("Error loading file: Not a resource!")); - error->popup_centered_minsize(); + error->popup_centered(); break; } v = res; @@ -1282,7 +1282,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { else file->set_access(EditorFileDialog::ACCESS_FILESYSTEM); - file->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); file->clear_filters(); file->clear_filters(); @@ -1316,7 +1316,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { file->set_access(EditorFileDialog::ACCESS_RESOURCES); else file->set_access(EditorFileDialog::ACCESS_FILESYSTEM); - file->set_mode(EditorFileDialog::MODE_OPEN_DIR); + file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_DIR); file->clear_filters(); file->popup_centered_ratio(); } else { @@ -1385,7 +1385,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { } else if (p_which == 1) { file->set_access(EditorFileDialog::ACCESS_RESOURCES); - file->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); List<String> extensions; String type = (hint == PROPERTY_HINT_RESOURCE_TYPE) ? hint_text : String(); diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp index ede7b860d6..464b5cb123 100644 --- a/editor/property_selector.cpp +++ b/editor/property_selector.cpp @@ -121,33 +121,33 @@ void PropertySelector::_update_search() { bool found = false; Ref<Texture2D> type_icons[Variant::VARIANT_MAX] = { - Control::get_icon("Variant", "EditorIcons"), - Control::get_icon("bool", "EditorIcons"), - Control::get_icon("int", "EditorIcons"), - Control::get_icon("float", "EditorIcons"), - Control::get_icon("String", "EditorIcons"), - Control::get_icon("Vector2", "EditorIcons"), - Control::get_icon("Rect2", "EditorIcons"), - Control::get_icon("Vector3", "EditorIcons"), - Control::get_icon("Transform2D", "EditorIcons"), - Control::get_icon("Plane", "EditorIcons"), - Control::get_icon("Quat", "EditorIcons"), - Control::get_icon("AABB", "EditorIcons"), - Control::get_icon("Basis", "EditorIcons"), - Control::get_icon("Transform", "EditorIcons"), - Control::get_icon("Color", "EditorIcons"), - Control::get_icon("Path", "EditorIcons"), - Control::get_icon("RID", "EditorIcons"), - Control::get_icon("Object", "EditorIcons"), - Control::get_icon("Dictionary", "EditorIcons"), - Control::get_icon("Array", "EditorIcons"), - Control::get_icon("PackedByteArray", "EditorIcons"), - Control::get_icon("PackedInt32Array", "EditorIcons"), - Control::get_icon("PackedFloat32Array", "EditorIcons"), - Control::get_icon("PackedStringArray", "EditorIcons"), - Control::get_icon("PackedVector2Array", "EditorIcons"), - Control::get_icon("PackedVector3Array", "EditorIcons"), - Control::get_icon("PackedColorArray", "EditorIcons") + search_options->get_icon("Variant", "EditorIcons"), + search_options->get_icon("bool", "EditorIcons"), + search_options->get_icon("int", "EditorIcons"), + search_options->get_icon("float", "EditorIcons"), + search_options->get_icon("String", "EditorIcons"), + search_options->get_icon("Vector2", "EditorIcons"), + search_options->get_icon("Rect2", "EditorIcons"), + search_options->get_icon("Vector3", "EditorIcons"), + search_options->get_icon("Transform2D", "EditorIcons"), + search_options->get_icon("Plane", "EditorIcons"), + search_options->get_icon("Quat", "EditorIcons"), + search_options->get_icon("AABB", "EditorIcons"), + search_options->get_icon("Basis", "EditorIcons"), + search_options->get_icon("Transform", "EditorIcons"), + search_options->get_icon("Color", "EditorIcons"), + search_options->get_icon("Path", "EditorIcons"), + search_options->get_icon("RID", "EditorIcons"), + search_options->get_icon("Object", "EditorIcons"), + search_options->get_icon("Dictionary", "EditorIcons"), + search_options->get_icon("Array", "EditorIcons"), + search_options->get_icon("PackedByteArray", "EditorIcons"), + search_options->get_icon("PackedInt32Array", "EditorIcons"), + search_options->get_icon("PackedFloat32Array", "EditorIcons"), + search_options->get_icon("PackedStringArray", "EditorIcons"), + search_options->get_icon("PackedVector2Array", "EditorIcons"), + search_options->get_icon("PackedVector3Array", "EditorIcons"), + search_options->get_icon("PackedColorArray", "EditorIcons") }; for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { @@ -161,7 +161,7 @@ void PropertySelector::_update_search() { Ref<Texture2D> icon; if (E->get().name == "Script Variables") { - icon = get_icon("Script", "EditorIcons"); + icon = search_options->get_icon("Script", "EditorIcons"); } else { icon = EditorNode::get_singleton()->get_class_icon(E->get().name); } @@ -238,7 +238,7 @@ void PropertySelector::_update_search() { script_methods = false; String rep = E->get().name.replace("*", ""); if (E->get().name == "*Script Methods") { - icon = get_icon("Script", "EditorIcons"); + icon = search_options->get_icon("Script", "EditorIcons"); script_methods = true; } else { icon = EditorNode::get_singleton()->get_class_icon(rep); @@ -390,7 +390,7 @@ void PropertySelector::_item_selected() { } void PropertySelector::_hide_requested() { - _closed(); // From WindowDialog. + _cancel_pressed(); // From AcceptDialog. } void PropertySelector::_notification(int p_what) { diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp index 95277e72d7..b1b76e9149 100644 --- a/editor/quick_open.cpp +++ b/editor/quick_open.cpp @@ -142,7 +142,7 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd, Vector<Pair<Str if (search_text.is_subsequence_ofi(path)) { Pair<String, Ref<Texture2D>> pair; pair.first = path; - pair.second = get_icon("folder", "FileDialog"); + pair.second = search_options->get_icon("folder", "FileDialog"); if (search_text != String() && list.size() > 0) { @@ -171,7 +171,7 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd, Vector<Pair<Str if (ClassDB::is_parent_class(efsd->get_file_type(i), base_type) && (search_text.is_subsequence_ofi(file))) { Pair<String, Ref<Texture2D>> pair; pair.first = file; - pair.second = get_icon((has_icon(efsd->get_file_type(i), ei) ? efsd->get_file_type(i) : ot), ei); + pair.second = search_options->get_icon((search_options->has_icon(efsd->get_file_type(i), ei) ? efsd->get_file_type(i) : ot), ei); list.push_back(pair); } } @@ -253,6 +253,11 @@ void EditorQuickOpen::_confirmed() { hide(); } +void EditorQuickOpen::_theme_changed() { + + search_box->set_right_icon(search_options->get_icon("Search", "EditorIcons")); +} + void EditorQuickOpen::_notification(int p_what) { switch (p_what) { @@ -262,9 +267,6 @@ void EditorQuickOpen::_notification(int p_what) { search_box->set_clear_button_enabled(true); [[fallthrough]]; } - case NOTIFICATION_THEME_CHANGED: { - search_box->set_right_icon(get_icon("Search", "EditorIcons")); - } break; case NOTIFICATION_EXIT_TREE: { disconnect("confirmed", callable_mp(this, &EditorQuickOpen::_confirmed)); } break; @@ -284,6 +286,8 @@ void EditorQuickOpen::_bind_methods() { EditorQuickOpen::EditorQuickOpen() { VBoxContainer *vbc = memnew(VBoxContainer); + vbc->connect("theme_changed", callable_mp(this, &EditorQuickOpen::_theme_changed)); + add_child(vbc); search_box = memnew(LineEdit); vbc->add_margin_child(TTR("Search:"), search_box); diff --git a/editor/quick_open.h b/editor/quick_open.h index 722bad3429..c0e2cb85d8 100644 --- a/editor/quick_open.h +++ b/editor/quick_open.h @@ -56,6 +56,8 @@ class EditorQuickOpen : public ConfirmationDialog { void _confirmed(); void _text_changed(const String &p_newtext); + void _theme_changed(); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp index 2d7b7027c8..d8bb090fd2 100644 --- a/editor/rename_dialog.cpp +++ b/editor/rename_dialog.cpp @@ -56,7 +56,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und GridContainer *grd_main = memnew(GridContainer); grd_main->set_columns(2); - grd_main->set_v_size_flags(SIZE_EXPAND_FILL); + grd_main->set_v_size_flags(Control::SIZE_EXPAND_FILL); vbc->add_child(grd_main); // ---- 1st & 2nd row @@ -67,7 +67,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und lne_search = memnew(LineEdit); lne_search->set_placeholder(TTR("Search")); lne_search->set_name("lne_search"); - lne_search->set_h_size_flags(SIZE_EXPAND_FILL); + lne_search->set_h_size_flags(Control::SIZE_EXPAND_FILL); Label *lbl_replace = memnew(Label); lbl_replace->set_text(TTR("Replace")); @@ -75,7 +75,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und lne_replace = memnew(LineEdit); lne_replace->set_placeholder(TTR("Replace")); lne_replace->set_name("lne_replace"); - lne_replace->set_h_size_flags(SIZE_EXPAND_FILL); + lne_replace->set_h_size_flags(Control::SIZE_EXPAND_FILL); grd_main->add_child(lbl_search); grd_main->add_child(lbl_replace); @@ -90,7 +90,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und lne_prefix = memnew(LineEdit); lne_prefix->set_placeholder(TTR("Prefix")); lne_prefix->set_name("lne_prefix"); - lne_prefix->set_h_size_flags(SIZE_EXPAND_FILL); + lne_prefix->set_h_size_flags(Control::SIZE_EXPAND_FILL); Label *lbl_suffix = memnew(Label); lbl_suffix->set_text(TTR("Suffix")); @@ -98,7 +98,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und lne_suffix = memnew(LineEdit); lne_suffix->set_placeholder(TTR("Suffix")); lne_suffix->set_name("lne_suffix"); - lne_suffix->set_h_size_flags(SIZE_EXPAND_FILL); + lne_suffix->set_h_size_flags(Control::SIZE_EXPAND_FILL); grd_main->add_child(lbl_prefix); grd_main->add_child(lbl_suffix); @@ -124,7 +124,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und // ---- Tab Substitute VBoxContainer *vbc_substitute = memnew(VBoxContainer); - vbc_substitute->set_h_size_flags(SIZE_EXPAND_FILL); + vbc_substitute->set_h_size_flags(Control::SIZE_EXPAND_FILL); vbc_substitute->set_custom_minimum_size(Size2(0, feature_min_height)); vbc_substitute->set_name(TTR("Substitute")); @@ -143,9 +143,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und but_insert_name = memnew(Button); but_insert_name->set_text("NAME"); but_insert_name->set_tooltip(String("${NAME}\n") + TTR("Node name")); - but_insert_name->set_focus_mode(FOCUS_NONE); + but_insert_name->set_focus_mode(Control::FOCUS_NONE); but_insert_name->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${NAME}")); - but_insert_name->set_h_size_flags(SIZE_EXPAND_FILL); + but_insert_name->set_h_size_flags(Control::SIZE_EXPAND_FILL); grd_substitute->add_child(but_insert_name); // Parent @@ -153,9 +153,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und but_insert_parent = memnew(Button); but_insert_parent->set_text("PARENT"); but_insert_parent->set_tooltip(String("${PARENT}\n") + TTR("Node's parent name, if available")); - but_insert_parent->set_focus_mode(FOCUS_NONE); + but_insert_parent->set_focus_mode(Control::FOCUS_NONE); but_insert_parent->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${PARENT}")); - but_insert_parent->set_h_size_flags(SIZE_EXPAND_FILL); + but_insert_parent->set_h_size_flags(Control::SIZE_EXPAND_FILL); grd_substitute->add_child(but_insert_parent); // Type @@ -163,9 +163,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und but_insert_type = memnew(Button); but_insert_type->set_text("TYPE"); but_insert_type->set_tooltip(String("${TYPE}\n") + TTR("Node type")); - but_insert_type->set_focus_mode(FOCUS_NONE); + but_insert_type->set_focus_mode(Control::FOCUS_NONE); but_insert_type->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${TYPE}")); - but_insert_type->set_h_size_flags(SIZE_EXPAND_FILL); + but_insert_type->set_h_size_flags(Control::SIZE_EXPAND_FILL); grd_substitute->add_child(but_insert_type); // Scene @@ -173,9 +173,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und but_insert_scene = memnew(Button); but_insert_scene->set_text("SCENE"); but_insert_scene->set_tooltip(String("${SCENE}\n") + TTR("Current scene name")); - but_insert_scene->set_focus_mode(FOCUS_NONE); + but_insert_scene->set_focus_mode(Control::FOCUS_NONE); but_insert_scene->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${SCENE}")); - but_insert_scene->set_h_size_flags(SIZE_EXPAND_FILL); + but_insert_scene->set_h_size_flags(Control::SIZE_EXPAND_FILL); grd_substitute->add_child(but_insert_scene); // Root @@ -183,9 +183,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und but_insert_root = memnew(Button); but_insert_root->set_text("ROOT"); but_insert_root->set_tooltip(String("${ROOT}\n") + TTR("Root node name")); - but_insert_root->set_focus_mode(FOCUS_NONE); + but_insert_root->set_focus_mode(Control::FOCUS_NONE); but_insert_root->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${ROOT}")); - but_insert_root->set_h_size_flags(SIZE_EXPAND_FILL); + but_insert_root->set_h_size_flags(Control::SIZE_EXPAND_FILL); grd_substitute->add_child(but_insert_root); // Count @@ -193,9 +193,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und but_insert_count = memnew(Button); but_insert_count->set_text("COUNTER"); but_insert_count->set_tooltip(String("${COUNTER}\n") + TTR("Sequential integer counter.\nCompare counter options.")); - but_insert_count->set_focus_mode(FOCUS_NONE); + but_insert_count->set_focus_mode(Control::FOCUS_NONE); but_insert_count->connect("pressed", callable_mp(this, &RenameDialog::_insert_text), make_binds("${COUNTER}")); - but_insert_count->set_h_size_flags(SIZE_EXPAND_FILL); + but_insert_count->set_h_size_flags(Control::SIZE_EXPAND_FILL); grd_substitute->add_child(but_insert_count); chk_per_level_counter = memnew(CheckBox); @@ -240,7 +240,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und // ---- Tab Process VBoxContainer *vbc_process = memnew(VBoxContainer); - vbc_process->set_h_size_flags(SIZE_EXPAND_FILL); + vbc_process->set_h_size_flags(Control::SIZE_EXPAND_FILL); vbc_process->set_name(TTR("Post-Process")); vbc_process->set_custom_minimum_size(Size2(0, feature_min_height)); tabc_features->add_child(vbc_process); @@ -296,8 +296,8 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und // ---- Dialog related - set_custom_minimum_size(Size2(383, 0)); - set_as_toplevel(true); + set_min_size(Size2(383, 0)); + //set_as_toplevel(true); get_ok()->set_text(TTR("Rename")); Button *but_reset = add_button(TTR("Reset")); @@ -347,7 +347,7 @@ void RenameDialog::_bind_methods() { void RenameDialog::_update_substitute() { - LineEdit *focus_owner_line_edit = Object::cast_to<LineEdit>(get_focus_owner()); + LineEdit *focus_owner_line_edit = Object::cast_to<LineEdit>(scene_tree_editor->get_focus_owner()); bool is_main_field = _is_main_field(focus_owner_line_edit); but_insert_name->set_disabled(!is_main_field); @@ -358,12 +358,12 @@ void RenameDialog::_update_substitute() { but_insert_count->set_disabled(!is_main_field); // The focus mode seems to be reset when disabling/re-enabling - but_insert_name->set_focus_mode(FOCUS_NONE); - but_insert_parent->set_focus_mode(FOCUS_NONE); - but_insert_type->set_focus_mode(FOCUS_NONE); - but_insert_scene->set_focus_mode(FOCUS_NONE); - but_insert_root->set_focus_mode(FOCUS_NONE); - but_insert_count->set_focus_mode(FOCUS_NONE); + but_insert_name->set_focus_mode(Control::FOCUS_NONE); + but_insert_parent->set_focus_mode(Control::FOCUS_NONE); + but_insert_type->set_focus_mode(Control::FOCUS_NONE); + but_insert_scene->set_focus_mode(Control::FOCUS_NONE); + but_insert_root->set_focus_mode(Control::FOCUS_NONE); + but_insert_count->set_focus_mode(Control::FOCUS_NONE); } void RenameDialog::_post_popup() { @@ -652,7 +652,7 @@ bool RenameDialog::_is_main_field(LineEdit *line_edit) { void RenameDialog::_insert_text(String text) { - LineEdit *focus_owner = Object::cast_to<LineEdit>(get_focus_owner()); + LineEdit *focus_owner = Object::cast_to<LineEdit>(scene_tree_editor->get_focus_owner()); if (_is_main_field(focus_owner)) { focus_owner->selection_delete(); diff --git a/editor/rename_dialog.h b/editor/rename_dialog.h index 537aa1703b..1cd0a2cb0f 100644 --- a/editor/rename_dialog.h +++ b/editor/rename_dialog.h @@ -103,7 +103,6 @@ class RenameDialog : public ConfirmationDialog { bool has_errors; protected: - void _notification(int p_what){}; static void _bind_methods(); virtual void _post_popup(); diff --git a/editor/reparent_dialog.cpp b/editor/reparent_dialog.cpp index 551d20eddb..b71c2bd078 100644 --- a/editor/reparent_dialog.cpp +++ b/editor/reparent_dialog.cpp @@ -45,12 +45,6 @@ void ReparentDialog::_notification(int p_what) { disconnect("confirmed", callable_mp(this, &ReparentDialog::_reparent)); } - - if (p_what == NOTIFICATION_DRAW) { - - //RID ci = get_canvas_item(); - //get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); - } } void ReparentDialog::_cancel() { diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 868c52ac78..597cb163e9 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -133,7 +133,7 @@ void SceneTreeDock::instance(const String &p_file) { current_option = -1; accept->set_text(TTR("No parent to instance a child at.")); - accept->popup_centered_minsize(); + accept->popup_centered(); return; }; @@ -155,7 +155,7 @@ void SceneTreeDock::instance_scenes(const Vector<String> &p_files, Node *p_paren if (!parent || !edited_scene) { accept->set_text(TTR("No parent to instance the scenes at.")); - accept->popup_centered_minsize(); + accept->popup_centered(); return; }; @@ -176,7 +176,7 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String> &p_files, Node if (!sdata.is_valid()) { current_option = -1; accept->set_text(vformat(TTR("Error loading scene from %s"), p_files[i])); - accept->popup_centered_minsize(); + accept->popup_centered(); error = true; break; } @@ -185,7 +185,7 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String> &p_files, Node if (!instanced_scene) { current_option = -1; accept->set_text(vformat(TTR("Error instancing scene from %s"), p_files[i])); - accept->popup_centered_minsize(); + accept->popup_centered(); error = true; break; } @@ -195,7 +195,7 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String> &p_files, Node if (_cyclical_dependency_exists(edited_scene->get_filename(), instanced_scene)) { accept->set_text(vformat(TTR("Cannot instance the scene '%s' because the current scene exists within one of its nodes."), p_files[i])); - accept->popup_centered_minsize(); + accept->popup_centered(); error = true; break; } @@ -242,14 +242,14 @@ void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *base) Ref<PackedScene> sdata = ResourceLoader::load(p_file); if (!sdata.is_valid()) { accept->set_text(vformat(TTR("Error loading scene from %s"), p_file)); - accept->popup_centered_minsize(); + accept->popup_centered(); return; } Node *instanced_scene = sdata->instance(PackedScene::GEN_EDIT_STATE_INSTANCE); if (!instanced_scene) { accept->set_text(vformat(TTR("Error instancing scene from %s"), p_file)); - accept->popup_centered_minsize(); + accept->popup_centered(); return; } @@ -473,7 +473,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { current_option = -1; accept->set_text(TTR("This operation can't be done on the tree root.")); - accept->popup_centered_minsize(); + accept->popup_centered(); break; } @@ -537,7 +537,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { current_option = -1; accept->set_text(TTR("This operation can't be done on the tree root.")); - accept->popup_centered_minsize(); + accept->popup_centered(); break; } @@ -620,7 +620,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { current_option = -1; accept->set_text(TTR("This operation can't be done on the tree root.")); - accept->popup_centered_minsize(); + accept->popup_centered(); break; } @@ -656,19 +656,19 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (root->get_scene_inherited_state().is_valid()) { accept->set_text(TTR("Can't reparent nodes in inherited scenes, order of nodes can't change.")); - accept->popup_centered_minsize(); + accept->popup_centered(); return; } if (node->get_owner() != root) { accept->set_text(TTR("Node must belong to the edited scene to become root.")); - accept->popup_centered_minsize(); + accept->popup_centered(); return; } if (node->get_filename() != String()) { accept->set_text(TTR("Instantiated scenes can't become root")); - accept->popup_centered_minsize(); + accept->popup_centered(); return; } @@ -747,7 +747,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { // This prevents the dialog from being too wide after displaying // a deletion confirmation for a node with a long name. delete_dialog->set_size(Size2()); - delete_dialog->popup_centered_minsize(); + delete_dialog->popup_centered(); } } break; @@ -769,7 +769,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!scene) { accept->set_text(TTR("This operation can't be done without a scene.")); - accept->popup_centered_minsize(); + accept->popup_centered(); break; } @@ -777,7 +777,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (selection.size() != 1) { accept->set_text(TTR("This operation requires a single selected node.")); - accept->popup_centered_minsize(); + accept->popup_centered(); break; } @@ -785,17 +785,17 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (tocopy == scene) { accept->set_text(TTR("Can not perform with the root node.")); - accept->popup_centered_minsize(); + accept->popup_centered(); break; } if (tocopy != editor_data->get_edited_scene_root() && tocopy->get_filename() != "") { accept->set_text(TTR("This operation can't be done on instanced scenes.")); - accept->popup_centered_minsize(); + accept->popup_centered(); break; } - new_scene_from_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); + new_scene_from_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); List<String> extensions; Ref<PackedScene> sd = memnew(PackedScene); @@ -850,7 +850,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (editable) { editable_instance_remove_dialog->set_text(TTR("Disabling \"editable_instance\" will cause all properties of the node to be reverted to their default.")); - editable_instance_remove_dialog->popup_centered_minsize(); + editable_instance_remove_dialog->popup_centered(); break; } _toggle_editable_children(node); @@ -874,7 +874,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { // Fire confirmation dialog when children are editable. if (editable && !placeholder) { placeholder_editable_instance_remove_dialog->set_text(TTR("Enabling \"Load As Placeholder\" will disable \"Editable Children\" and cause all properties of the node to be reverted to their default.")); - placeholder_editable_instance_remove_dialog->popup_centered_minsize(); + placeholder_editable_instance_remove_dialog->popup_centered(); break; } @@ -931,7 +931,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { break; } - clear_inherit_confirm->popup_centered_minsize(); + clear_inherit_confirm->popup_centered(); } break; case TOOL_SCENE_CLEAR_INHERITANCE_CONFIRM: { if (!profile_allow_editing) { @@ -1480,7 +1480,7 @@ bool SceneTreeDock::_validate_no_foreign() { if (E->get() != edited_scene && E->get()->get_owner() != edited_scene) { accept->set_text(TTR("Can't operate on nodes from a foreign scene!")); - accept->popup_centered_minsize(); + accept->popup_centered(); return false; } @@ -1494,7 +1494,7 @@ bool SceneTreeDock::_validate_no_foreign() { if (edited_scene->get_scene_inherited_state().is_valid() && edited_scene->get_scene_inherited_state()->find_node_by_path(edited_scene->get_path_to(E->get())) >= 0) { accept->set_text(TTR("Can't operate on nodes the current scene inherits from!")); - accept->popup_centered_minsize(); + accept->popup_centered(); return false; } } @@ -2189,13 +2189,13 @@ void SceneTreeDock::_new_scene_from(String p_file) { if (selection.size() != 1) { accept->set_text(TTR("This operation requires a single selected node.")); - accept->popup_centered_minsize(); + accept->popup_centered(); return; } if (EditorNode::get_singleton()->is_scene_open(p_file)) { accept->set_text(TTR("Can't overwrite scene that is still open!")); - accept->popup_centered_minsize(); + accept->popup_centered(); return; } @@ -2212,7 +2212,7 @@ void SceneTreeDock::_new_scene_from(String p_file) { if (err != OK) { accept->set_text(TTR("Couldn't save new scene. Likely dependencies (instances) couldn't be satisfied.")); - accept->popup_centered_minsize(); + accept->popup_centered(); return; } @@ -2223,13 +2223,13 @@ void SceneTreeDock::_new_scene_from(String p_file) { err = ResourceSaver::save(p_file, sdata, flg); if (err != OK) { accept->set_text(TTR("Error saving scene.")); - accept->popup_centered_minsize(); + accept->popup_centered(); return; } _replace_with_branch_scene(p_file, base); } else { accept->set_text(TTR("Error duplicating scene to save it.")); - accept->popup_centered_minsize(); + accept->popup_centered(); return; } } @@ -2941,7 +2941,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel import_subscene_dialog->connect("subscene_selected", callable_mp(this, &SceneTreeDock::_import_subscene)); new_scene_from_dialog = memnew(EditorFileDialog); - new_scene_from_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); + new_scene_from_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); add_child(new_scene_from_dialog); new_scene_from_dialog->connect("file_selected", callable_mp(this, &SceneTreeDock::_new_scene_from)); diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 0f8e748dfb..89bedf1cd1 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -129,7 +129,7 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i return; config_err = config_err.word_wrap(80); warning->set_text(config_err); - warning->popup_centered_minsize(); + warning->popup_centered(); } else if (p_id == BUTTON_SIGNALS) { @@ -757,7 +757,7 @@ void SceneTreeEditor::_renamed() { if (!Node::_validate_node_name(new_name)) { error->set_text(TTR("Invalid node name, the following characters are not allowed:") + "\n" + Node::invalid_character); - error->popup_centered_minsize(); + error->popup_centered(); if (new_name.empty()) { which->set_text(0, n->get_name()); @@ -1193,18 +1193,19 @@ SceneTreeEditor::~SceneTreeEditor() { void SceneTreeDialog::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_VISIBILITY_CHANGED: { + + if (is_visible()) + tree->update_tree(); + } break; case NOTIFICATION_ENTER_TREE: { connect("confirmed", callable_mp(this, &SceneTreeDialog::_select)); - filter->set_right_icon(get_icon("Search", "EditorIcons")); + filter->set_right_icon(tree->get_icon("Search", "EditorIcons")); filter->set_clear_button_enabled(true); } break; case NOTIFICATION_EXIT_TREE: { disconnect("confirmed", callable_mp(this, &SceneTreeDialog::_select)); } break; - case NOTIFICATION_VISIBILITY_CHANGED: { - if (is_visible_in_tree()) - tree->update_tree(); - } break; } } @@ -1239,14 +1240,14 @@ SceneTreeDialog::SceneTreeDialog() { add_child(vbc); filter = memnew(LineEdit); - filter->set_h_size_flags(SIZE_EXPAND_FILL); + filter->set_h_size_flags(Control::SIZE_EXPAND_FILL); filter->set_placeholder(TTR("Filter nodes")); filter->add_constant_override("minimum_spaces", 0); filter->connect("text_changed", callable_mp(this, &SceneTreeDialog::_filter_changed)); vbc->add_child(filter); tree = memnew(SceneTreeEditor(false, false, true)); - tree->set_v_size_flags(SIZE_EXPAND_FILL); + tree->set_v_size_flags(Control::SIZE_EXPAND_FILL); tree->get_scene_tree()->connect("item_activated", callable_mp(this, &SceneTreeDialog::_select)); vbc->add_child(tree); } diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 5a111afe32..ae6a80d841 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -40,36 +40,38 @@ #include "editor/editor_scale.h" #include "editor_file_system.h" -void ScriptCreateDialog::_notification(int p_what) { +void ScriptCreateDialog::_theme_changed() { + for (int i = 0; i < ScriptServer::get_language_count(); i++) { + String lang = ScriptServer::get_language(i)->get_type(); + Ref<Texture2D> lang_icon = gc->get_icon(lang, "EditorIcons"); + if (lang_icon.is_valid()) { + language_menu->set_item_icon(i, lang_icon); + } + } - switch (p_what) { - case NOTIFICATION_THEME_CHANGED: - case NOTIFICATION_ENTER_TREE: { - for (int i = 0; i < ScriptServer::get_language_count(); i++) { - String lang = ScriptServer::get_language(i)->get_type(); - Ref<Texture2D> lang_icon = get_icon(lang, "EditorIcons"); - if (lang_icon.is_valid()) { - language_menu->set_item_icon(i, lang_icon); - } + String last_lang = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", ""); + if (!last_lang.empty()) { + for (int i = 0; i < language_menu->get_item_count(); i++) { + if (language_menu->get_item_text(i) == last_lang) { + language_menu->select(i); + current_language = i; + break; } + } + } else { + language_menu->select(default_language); + } - String last_lang = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", ""); - if (!last_lang.empty()) { - for (int i = 0; i < language_menu->get_item_count(); i++) { - if (language_menu->get_item_text(i) == last_lang) { - language_menu->select(i); - current_language = i; - break; - } - } - } else { - language_menu->select(default_language); - } + path_button->set_icon(gc->get_icon("Folder", "EditorIcons")); + parent_browse_button->set_icon(gc->get_icon("Folder", "EditorIcons")); + parent_search_button->set_icon(gc->get_icon("ClassList", "EditorIcons")); + status_panel->add_style_override("panel", gc->get_stylebox("bg", "Tree")); +} +void ScriptCreateDialog::_notification(int p_what) { - path_button->set_icon(get_icon("Folder", "EditorIcons")); - parent_browse_button->set_icon(get_icon("Folder", "EditorIcons")); - parent_search_button->set_icon(get_icon("ClassList", "EditorIcons")); - status_panel->add_style_override("panel", get_stylebox("bg", "Tree")); + switch (p_what) { + case NOTIFICATION_ENTER_TREE: { + _theme_changed(); } break; } } @@ -442,7 +444,7 @@ void ScriptCreateDialog::_lang_changed(int l) { override_info += ", "; } } - template_menu->set_item_icon(extended.id, get_icon("Override", "EditorIcons")); + template_menu->set_item_icon(extended.id, gc->get_icon("Override", "EditorIcons")); template_menu->get_popup()->set_item_tooltip(extended.id, override_info.as_string()); } // Reselect last selected template @@ -517,11 +519,11 @@ void ScriptCreateDialog::_browse_path(bool browse_parent, bool p_save) { is_browsing_parent = browse_parent; if (p_save) { - file_browse->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_browse->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_browse->set_title(TTR("Open Script / Choose Location")); file_browse->get_ok()->set_text(TTR("Open")); } else { - file_browse->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file_browse->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); file_browse->set_title(TTR("Open Script")); } @@ -607,9 +609,9 @@ void ScriptCreateDialog::_msg_script_valid(bool valid, const String &p_msg) { error_label->set_text("- " + TTR(p_msg)); if (valid) { - error_label->add_color_override("font_color", get_color("success_color", "Editor")); + error_label->add_color_override("font_color", gc->get_color("success_color", "Editor")); } else { - error_label->add_color_override("font_color", get_color("error_color", "Editor")); + error_label->add_color_override("font_color", gc->get_color("error_color", "Editor")); } } @@ -617,9 +619,9 @@ void ScriptCreateDialog::_msg_path_valid(bool valid, const String &p_msg) { path_error_label->set_text("- " + TTR(p_msg)); if (valid) { - path_error_label->add_color_override("font_color", get_color("success_color", "Editor")); + path_error_label->add_color_override("font_color", gc->get_color("success_color", "Editor")); } else { - path_error_label->add_color_override("font_color", get_color("error_color", "Editor")); + path_error_label->add_color_override("font_color", gc->get_color("error_color", "Editor")); } } @@ -739,9 +741,11 @@ ScriptCreateDialog::ScriptCreateDialog() { /* Main Controls */ - GridContainer *gc = memnew(GridContainer); + gc = memnew(GridContainer); gc->set_columns(2); + gc->connect("theme_changed", callable_mp(this, &ScriptCreateDialog::_theme_changed)); + /* Error Messages Field */ VBoxContainer *vb = memnew(VBoxContainer); @@ -774,7 +778,7 @@ ScriptCreateDialog::ScriptCreateDialog() { language_menu = memnew(OptionButton); language_menu->set_custom_minimum_size(Size2(250, 0) * EDSCALE); - language_menu->set_h_size_flags(SIZE_EXPAND_FILL); + language_menu->set_h_size_flags(Control::SIZE_EXPAND_FILL); gc->add_child(memnew(Label(TTR("Language:")))); gc->add_child(language_menu); @@ -798,10 +802,10 @@ ScriptCreateDialog::ScriptCreateDialog() { base_type = "Object"; hb = memnew(HBoxContainer); - hb->set_h_size_flags(SIZE_EXPAND_FILL); + hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); parent_name = memnew(LineEdit); parent_name->connect("text_changed", callable_mp(this, &ScriptCreateDialog::_parent_name_changed)); - parent_name->set_h_size_flags(SIZE_EXPAND_FILL); + parent_name->set_h_size_flags(Control::SIZE_EXPAND_FILL); hb->add_child(parent_name); parent_search_button = memnew(Button); parent_search_button->set_flat(true); @@ -819,7 +823,7 @@ ScriptCreateDialog::ScriptCreateDialog() { class_name = memnew(LineEdit); class_name->connect("text_changed", callable_mp(this, &ScriptCreateDialog::_class_name_changed)); - class_name->set_h_size_flags(SIZE_EXPAND_FILL); + class_name->set_h_size_flags(Control::SIZE_EXPAND_FILL); gc->add_child(memnew(Label(TTR("Class Name:")))); gc->add_child(class_name); @@ -845,7 +849,7 @@ ScriptCreateDialog::ScriptCreateDialog() { file_path = memnew(LineEdit); file_path->connect("text_changed", callable_mp(this, &ScriptCreateDialog::_path_changed)); file_path->connect("text_entered", callable_mp(this, &ScriptCreateDialog::_path_entered)); - file_path->set_h_size_flags(SIZE_EXPAND_FILL); + file_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); hb->add_child(file_path); path_button = memnew(Button); path_button->set_flat(true); @@ -863,18 +867,16 @@ ScriptCreateDialog::ScriptCreateDialog() { file_browse = memnew(EditorFileDialog); file_browse->connect("file_selected", callable_mp(this, &ScriptCreateDialog::_file_selected)); - file_browse->set_mode(EditorFileDialog::MODE_OPEN_FILE); + file_browse->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); add_child(file_browse); get_ok()->set_text(TTR("Create")); alert = memnew(AcceptDialog); - alert->set_as_minsize(); alert->get_label()->set_autowrap(true); alert->get_label()->set_align(Label::ALIGN_CENTER); alert->get_label()->set_valign(Label::VALIGN_CENTER); alert->get_label()->set_custom_minimum_size(Size2(325, 60) * EDSCALE); add_child(alert); - set_as_minsize(); set_hide_on_ok(false); set_title(TTR("Attach Node Script")); diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h index f73309c373..f164cd2a15 100644 --- a/editor/script_create_dialog.h +++ b/editor/script_create_dialog.h @@ -45,6 +45,7 @@ class CreateDialog; class ScriptCreateDialog : public ConfirmationDialog { GDCLASS(ScriptCreateDialog, ConfirmationDialog); + GridContainer *gc; LineEdit *class_name; Label *error_label; Label *path_error_label; @@ -123,6 +124,7 @@ class ScriptCreateDialog : public ConfirmationDialog { void _update_dialog(); protected: + void _theme_changed(); void _notification(int p_what); static void _bind_methods(); diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index cf93fab9a8..324e1cf502 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -118,6 +118,12 @@ void EditorSettingsDialog::_undo_redo_callback(void *p_self, const String &p_nam void EditorSettingsDialog::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_VISIBILITY_CHANGED: { + if (!is_visible()) { + EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "editor_settings", Rect2(get_position(), get_size())); + set_process_unhandled_input(false); + } + } break; case NOTIFICATION_READY: { undo_redo->set_method_notify_callback(EditorDebuggerNode::_method_changeds, NULL); undo_redo->set_property_notify_callback(EditorDebuggerNode::_property_changeds, NULL); @@ -126,10 +132,6 @@ void EditorSettingsDialog::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { _update_icons(); } break; - case NOTIFICATION_POPUP_HIDE: { - EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "editor_settings", get_rect()); - set_process_unhandled_input(false); - } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { _update_icons(); // Update theme colors. @@ -143,7 +145,7 @@ void EditorSettingsDialog::_unhandled_input(const Ref<InputEvent> &p_event) { const Ref<InputEventKey> k = p_event; - if (k.is_valid() && is_window_modal_on_top() && k->is_pressed()) { + if (k.is_valid() && k->is_pressed()) { bool handled = false; @@ -169,22 +171,22 @@ void EditorSettingsDialog::_unhandled_input(const Ref<InputEvent> &p_event) { } if (handled) { - accept_event(); + set_input_as_handled(); } } } void EditorSettingsDialog::_update_icons() { - search_box->set_right_icon(get_icon("Search", "EditorIcons")); + search_box->set_right_icon(shortcuts->get_icon("Search", "EditorIcons")); search_box->set_clear_button_enabled(true); - shortcut_search_box->set_right_icon(get_icon("Search", "EditorIcons")); + shortcut_search_box->set_right_icon(shortcuts->get_icon("Search", "EditorIcons")); shortcut_search_box->set_clear_button_enabled(true); - restart_close_button->set_icon(get_icon("Close", "EditorIcons")); - restart_container->add_style_override("panel", get_stylebox("bg", "Tree")); - restart_icon->set_texture(get_icon("StatusWarning", "EditorIcons")); - restart_label->add_color_override("font_color", get_color("warning_color", "Editor")); + restart_close_button->set_icon(shortcuts->get_icon("Close", "EditorIcons")); + restart_container->add_style_override("panel", shortcuts->get_stylebox("bg", "Tree")); + restart_icon->set_texture(shortcuts->get_icon("StatusWarning", "EditorIcons")); + restart_label->add_color_override("font_color", shortcuts->get_color("warning_color", "Editor")); } void EditorSettingsDialog::_update_shortcuts() { @@ -230,8 +232,8 @@ void EditorSettingsDialog::_update_shortcuts() { } sections[section_name] = section; - section->set_custom_bg_color(0, get_color("prop_subsection", "Editor")); - section->set_custom_bg_color(1, get_color("prop_subsection", "Editor")); + section->set_custom_bg_color(0, shortcuts->get_color("prop_subsection", "Editor")); + section->set_custom_bg_color(1, shortcuts->get_color("prop_subsection", "Editor")); } // Don't match unassigned shortcuts when searching for assigned keys in search results. @@ -243,16 +245,16 @@ void EditorSettingsDialog::_update_shortcuts() { item->set_text(1, sc->get_as_text()); if (!sc->is_shortcut(original) && !(sc->get_shortcut().is_null() && original.is_null())) { - item->add_button(1, get_icon("Reload", "EditorIcons"), 2); + item->add_button(1, shortcuts->get_icon("Reload", "EditorIcons"), 2); } if (sc->get_as_text() == "None") { // Fade out unassigned shortcut labels for easier visual grepping. - item->set_custom_color(1, get_color("font_color", "Label") * Color(1, 1, 1, 0.5)); + item->set_custom_color(1, shortcuts->get_color("font_color", "Label") * Color(1, 1, 1, 0.5)); } - item->add_button(1, get_icon("Edit", "EditorIcons"), 0); - item->add_button(1, get_icon("Close", "EditorIcons"), 1); + item->add_button(1, shortcuts->get_icon("Edit", "EditorIcons"), 0); + item->add_button(1, shortcuts->get_icon("Close", "EditorIcons"), 1); item->set_tooltip(0, E->get()); item->set_metadata(0, E->get()); } @@ -279,9 +281,9 @@ void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column press_a_key_label->set_text(TTR("Press a Key...")); last_wait_for_key = Ref<InputEventKey>(); press_a_key->popup_centered(Size2(250, 80) * EDSCALE); - press_a_key->grab_focus(); - press_a_key->get_ok()->set_focus_mode(FOCUS_NONE); - press_a_key->get_cancel()->set_focus_mode(FOCUS_NONE); + //press_a_key->grab_focus(); + press_a_key->get_ok()->set_focus_mode(Control::FOCUS_NONE); + press_a_key->get_cancel()->set_focus_mode(Control::FOCUS_NONE); shortcut_configured = item; } else if (p_idx == 1) { //erase @@ -323,7 +325,7 @@ void EditorSettingsDialog::_wait_for_key(const Ref<InputEvent> &p_event) { const String str = keycode_get_string(k->get_keycode_with_modifiers()); press_a_key_label->set_text(str); - press_a_key->accept_event(); + press_a_key->set_input_as_handled(); } } @@ -394,7 +396,7 @@ void EditorSettingsDialog::_bind_methods() { EditorSettingsDialog::EditorSettingsDialog() { set_title(TTR("Editor Settings")); - set_resizable(true); + undo_redo = memnew(UndoRedo); tabs = memnew(TabContainer); @@ -430,7 +432,7 @@ EditorSettingsDialog::EditorSettingsDialog() { HBoxContainer *restart_hb = memnew(HBoxContainer); restart_container->add_child(restart_hb); restart_icon = memnew(TextureRect); - restart_icon->set_v_size_flags(SIZE_SHRINK_CENTER); + restart_icon->set_v_size_flags(Control::SIZE_SHRINK_CENTER); restart_hb->add_child(restart_icon); restart_label = memnew(Label); restart_label->set_text(TTR("The editor must be restarted for changes to take effect.")); @@ -462,7 +464,7 @@ EditorSettingsDialog::EditorSettingsDialog() { shortcuts = memnew(Tree); tab_shortcuts->add_child(shortcuts, true); - shortcuts->set_v_size_flags(SIZE_EXPAND_FILL); + shortcuts->set_v_size_flags(Control::SIZE_EXPAND_FILL); shortcuts->set_columns(2); shortcuts->set_hide_root(true); shortcuts->set_column_titles_visible(true); @@ -471,7 +473,7 @@ EditorSettingsDialog::EditorSettingsDialog() { shortcuts->connect("button_pressed", callable_mp(this, &EditorSettingsDialog::_shortcut_button_pressed)); press_a_key = memnew(ConfirmationDialog); - press_a_key->set_focus_mode(FOCUS_ALL); + //press_a_key->set_focus_mode(Control::FOCUS_ALL); add_child(press_a_key); Label *l = memnew(Label); @@ -479,10 +481,10 @@ EditorSettingsDialog::EditorSettingsDialog() { l->set_anchors_and_margins_preset(Control::PRESET_WIDE); l->set_align(Label::ALIGN_CENTER); l->set_margin(MARGIN_TOP, 20); - l->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_BEGIN, 30); + l->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_BEGIN, 30); press_a_key_label = l; press_a_key->add_child(l); - press_a_key->connect("gui_input", callable_mp(this, &EditorSettingsDialog::_wait_for_key)); + press_a_key->connect("window_input", callable_mp(this, &EditorSettingsDialog::_wait_for_key)); press_a_key->connect("confirmed", callable_mp(this, &EditorSettingsDialog::_press_a_key_confirm)); set_hide_on_ok(true); |