From 793810938e7df17be416cf1988ab581a1c66a8ef Mon Sep 17 00:00:00 2001 From: Michael Alexsander Date: Sat, 25 Jun 2022 16:30:11 -0300 Subject: [PATCH] Clean and fix the Movie Maker button --- editor/editor_node.cpp | 38 ++++++++------------------ editor/editor_node.h | 2 -- editor/icons/MainMovieWriteEnabled.svg | 1 - 3 files changed, 12 insertions(+), 29 deletions(-) delete mode 100644 editor/icons/MainMovieWriteEnabled.svg diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 93caf7944c9..e3d0f42426a 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2347,6 +2347,13 @@ void EditorNode::_run(bool p_current, const String &p_custom) { return; } + play_button->set_pressed(false); + play_button->set_icon(gui_base->get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons"))); + play_scene_button->set_pressed(false); + play_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayScene"), SNAME("EditorIcons"))); + play_custom_scene_button->set_pressed(false); + play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayCustom"), SNAME("EditorIcons"))); + String write_movie_file; if (write_movie_button->is_pressed()) { if (p_current && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->has_meta("movie_file")) { @@ -2361,13 +2368,6 @@ void EditorNode::_run(bool p_current, const String &p_custom) { } } - play_button->set_pressed(false); - play_button->set_icon(gui_base->get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons"))); - play_scene_button->set_pressed(false); - play_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayScene"), SNAME("EditorIcons"))); - play_custom_scene_button->set_pressed(false); - play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayCustom"), SNAME("EditorIcons"))); - String run_filename; if (p_current || (editor_data.get_edited_scene_root() && !p_custom.is_empty() && p_custom == editor_data.get_edited_scene_root()->get_scene_file_path())) { @@ -2807,9 +2807,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { case RUN_SETTINGS: { project_settings_editor->popup_project_settings(); } break; - case RUN_WRITE_MOVIE: { - _update_write_movie_icon(); - } break; case FILE_INSTALL_ANDROID_SOURCE: { if (p_confirmed) { export_template_manager->install_android_template(); @@ -4971,14 +4968,6 @@ String EditorNode::get_run_playing_scene() const { return run_filename; } -void EditorNode::_update_write_movie_icon() { - if (write_movie_button->is_pressed()) { - write_movie_button->set_icon(gui_base->get_theme_icon(SNAME("MainMovieWriteEnabled"), SNAME("EditorIcons"))); - } else { - write_movie_button->set_icon(gui_base->get_theme_icon(SNAME("MainMovieWrite"), SNAME("EditorIcons"))); - } -} - void EditorNode::_immediate_dialog_confirmed() { immediate_dialog_confirmed = true; } @@ -6741,15 +6730,12 @@ EditorNode::EditorNode() { write_movie_button->set_pressed(false); write_movie_button->set_icon(gui_base->get_theme_icon(SNAME("MainMovieWrite"), SNAME("EditorIcons"))); write_movie_button->set_focus_mode(Control::FOCUS_NONE); - write_movie_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_WRITE_MOVIE)); write_movie_button->set_tooltip(TTR("Enable Movie Maker mode.\nThe project will run at stable FPS and the visual and audio output will be recorded to a video file.")); - // Restore these values to something more useful so it ignores the theme - write_movie_button->add_theme_color_override("icon_normal_color", Color(1, 1, 1, 0.4)); - write_movie_button->add_theme_color_override("icon_pressed_color", Color(1, 1, 1, 1)); - write_movie_button->add_theme_color_override("icon_hover_color", Color(1.2, 1.2, 1.2, 0.4)); - write_movie_button->add_theme_color_override("icon_hover_pressed_color", Color(1.2, 1.2, 1.2, 1)); - write_movie_button->add_theme_color_override("icon_focus_color", Color(1, 1, 1, 1)); - write_movie_button->add_theme_color_override("icon_disabled_color", Color(1, 1, 1, 0.4)); + + // This button behaves differently, so color it as such. + write_movie_button->add_theme_color_override("icon_normal_color", Color(1, 1, 1, 0.7)); + write_movie_button->add_theme_color_override("icon_pressed_color", gui_base->get_theme_color(SNAME("error_color"), SNAME("Editor"))); + write_movie_button->add_theme_color_override("icon_hover_color", Color(1, 1, 1, 0.9)); HBoxContainer *right_menu_hb = memnew(HBoxContainer); menu_hb->add_child(right_menu_hb); diff --git a/editor/editor_node.h b/editor/editor_node.h index 89f80baeb9c..11099abede1 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -173,7 +173,6 @@ private: RUN_PLAY_CUSTOM_SCENE, RUN_SETTINGS, RUN_USER_DATA_FOLDER, - RUN_WRITE_MOVIE, RELOAD_CURRENT_PROJECT, RUN_PROJECT_MANAGER, RUN_VCS_METADATA, @@ -669,7 +668,6 @@ private: void _pick_main_scene_custom_action(const String &p_custom_action_name); void _immediate_dialog_confirmed(); - void _update_write_movie_icon(); void _select_default_main_screen_plugin(); void _bottom_panel_switch(bool p_enable, int p_idx); diff --git a/editor/icons/MainMovieWriteEnabled.svg b/editor/icons/MainMovieWriteEnabled.svg deleted file mode 100644 index b12ea38bed7..00000000000 --- a/editor/icons/MainMovieWriteEnabled.svg +++ /dev/null @@ -1 +0,0 @@ -