diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/debugger/editor_profiler.cpp | 22 | ||||
-rw-r--r-- | editor/debugger/editor_profiler.h | 3 | ||||
-rw-r--r-- | editor/debugger/script_editor_debugger.cpp | 9 | ||||
-rw-r--r-- | editor/editor_help_search.cpp | 9 | ||||
-rw-r--r-- | editor/editor_node.cpp | 9 | ||||
-rw-r--r-- | editor/editor_undo_redo_manager.cpp | 7 | ||||
-rw-r--r-- | editor/export/editor_export_platform.cpp | 13 | ||||
-rw-r--r-- | editor/export/project_export.cpp | 15 | ||||
-rw-r--r-- | editor/icons/PreviewEnvironment.svg | 1 | ||||
-rw-r--r-- | editor/icons/PreviewSun.svg | 1 | ||||
-rw-r--r-- | editor/plugins/animation_blend_tree_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 24 | ||||
-rw-r--r-- | editor/plugins/shader_editor_plugin.h | 4 | ||||
-rw-r--r-- | editor/plugins/tiles/tile_map_editor.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/version_control_editor_plugin.cpp | 10 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/project_manager.cpp | 59 | ||||
-rw-r--r-- | editor/project_manager.h | 3 |
18 files changed, 157 insertions, 43 deletions
diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index cf48366bd3..a882275375 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -104,6 +104,10 @@ void EditorProfiler::clear() { updating_frame = false; hover_metric = -1; seeking = false; + + // Ensure button text (start, stop) is correct + _set_button_text(); + emit_signal(SNAME("enable_profiling"), activate->is_pressed()); } static String _get_percent_txt(float p_value, float p_total) { @@ -374,15 +378,23 @@ void EditorProfiler::_update_frame() { updating_frame = false; } -void EditorProfiler::_activate_pressed() { +void EditorProfiler::_set_button_text() { if (activate->is_pressed()) { activate->set_icon(get_theme_icon(SNAME("Stop"), SNAME("EditorIcons"))); activate->set_text(TTR("Stop")); - _clear_pressed(); } else { activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); activate->set_text(TTR("Start")); } +} + +void EditorProfiler::_activate_pressed() { + _set_button_text(); + + if (activate->is_pressed()) { + _clear_pressed(); + } + emit_signal(SNAME("enable_profiling"), activate->is_pressed()); } @@ -499,8 +511,12 @@ void EditorProfiler::_bind_methods() { ADD_SIGNAL(MethodInfo("break_request")); } -void EditorProfiler::set_enabled(bool p_enable) { +void EditorProfiler::set_enabled(bool p_enable, bool p_clear) { + activate->set_pressed(false); activate->set_disabled(!p_enable); + if (p_clear) { + clear(); + } } bool EditorProfiler::is_profiling() { diff --git a/editor/debugger/editor_profiler.h b/editor/debugger/editor_profiler.h index df92125258..e9ecc285ed 100644 --- a/editor/debugger/editor_profiler.h +++ b/editor/debugger/editor_profiler.h @@ -122,6 +122,7 @@ private: Timer *frame_delay = nullptr; Timer *plot_delay = nullptr; + void _set_button_text(); void _update_frame(); void _activate_pressed(); @@ -153,7 +154,7 @@ protected: public: void add_frame_metric(const Metric &p_metric, bool p_final = false); - void set_enabled(bool p_enable); + void set_enabled(bool p_enable, bool p_clear = true); bool is_profiling(); bool is_seeking() { return seeking; } void disable_seeking(); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 5baa9970af..6bc1536cb9 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -52,7 +52,6 @@ #include "editor/plugins/node_3d_editor_plugin.h" #include "main/performance.h" #include "scene/3d/camera_3d.h" -#include "scene/debugger/scene_debugger.h" #include "scene/gui/dialogs.h" #include "scene/gui/label.h" #include "scene/gui/line_edit.h" @@ -317,7 +316,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da if (!error.is_empty()) { tabs->set_current_tab(0); } - profiler->set_enabled(false); + profiler->set_enabled(false, false); inspector->clear_cache(); // Take a chance to force remote objects update. } else if (p_msg == "debug_exit") { @@ -327,7 +326,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da _update_buttons_state(); _set_reason_text(TTR("Execution resumed."), MESSAGE_SUCCESS); emit_signal(SNAME("breaked"), false, false, "", false); - profiler->set_enabled(true); + profiler->set_enabled(true, false); profiler->disable_seeking(); } else if (p_msg == "set_pid") { ERR_FAIL_COND(p_data.size() < 1); @@ -916,6 +915,8 @@ void ScriptEditorDebugger::start(Ref<RemoteDebuggerPeer> p_peer) { _clear_errors_list(); stop(); + profiler->set_enabled(true, true); + peer = p_peer; ERR_FAIL_COND(p_peer.is_null()); @@ -971,6 +972,8 @@ void ScriptEditorDebugger::stop() { res_path_cache.clear(); profiler_signature.clear(); + profiler->set_enabled(true, false); + inspector->edit(nullptr); _update_buttons_state(); } diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 129ad4d33b..7e7d7ca418 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -326,6 +326,7 @@ bool EditorHelpSearch::Runner::_phase_match_classes_init() { bool EditorHelpSearch::Runner::_phase_match_classes() { DocData::ClassDoc &class_doc = iterator_doc->value; if (class_doc.name.is_empty()) { + ++iterator_doc; return false; } if (!_is_class_disabled_by_feature_profile(class_doc.name)) { @@ -432,7 +433,7 @@ bool EditorHelpSearch::Runner::_phase_class_items_init() { bool EditorHelpSearch::Runner::_phase_class_items() { if (!iterator_match) { - return false; + return true; } ClassMatch &match = iterator_match->value; @@ -459,10 +460,8 @@ bool EditorHelpSearch::Runner::_phase_member_items_init() { bool EditorHelpSearch::Runner::_phase_member_items() { ClassMatch &match = iterator_match->value; - if (!match.doc) { - return false; - } - if (match.doc->name.is_empty()) { + if (!match.doc || match.doc->name.is_empty()) { + ++iterator_match; return false; } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 9dc4c2c953..804722299c 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6750,8 +6750,10 @@ EditorNode::EditorNode() { project_menu->add_separator(); project_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/export", TTR("Export..."), Key::NONE, TTR("Export")), FILE_EXPORT_PROJECT); +#ifndef ANDROID_ENABLED project_menu->add_item(TTR("Install Android Build Template..."), FILE_INSTALL_ANDROID_SOURCE); project_menu->add_item(TTR("Open User Data Folder"), RUN_USER_DATA_FOLDER); +#endif project_menu->add_separator(); project_menu->add_item(TTR("Customize Engine Build Configuration..."), TOOLS_BUILD_PROFILE_MANAGER); @@ -6814,12 +6816,14 @@ EditorNode::EditorNode() { settings_menu->set_item_tooltip(-1, TTR("Screenshots are stored in the Editor Data/Settings Folder.")); +#ifndef ANDROID_ENABLED ED_SHORTCUT_AND_COMMAND("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KeyModifierMask::SHIFT | Key::F11); ED_SHORTCUT_OVERRIDE("editor/fullscreen_mode", "macos", KeyModifierMask::META | KeyModifierMask::CTRL | Key::F); settings_menu->add_shortcut(ED_GET_SHORTCUT("editor/fullscreen_mode"), SETTINGS_TOGGLE_FULLSCREEN); - +#endif settings_menu->add_separator(); +#ifndef ANDROID_ENABLED if (OS::get_singleton()->get_data_path() == OS::get_singleton()->get_config_path()) { // Configuration and data folders are located in the same place (Windows/MacOS). settings_menu->add_item(TTR("Open Editor Data/Settings Folder"), SETTINGS_EDITOR_DATA_FOLDER); @@ -6829,9 +6833,12 @@ EditorNode::EditorNode() { settings_menu->add_item(TTR("Open Editor Settings Folder"), SETTINGS_EDITOR_CONFIG_FOLDER); } settings_menu->add_separator(); +#endif settings_menu->add_item(TTR("Manage Editor Features..."), SETTINGS_MANAGE_FEATURE_PROFILES); +#ifndef ANDROID_ENABLED settings_menu->add_item(TTR("Manage Export Templates..."), SETTINGS_MANAGE_EXPORT_TEMPLATES); +#endif help_menu = memnew(PopupMenu); help_menu->set_name(TTR("Help")); diff --git a/editor/editor_undo_redo_manager.cpp b/editor/editor_undo_redo_manager.cpp index eca2b3143b..8c04a4d595 100644 --- a/editor/editor_undo_redo_manager.cpp +++ b/editor/editor_undo_redo_manager.cpp @@ -124,7 +124,7 @@ void EditorUndoRedoManager::create_action(const String &p_name, UndoRedo::MergeM create_action_for_history(p_name, INVALID_HISTORY, p_mode); if (p_custom_context) { - // This assigns context to pending action. + // This assigns history to pending action. get_history_for_object(p_custom_context); } } @@ -218,7 +218,10 @@ void EditorUndoRedoManager::add_undo_reference(Object *p_object) { } void EditorUndoRedoManager::commit_action(bool p_execute) { - ERR_FAIL_COND(pending_action.history_id == INVALID_HISTORY); + if (pending_action.history_id == INVALID_HISTORY) { + return; // Empty action, do nothing. + } + is_committing = true; History &history = get_or_create_history(pending_action.history_id); diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp index 2a444bb04f..bcc85570ed 100644 --- a/editor/export/editor_export_platform.cpp +++ b/editor/export/editor_export_platform.cpp @@ -1619,21 +1619,24 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags } bool EditorExportPlatform::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const { + bool valid = true; +#ifndef ANDROID_ENABLED String templates_error; - bool valid_export_configuration = has_valid_export_configuration(p_preset, templates_error, r_missing_templates); - - String project_configuration_error; - bool valid_project_configuration = has_valid_project_configuration(p_preset, project_configuration_error); + valid = valid && has_valid_export_configuration(p_preset, templates_error, r_missing_templates); if (!templates_error.is_empty()) { r_error += templates_error; } +#endif + + String project_configuration_error; + valid = valid && has_valid_project_configuration(p_preset, project_configuration_error); if (!project_configuration_error.is_empty()) { r_error += project_configuration_error; } - return valid_export_configuration && valid_project_configuration; + return valid; } EditorExportPlatform::EditorExportPlatform() { diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp index 00a0e08d3a..8c67885971 100644 --- a/editor/export/project_export.cpp +++ b/editor/export/project_export.cpp @@ -932,8 +932,10 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) { } void ProjectExportDialog::_export_all_dialog() { +#ifndef ANDROID_ENABLED export_all_dialog->show(); export_all_dialog->popup_centered(Size2(300, 80)); +#endif } void ProjectExportDialog::_export_all_dialog_action(const String &p_str) { @@ -1194,11 +1196,16 @@ ProjectExportDialog::ProjectExportDialog() { set_cancel_button_text(TTR("Close")); set_ok_button_text(TTR("Export PCK/ZIP...")); + get_ok_button()->set_disabled(true); +#ifdef ANDROID_ENABLED + export_button = memnew(Button); + export_button->hide(); +#else export_button = add_button(TTR("Export Project..."), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "export"); +#endif export_button->connect("pressed", callable_mp(this, &ProjectExportDialog::_export_project)); // Disable initially before we select a valid preset export_button->set_disabled(true); - get_ok_button()->set_disabled(true); export_all_dialog = memnew(ConfirmationDialog); add_child(export_all_dialog); @@ -1208,8 +1215,14 @@ ProjectExportDialog::ProjectExportDialog() { export_all_dialog->add_button(TTR("Debug"), true, "debug"); export_all_dialog->add_button(TTR("Release"), true, "release"); export_all_dialog->connect("custom_action", callable_mp(this, &ProjectExportDialog::_export_all_dialog_action)); +#ifdef ANDROID_ENABLED + export_all_dialog->hide(); + export_all_button = memnew(Button); + export_all_button->hide(); +#else export_all_button = add_button(TTR("Export All..."), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "export"); +#endif export_all_button->connect("pressed", callable_mp(this, &ProjectExportDialog::_export_all_dialog)); export_all_button->set_disabled(true); diff --git a/editor/icons/PreviewEnvironment.svg b/editor/icons/PreviewEnvironment.svg new file mode 100644 index 0000000000..e0b0257daf --- /dev/null +++ b/editor/icons/PreviewEnvironment.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0 -7-7zm-1.7305 2.3125c-.83125 1.5372-1.2685 3.1037-1.2695 4.6816-.64057-.11251-1.3005-.27158-1.9766-.47266a5 5 0 0 1 3.2461-4.209zm3.4629.00391a5 5 0 0 1 3.2383 4.1875c-.65187.17448-1.3077.32867-1.9727.44922-.0084-1.5627-.44294-3.1141-1.2656-4.6367zm-1.7324.0078088c1.0126 1.593 1.5 3.1425 1.5 4.6758 0 .054042-.00662.10803-.00781.16211-.96392.096801-1.9566.1103-2.9844.027344-.00163-.063192-.00781-.12632-.00781-.18945 0-1.5333.48744-3.0828 1.5-4.6758zm4.8789 5.7578a5 5 0 0 1 -3.1484 3.6055002c.57106-1.0564.95277-2.1268 1.1367-3.2051002.68204-.10905 1.3556-.23789 2.0117-.40039zm-9.7461.033203c.68377.18153 1.3555.33345 2.0098.43164.18781 1.0551002.56647 2.1026002 1.125 3.1367002a5 5 0 0 1 -3.1348-3.5684002zm6.168.55469c-.22615.9886602-.65424 1.9884002-1.3008 3.0059002-.63811-1.0042-1.0645-1.9908-1.293-2.9668002.89027.054126 1.7517.029377 2.5938-.039062z"/><path d="m8 1v2.3242c1.0126 1.593 1.5 3.1425 1.5 4.6758 0 .054042-.00662.10803-.00781.16211-.4894.049148-.98713.077552-1.4922.082031v1.4922c.43915-.0076.87287-.031628 1.3008-.066406-.22615.98866-.65424 1.9884-1.3008 3.0059v2.3242a7 7 0 0 0 7.000001-7 7 7 0 0 0 -7.000001-7zm1.7324 2.3164a5 5 0 0 1 3.2383 4.1875c-.65187.17448-1.3077.32867-1.9727.44922-.00845-1.5627-.44294-3.1141-1.2656-4.6367zm3.1465 5.7656a5 5 0 0 1 -3.1484 3.6055c.57106-1.0564.95277-2.1268 1.1367-3.2051.68204-.10905 1.3556-.23789 2.0117-.40039z"/></g></svg> diff --git a/editor/icons/PreviewSun.svg b/editor/icons/PreviewSun.svg new file mode 100644 index 0000000000..a8c652be65 --- /dev/null +++ b/editor/icons/PreviewSun.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m7 1v3h2v-3zm-2.5352 2.0508-1.4141 1.4141 1.4141 1.4141 1.4141-1.4141zm7.0703 0-1.4141 1.4141 1.4141 1.4141 1.4141-1.4141zm-3.5352 1.9492c-1.6569 0-3 1.3432-3 3s1.3431 3 3 3 3-1.3432 3-3-1.3431-3-3-3zm-7 2v2h3v-2zm11 0v2h3v-2zm-7.5352 3.1211-1.4141 1.4141 1.4141 1.4141 1.4141-1.4141zm7.0703 0-1.4141 1.4141 1.4141 1.4141 1.4141-1.4141zm-4.5352 1.8789v3h2v-3z" fill="#e0e0e0"/></svg> diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index f1e6c70549..f4b8646e18 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -907,6 +907,10 @@ void AnimationNodeBlendTreeEditor::_bind_methods() { AnimationNodeBlendTreeEditor *AnimationNodeBlendTreeEditor::singleton = nullptr; void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<AnimationNode> p_node) { + if (blend_tree.is_null()) { + return; + } + String prev_name = blend_tree->get_node_name(p_node); ERR_FAIL_COND(prev_name.is_empty()); GraphNode *gn = Object::cast_to<GraphNode>(graph->get_node(prev_name)); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 34d2cc3cd4..c8b49678d2 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -5516,8 +5516,8 @@ Dictionary Node3DEditor::get_state() const { pd["sun_color"] = sun_color->get_pick_color(); pd["sun_energy"] = sun_energy->get_value(); - pd["sun_disabled"] = sun_button->is_pressed(); - pd["environ_disabled"] = environ_button->is_pressed(); + pd["sun_enabled"] = sun_button->is_pressed(); + pd["environ_enabled"] = environ_button->is_pressed(); d["preview_sun_env"] = pd; } @@ -5648,8 +5648,8 @@ void Node3DEditor::set_state(const Dictionary &p_state) { sun_color->set_pick_color(pd["sun_color"]); sun_energy->set_value(pd["sun_energy"]); - sun_button->set_pressed(pd["sun_disabled"]); - environ_button->set_pressed(pd["environ_disabled"]); + sun_button->set_pressed(pd["sun_enabled"]); + environ_button->set_pressed(pd["environ_enabled"]); sun_environ_updating = false; @@ -5657,8 +5657,8 @@ void Node3DEditor::set_state(const Dictionary &p_state) { _update_preview_environment(); } else { _load_default_preview_settings(); - sun_button->set_pressed(false); - environ_button->set_pressed(false); + sun_button->set_pressed(true); + environ_button->set_pressed(true); _preview_settings_changed(); _update_preview_environment(); } @@ -7159,8 +7159,8 @@ void Node3DEditor::_update_theme() { view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), get_theme_icon(SNAME("Panels3Alt"), SNAME("EditorIcons"))); view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), get_theme_icon(SNAME("Panels4"), SNAME("EditorIcons"))); - sun_button->set_icon(get_theme_icon(SNAME("DirectionalLight3D"), SNAME("EditorIcons"))); - environ_button->set_icon(get_theme_icon(SNAME("WorldEnvironment"), SNAME("EditorIcons"))); + sun_button->set_icon(get_theme_icon(SNAME("PreviewSun"), SNAME("EditorIcons"))); + environ_button->set_icon(get_theme_icon(SNAME("PreviewEnvironment"), SNAME("EditorIcons"))); sun_environ_settings->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); sun_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window"))); @@ -7636,7 +7636,7 @@ void Node3DEditor::_load_default_preview_settings() { } void Node3DEditor::_update_preview_environment() { - bool disable_light = directional_light_count > 0 || sun_button->is_pressed(); + bool disable_light = directional_light_count > 0 || !sun_button->is_pressed(); sun_button->set_disabled(directional_light_count > 0); @@ -7664,7 +7664,7 @@ void Node3DEditor::_update_preview_environment() { sun_angle_altitude->set_value(-Math::rad_to_deg(sun_rotation.x)); sun_angle_azimuth->set_value(180.0 - Math::rad_to_deg(sun_rotation.y)); - bool disable_env = world_env_count > 0 || environ_button->is_pressed(); + bool disable_env = world_env_count > 0 || !environ_button->is_pressed(); environ_button->set_disabled(world_env_count > 0); @@ -7855,6 +7855,8 @@ Node3DEditor::Node3DEditor() { sun_button->set_flat(true); sun_button->connect("pressed", callable_mp(this, &Node3DEditor::_update_preview_environment), CONNECT_DEFERRED); sun_button->set_disabled(true); + // Preview is enabled by default - ensure this applies on editor startup when there is no state yet. + sun_button->set_pressed(true); main_menu_hbox->add_child(sun_button); @@ -7864,6 +7866,8 @@ Node3DEditor::Node3DEditor() { environ_button->set_flat(true); environ_button->connect("pressed", callable_mp(this, &Node3DEditor::_update_preview_environment), CONNECT_DEFERRED); environ_button->set_disabled(true); + // Preview is enabled by default - ensure this applies on editor startup when there is no state yet. + environ_button->set_pressed(true); main_menu_hbox->add_child(environ_button); diff --git a/editor/plugins/shader_editor_plugin.h b/editor/plugins/shader_editor_plugin.h index afd38ef71a..f48b2fc70e 100644 --- a/editor/plugins/shader_editor_plugin.h +++ b/editor/plugins/shader_editor_plugin.h @@ -115,8 +115,8 @@ public: ShaderTextEditor(); }; -class ShaderEditor : public PanelContainer { - GDCLASS(ShaderEditor, PanelContainer); +class ShaderEditor : public MarginContainer { + GDCLASS(ShaderEditor, MarginContainer); enum { EDIT_UNDO, diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp index a91f22ccd0..79230891f1 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -3677,6 +3677,7 @@ void TileMapEditor::_update_layers_selection() { tile_map_layer = -1; } tile_map->set_selected_layer(toggle_highlight_selected_layer_button->is_pressed() ? tile_map_layer : -1); + tileset_changed_needs_update = false; // Update is not needed here and actually causes problems. layers_selection_button->clear(); if (tile_map->get_layers_count() > 0) { diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index 761140b2d5..336ce9e4c8 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -1124,6 +1124,8 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { set_up_password->connect(SNAME("text_changed"), callable_mp(this, &VersionControlEditorPlugin::_update_set_up_warning)); set_up_password_input->add_child(set_up_password); + const String home_dir = OS::get_singleton()->has_environment("HOME") ? OS::get_singleton()->get_environment("HOME") : OS::get_singleton()->get_system_dir(OS::SYSTEM_DIR_DOCUMENTS); + HBoxContainer *set_up_ssh_public_key_input = memnew(HBoxContainer); set_up_ssh_public_key_input->set_h_size_flags(Control::SIZE_EXPAND_FILL); set_up_settings_vbc->add_child(set_up_ssh_public_key_input); @@ -1147,10 +1149,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { set_up_ssh_public_key_file_dialog->set_access(FileDialog::ACCESS_FILESYSTEM); set_up_ssh_public_key_file_dialog->set_file_mode(FileDialog::FILE_MODE_OPEN_FILE); set_up_ssh_public_key_file_dialog->set_show_hidden_files(true); - // TODO: Make this start at the user's home folder - Ref<DirAccess> d = DirAccess::open(OS::get_singleton()->get_system_dir(OS::SYSTEM_DIR_DOCUMENTS)); - d->change_dir("../"); - set_up_ssh_public_key_file_dialog->set_current_dir(d->get_current_dir()); + set_up_ssh_public_key_file_dialog->set_current_dir(home_dir); set_up_ssh_public_key_file_dialog->connect(SNAME("file_selected"), callable_mp(this, &VersionControlEditorPlugin::_ssh_public_key_selected)); set_up_ssh_public_key_input_hbc->add_child(set_up_ssh_public_key_file_dialog); @@ -1183,8 +1182,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { set_up_ssh_private_key_file_dialog->set_access(FileDialog::ACCESS_FILESYSTEM); set_up_ssh_private_key_file_dialog->set_file_mode(FileDialog::FILE_MODE_OPEN_FILE); set_up_ssh_private_key_file_dialog->set_show_hidden_files(true); - // TODO: Make this start at the user's home folder - set_up_ssh_private_key_file_dialog->set_current_dir(d->get_current_dir()); + set_up_ssh_private_key_file_dialog->set_current_dir(home_dir); set_up_ssh_private_key_file_dialog->connect("file_selected", callable_mp(this, &VersionControlEditorPlugin::_ssh_private_key_selected)); set_up_ssh_private_key_input_hbc->add_child(set_up_ssh_private_key_file_dialog); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 2af8da02a3..ee8148f00a 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -5198,9 +5198,9 @@ VisualShaderEditor::VisualShaderEditor() { add_options.push_back(AddOption("Tangent", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "tangent", "TANGENT"), { "tangent" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("Vertex", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "vertex", "VERTEX"), { "vertex" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("View", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_fragment_and_light_shader_modes, "view", "VIEW"), { "view" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); - add_options.push_back(AddOption("ViewIndex", "Input/Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "view_index", "VIEW_INDEX"), { "view_index" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); - add_options.push_back(AddOption("ViewMonoLeft", "Input/Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "view_mono_left", "VIEW_MONO_LEFT"), { "view_mono_left" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); - add_options.push_back(AddOption("ViewRight", "Input/Vertex", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "view_right", "VIEW_RIGHT"), { "view_right" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); + add_options.push_back(AddOption("ViewIndex", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "view_index", "VIEW_INDEX"), { "view_index" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); + add_options.push_back(AddOption("ViewMonoLeft", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "view_mono_left", "VIEW_MONO_LEFT"), { "view_mono_left" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); + add_options.push_back(AddOption("ViewRight", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "view_right", "VIEW_RIGHT"), { "view_right" }, VisualShaderNode::PORT_TYPE_SCALAR_INT, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("NodePositionWorld", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "node_position_world", "NODE_POSITION_WORLD"), { "node_position_world" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("CameraPositionWorld", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "camera_position_world", "CAMERA_POSITION_WORLD"), { "camera_position_world" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); add_options.push_back(AddOption("CameraDirectionWorld", "Input/Fragment", "VisualShaderNodeInput", vformat(input_param_for_vertex_and_fragment_shader_modes, "camera_direction_world", "CAMERA_DIRECTION_WORLD"), { "camera_direction_world" }, VisualShaderNode::PORT_TYPE_VECTOR_3D, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index a644babfc2..f11874a994 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -59,6 +59,8 @@ #include "servers/navigation_server_3d.h" #include "servers/physics_server_2d.h" +constexpr int GODOT4_CONFIG_VERSION = 5; + class ProjectDialog : public ConfirmationDialog { GDCLASS(ProjectDialog, ConfirmationDialog); @@ -1065,6 +1067,7 @@ public: int refresh_project(const String &dir_path); void add_project(const String &dir_path, bool favorite); void save_config(); + void set_project_version(const String &p_project_path, int version); private: static void _bind_methods(); @@ -1673,6 +1676,15 @@ void ProjectList::save_config() { _config.save(_config_path); } +void ProjectList::set_project_version(const String &p_project_path, int p_version) { + for (ProjectList::Item &E : _projects) { + if (E.path == p_project_path) { + E.version = p_version; + break; + } + } +} + int ProjectList::get_project_count() const { return _projects.size(); } @@ -2170,6 +2182,9 @@ void ProjectManager::_open_selected_projects_ask() { Label *ask_update_label = ask_update_settings->get_label(); ask_update_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_LEFT); // Reset in case of previous center align. + full_convert_button->hide(); + + ask_update_settings->get_ok_button()->set_text("OK"); // Check if the config_version property was empty or 0 if (config_version == 0) { @@ -2179,7 +2194,11 @@ void ProjectManager::_open_selected_projects_ask() { } // 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)); + if (config_version == GODOT4_CONFIG_VERSION - 1 && ProjectSettings::CONFIG_VERSION == GODOT4_CONFIG_VERSION) { // Conversion from Godot 3 to 4. + full_convert_button->show(); + } + 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? You can also convert the entire project (recommended if you are upgrading).\nWarning: You won't be able to open the project with previous versions of the engine anymore."), conf)); + ask_update_settings->get_ok_button()->set_text(TTR("Convert project.godot")); ask_update_settings->popup_centered(); return; } @@ -2223,6 +2242,32 @@ void ProjectManager::_open_selected_projects_ask() { _open_selected_projects(); } +void ProjectManager::_perform_full_project_conversion() { + Vector<ProjectList::Item> selected_list = _project_list->get_selected_projects(); + if (selected_list.is_empty()) { + return; + } + + const String &path = selected_list[0].path; + + print_line("Converting project: " + path); + + Ref<ConfigFile> cf; + cf.instantiate(); + cf->load(path.path_join("project.godot")); + cf->set_value("", "config_version", GODOT4_CONFIG_VERSION); + cf->save(path.path_join("project.godot")); + _project_list->set_project_version(path, GODOT4_CONFIG_VERSION); + + List<String> args; + args.push_back("--path"); + args.push_back(path); + args.push_back("--convert-3to4"); + + Error err = OS::get_singleton()->create_instance(args); + ERR_FAIL_COND(err); +} + void ProjectManager::_run_project_confirm() { Vector<ProjectList::Item> selected_list = _project_list->get_selected_projects(); @@ -2825,8 +2870,20 @@ ProjectManager::ProjectManager() { ask_update_settings = memnew(ConfirmationDialog); ask_update_settings->get_ok_button()->connect("pressed", callable_mp(this, &ProjectManager::_confirm_update_settings)); + full_convert_button = ask_update_settings->add_button("Perform Full Project Conversion", false); add_child(ask_update_settings); + ask_full_convert_dialog = memnew(ConfirmationDialog); + ask_full_convert_dialog->set_autowrap(true); + ask_full_convert_dialog->set_text(TTR(R"(This option will perform full project conversion, updating scenes and scripts from Godot 3.x to work in Godot 4.0. Note that this is a best-effort conversion, i.e. it makes upgrading the project easier, but it will not open out-of-the-box and will still require manual adjustments. + +IMPORTANT: Make sure to backup your project before converting, as this operation makes it impossible to open in older versions of Godot.)")); + ask_full_convert_dialog->connect("confirmed", callable_mp(this, &ProjectManager::_perform_full_project_conversion)); + add_child(ask_full_convert_dialog); + + full_convert_button->connect("pressed", callable_mp((Window *)ask_update_settings, &ConfirmationDialog::hide)); + full_convert_button->connect("pressed", callable_mp((Window *)ask_full_convert_dialog, &ConfirmationDialog::popup_centered_ratio).bind(0.2)); + npdialog = memnew(ProjectDialog); npdialog->connect("projects_updated", callable_mp(this, &ProjectManager::_on_projects_updated)); npdialog->connect("project_created", callable_mp(this, &ProjectManager::_on_project_created)); diff --git a/editor/project_manager.h b/editor/project_manager.h index 10bf25c048..0831a63e68 100644 --- a/editor/project_manager.h +++ b/editor/project_manager.h @@ -87,6 +87,7 @@ class ProjectManager : public Control { ConfirmationDialog *multi_open_ask = nullptr; ConfirmationDialog *multi_run_ask = nullptr; ConfirmationDialog *multi_scan_ask = nullptr; + ConfirmationDialog *ask_full_convert_dialog = nullptr; ConfirmationDialog *ask_update_settings = nullptr; ConfirmationDialog *open_templates = nullptr; EditorAbout *about = nullptr; @@ -97,6 +98,7 @@ class ProjectManager : public Control { AcceptDialog *dialog_error = nullptr; ProjectDialog *npdialog = nullptr; + Button *full_convert_button = nullptr; OptionButton *language_btn = nullptr; LinkButton *version_btn = nullptr; @@ -106,6 +108,7 @@ class ProjectManager : public Control { void _run_project_confirm(); void _open_selected_projects(); void _open_selected_projects_ask(); + void _perform_full_project_conversion(); void _import_project(); void _new_project(); void _rename_project(); |