diff options
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 83 |
1 files changed, 51 insertions, 32 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index dddd7345c8..04944a9143 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -47,6 +47,7 @@ #include "editor/editor_string_names.h" #include "main/main.h" #include "scene/3d/bone_attachment_3d.h" +#include "scene/animation/animation_tree.h" #include "scene/gui/color_picker.h" #include "scene/gui/dialogs.h" #include "scene/gui/file_dialog.h" @@ -514,8 +515,9 @@ void EditorNode::_update_theme(bool p_skip_creation) { scene_root_parent->add_theme_style_override("panel", theme->get_stylebox(SNAME("Content"), EditorStringName(EditorStyles))); bottom_panel->add_theme_style_override("panel", theme->get_stylebox(SNAME("BottomPanel"), EditorStringName(EditorStyles))); - main_menu->add_theme_style_override("hover", theme->get_stylebox(SNAME("MenuHover"), EditorStringName(EditorStyles))); + main_menu->add_theme_style_override("pressed", theme->get_stylebox(SNAME("MenuTransparent"), EditorStringName(EditorStyles))); distraction_free->set_icon(theme->get_icon(SNAME("DistractionFree"), EditorStringName(EditorIcons))); + distraction_free->add_theme_style_override("pressed", theme->get_stylebox(SNAME("MenuTransparent"), EditorStringName(EditorStyles))); bottom_panel_raise->set_icon(theme->get_icon(SNAME("ExpandBottomDock"), EditorStringName(EditorIcons))); help_menu->set_item_icon(help_menu->get_item_index(HELP_SEARCH), theme->get_icon(SNAME("HelpSearch"), EditorStringName(EditorIcons))); @@ -527,6 +529,11 @@ void EditorNode::_update_theme(bool p_skip_creation) { bottom_panel->add_theme_style_override("panel", theme->get_stylebox(SNAME("BottomPanelDebuggerOverride"), EditorStringName(EditorStyles))); } + for (int i = 0; i < bottom_panel_items.size(); i++) { + bottom_panel_items.write[i].button->add_theme_style_override("pressed", theme->get_stylebox(SNAME("MenuTransparent"), EditorStringName(EditorStyles))); + bottom_panel_items.write[i].button->add_theme_style_override("hover_pressed", theme->get_stylebox(SNAME("MenuHover"), EditorStringName(EditorStyles))); + } + for (int i = 0; i < main_editor_buttons.size(); i++) { Button *tb = main_editor_buttons[i]; EditorPlugin *p_editor = editor_table[i]; @@ -760,36 +767,43 @@ void EditorNode::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - _update_vsync_mode(); - FileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files")); - EditorFileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files")); - EditorFileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EDITOR_GET("filesystem/file_dialog/display_mode").operator int()); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("filesystem/file_dialog")) { + FileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files")); + EditorFileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files")); + EditorFileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EDITOR_GET("filesystem/file_dialog/display_mode").operator int()); + } if (EditorThemeManager::is_generated_theme_outdated()) { _update_theme(); + _build_icon_type_cache(); + recent_scenes->reset_size(); } - scene_tabs->update_scene_tabs(); - recent_scenes->reset_size(); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/scene_tabs")) { + scene_tabs->update_scene_tabs(); + } - _build_icon_type_cache(); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("docks/filesystem")) { + HashSet<String> updated_textfile_extensions; + bool extensions_match = true; + const Vector<String> textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false); + for (const String &E : textfile_ext) { + updated_textfile_extensions.insert(E); + if (extensions_match && !textfile_extensions.has(E)) { + extensions_match = false; + } + } - HashSet<String> updated_textfile_extensions; - bool extensions_match = true; - const Vector<String> textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false); - for (const String &E : textfile_ext) { - updated_textfile_extensions.insert(E); - if (extensions_match && !textfile_extensions.has(E)) { - extensions_match = false; + if (!extensions_match || updated_textfile_extensions.size() < textfile_extensions.size()) { + textfile_extensions = updated_textfile_extensions; + EditorFileSystem::get_singleton()->scan(); } } - if (!extensions_match || updated_textfile_extensions.size() < textfile_extensions.size()) { - textfile_extensions = updated_textfile_extensions; - EditorFileSystem::get_singleton()->scan(); + if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor")) { + _update_update_spinner(); + _update_vsync_mode(); } - - _update_update_spinner(); } break; } } @@ -1739,7 +1753,14 @@ int EditorNode::_save_external_resources() { static void _reset_animation_mixers(Node *p_node, List<Pair<AnimationMixer *, Ref<AnimatedValuesBackup>>> *r_anim_backups) { for (int i = 0; i < p_node->get_child_count(); i++) { AnimationMixer *mixer = Object::cast_to<AnimationMixer>(p_node->get_child(i)); - if (mixer && mixer->is_reset_on_save_enabled() && mixer->can_apply_reset()) { + if (mixer && mixer->is_active() && mixer->is_reset_on_save_enabled() && mixer->can_apply_reset()) { + AnimationTree *tree = Object::cast_to<AnimationTree>(p_node->get_child(i)); + if (tree) { + AnimationPlayer *player = Object::cast_to<AnimationPlayer>(tree->get_node_or_null(tree->get_animation_player())); + if (player && player->is_active() && player->is_reset_on_save_enabled() && player->can_apply_reset()) { + continue; // Avoid to process reset/restore many times. + } + } Ref<AnimatedValuesBackup> backup = mixer->apply_reset(); if (backup.is_valid()) { Pair<AnimationMixer *, Ref<AnimatedValuesBackup>> pair; @@ -3331,7 +3352,6 @@ void EditorNode::select_editor_by_name(const String &p_name) { void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed) { if (p_editor->has_main_screen()) { Button *tb = memnew(Button); - tb->set_flat(true); tb->set_toggle_mode(true); tb->set_theme_type_variation("MainScreenButton"); tb->set_name(p_editor->get_name()); @@ -5077,8 +5097,8 @@ void EditorNode::_update_layouts_menu() { overridden_default_layout = -1; editor_layouts->reset_size(); - editor_layouts->add_shortcut(ED_SHORTCUT("layout/save", TTR("Save Layout")), SETTINGS_LAYOUT_SAVE); - editor_layouts->add_shortcut(ED_SHORTCUT("layout/delete", TTR("Delete Layout")), SETTINGS_LAYOUT_DELETE); + editor_layouts->add_shortcut(ED_SHORTCUT("layout/save", TTR("Save Layout...")), SETTINGS_LAYOUT_SAVE); + editor_layouts->add_shortcut(ED_SHORTCUT("layout/delete", TTR("Delete Layout...")), SETTINGS_LAYOUT_DELETE); editor_layouts->add_separator(); editor_layouts->add_shortcut(ED_SHORTCUT("layout/default", TTR("Default")), SETTINGS_LAYOUT_DEFAULT); @@ -5226,7 +5246,7 @@ void EditorNode::_scene_tab_closed(int p_tab) { Button *EditorNode::add_bottom_panel_item(String p_text, Control *p_item, bool p_at_front) { Button *tb = memnew(Button); - tb->set_flat(true); + tb->set_theme_type_variation("FlatMenuButton"); tb->connect("toggled", callable_mp(this, &EditorNode::_bottom_panel_switch_by_control).bind(p_item)); tb->set_drag_forwarding(Callable(), callable_mp(this, &EditorNode::_bottom_panel_drag_hover).bind(tb, p_item), Callable()); tb->set_text(p_text); @@ -6671,7 +6691,7 @@ EditorNode::EditorNode() { scene_tabs->connect("tab_closed", callable_mp(this, &EditorNode::_scene_tab_closed)); distraction_free = memnew(Button); - distraction_free->set_flat(true); + distraction_free->set_theme_type_variation("FlatMenuButton"); ED_SHORTCUT_AND_COMMAND("editor/distraction_free_mode", TTR("Distraction Free Mode"), KeyModifierMask::CTRL | KeyModifierMask::SHIFT | Key::F11); ED_SHORTCUT_OVERRIDE("editor/distraction_free_mode", "macos", KeyModifierMask::META | KeyModifierMask::CTRL | Key::D); distraction_free->set_shortcut(ED_GET_SHORTCUT("editor/distraction_free_mode")); @@ -6711,9 +6731,7 @@ EditorNode::EditorNode() { main_menu = memnew(MenuBar); title_bar->add_child(main_menu); - - main_menu->add_theme_style_override("hover", theme->get_stylebox(SNAME("MenuHover"), EditorStringName(EditorStyles))); - main_menu->set_flat(true); + main_menu->set_theme_type_variation("FlatMenuButton"); main_menu->set_start_index(0); // Main menu, add to the start of global menu. main_menu->set_prefer_global_menu(global_menu); main_menu->set_switch_on_hover(true); @@ -6967,7 +6985,7 @@ EditorNode::EditorNode() { help_menu->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option)); - ED_SHORTCUT_AND_COMMAND("editor/editor_help", TTR("Search Help"), Key::F1); + ED_SHORTCUT_AND_COMMAND("editor/editor_help", TTR("Search Help..."), Key::F1); ED_SHORTCUT_OVERRIDE("editor/editor_help", "macos", KeyModifierMask::ALT | Key::SPACE); help_menu->add_icon_shortcut(theme->get_icon(SNAME("HelpSearch"), EditorStringName(EditorIcons)), ED_GET_SHORTCUT("editor/editor_help"), HELP_SEARCH); help_menu->add_separator(); @@ -6983,7 +7001,7 @@ EditorNode::EditorNode() { help_menu->add_separator(); if (!global_menu || !OS::get_singleton()->has_feature("macos")) { // On macOS "Quit" and "About" options are in the "app" menu. - help_menu->add_icon_shortcut(theme->get_icon(SNAME("Godot"), EditorStringName(EditorIcons)), ED_SHORTCUT_AND_COMMAND("editor/about", TTR("About Godot")), HELP_ABOUT); + help_menu->add_icon_shortcut(theme->get_icon(SNAME("Godot"), EditorStringName(EditorIcons)), ED_SHORTCUT_AND_COMMAND("editor/about", TTR("About Godot...")), HELP_ABOUT); } help_menu->add_icon_shortcut(theme->get_icon(SNAME("Heart"), EditorStringName(EditorIcons)), ED_SHORTCUT_AND_COMMAND("editor/support_development", TTR("Support Godot Development")), HELP_SUPPORT_GODOT_DEVELOPMENT); @@ -7179,7 +7197,8 @@ EditorNode::EditorNode() { bottom_panel_raise = memnew(Button); bottom_panel_hb->add_child(bottom_panel_raise); bottom_panel_raise->hide(); - bottom_panel_raise->set_flat(true); + bottom_panel_raise->set_flat(false); + bottom_panel_raise->set_theme_type_variation("FlatMenuButton"); bottom_panel_raise->set_toggle_mode(true); bottom_panel_raise->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/bottom_panel_expand", TTR("Expand Bottom Panel"), KeyModifierMask::SHIFT | Key::F12)); bottom_panel_raise->connect("toggled", callable_mp(this, &EditorNode::_bottom_panel_raise_toggled)); |