diff options
-rw-r--r-- | editor/editor_node.cpp | 51 | ||||
-rw-r--r-- | editor/editor_node.h | 10 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 22 |
3 files changed, 66 insertions, 17 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 6b68c4127f..39b8601223 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -784,6 +784,14 @@ void EditorNode::_notification(int p_what) { _build_icon_type_cache(); + if (write_movie_button->is_pressed()) { + launch_pad->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("LaunchPadMovieMode"), SNAME("EditorStyles"))); + write_movie_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("MovieWriterButtonPressed"), SNAME("EditorStyles"))); + } else { + launch_pad->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("LaunchPadNormal"), SNAME("EditorStyles"))); + write_movie_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("MovieWriterButtonNormal"), SNAME("EditorStyles"))); + } + play_button->set_icon(gui_base->get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons"))); play_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayScene"), SNAME("EditorIcons"))); play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayCustom"), SNAME("EditorIcons"))); @@ -2405,6 +2413,16 @@ void EditorNode::_edit_current(bool p_skip_foreign) { InspectorDock::get_singleton()->update(current_obj); } +void EditorNode::_write_movie_toggled(bool p_enabled) { + if (p_enabled) { + launch_pad->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("LaunchPadMovieMode"), SNAME("EditorStyles"))); + write_movie_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("MovieWriterButtonPressed"), SNAME("EditorStyles"))); + } else { + launch_pad->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("LaunchPadNormal"), SNAME("EditorStyles"))); + write_movie_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("MovieWriterButtonNormal"), SNAME("EditorStyles"))); + } +} + void EditorNode::_run(bool p_current, const String &p_custom) { if (editor_run.get_status() == EditorRun::STATUS_PLAY) { play_button->set_pressed(!_playing_edited); @@ -6825,12 +6843,16 @@ EditorNode::EditorNode() { right_spacer->set_mouse_filter(Control::MOUSE_FILTER_PASS); menu_hb->add_child(right_spacer); - HBoxContainer *play_hb = memnew(HBoxContainer); - menu_hb->add_child(play_hb); + launch_pad = memnew(PanelContainer); + launch_pad->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("LaunchPadNormal"), SNAME("EditorStyles"))); + menu_hb->add_child(launch_pad); + + HBoxContainer *launch_pad_hb = memnew(HBoxContainer); + launch_pad->add_child(launch_pad_hb); play_button = memnew(Button); play_button->set_flat(true); - play_hb->add_child(play_button); + launch_pad_hb->add_child(play_button); play_button->set_toggle_mode(true); play_button->set_focus_mode(Control::FOCUS_NONE); play_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option).bind(RUN_PLAY)); @@ -6846,7 +6868,7 @@ EditorNode::EditorNode() { pause_button->set_focus_mode(Control::FOCUS_NONE); pause_button->set_tooltip_text(TTR("Pause the scene execution for debugging.")); pause_button->set_disabled(true); - play_hb->add_child(pause_button); + launch_pad_hb->add_child(pause_button); ED_SHORTCUT("editor/pause_scene", TTR("Pause Scene"), Key::F7); ED_SHORTCUT_OVERRIDE("editor/pause_scene", "macos", KeyModifierMask::CMD | KeyModifierMask::CTRL | Key::Y); @@ -6854,7 +6876,7 @@ EditorNode::EditorNode() { stop_button = memnew(Button); stop_button->set_flat(true); - play_hb->add_child(stop_button); + launch_pad_hb->add_child(stop_button); stop_button->set_focus_mode(Control::FOCUS_NONE); stop_button->set_icon(gui_base->get_theme_icon(SNAME("Stop"), SNAME("EditorIcons"))); stop_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option).bind(RUN_STOP)); @@ -6866,12 +6888,12 @@ EditorNode::EditorNode() { stop_button->set_shortcut(ED_GET_SHORTCUT("editor/stop")); run_native = memnew(EditorRunNative); - play_hb->add_child(run_native); + launch_pad_hb->add_child(run_native); run_native->connect("native_run", callable_mp(this, &EditorNode::_run_native)); play_scene_button = memnew(Button); play_scene_button->set_flat(true); - play_hb->add_child(play_scene_button); + launch_pad_hb->add_child(play_scene_button); play_scene_button->set_toggle_mode(true); play_scene_button->set_focus_mode(Control::FOCUS_NONE); play_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option).bind(RUN_PLAY_SCENE)); @@ -6882,7 +6904,7 @@ EditorNode::EditorNode() { play_custom_scene_button = memnew(Button); play_custom_scene_button->set_flat(true); - play_hb->add_child(play_custom_scene_button); + launch_pad_hb->add_child(play_custom_scene_button); play_custom_scene_button->set_toggle_mode(true); play_custom_scene_button->set_focus_mode(Control::FOCUS_NONE); play_custom_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option).bind(RUN_PLAY_CUSTOM_SCENE)); @@ -6893,18 +6915,23 @@ EditorNode::EditorNode() { ED_SHORTCUT_OVERRIDE("editor/play_custom_scene", "macos", KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::R); play_custom_scene_button->set_shortcut(ED_GET_SHORTCUT("editor/play_custom_scene")); + write_movie_panel = memnew(PanelContainer); + write_movie_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("MovieWriterButtonNormal"), SNAME("EditorStyles"))); + launch_pad_hb->add_child(write_movie_panel); + write_movie_button = memnew(Button); write_movie_button->set_flat(true); write_movie_button->set_toggle_mode(true); - play_hb->add_child(write_movie_button); + write_movie_panel->add_child(write_movie_button); 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("toggled", callable_mp(this, &EditorNode::_write_movie_toggled)); write_movie_button->set_tooltip_text(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.")); // 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_pressed_color", Color(0, 0, 0, 0.84)); write_movie_button->add_theme_color_override("icon_hover_color", Color(1, 1, 1, 0.9)); HBoxContainer *right_menu_hb = memnew(HBoxContainer); @@ -7489,9 +7516,9 @@ EditorNode::EditorNode() { screenshot_timer->set_owner(get_owner()); // Adjust spacers to center 2D / 3D / Script buttons. - int max_w = MAX(play_hb->get_minimum_size().x + right_menu_hb->get_minimum_size().x, main_menu->get_minimum_size().x); + int max_w = MAX(launch_pad_hb->get_minimum_size().x + right_menu_hb->get_minimum_size().x, main_menu->get_minimum_size().x); left_spacer->set_custom_minimum_size(Size2(MAX(0, max_w - main_menu->get_minimum_size().x), 0)); - right_spacer->set_custom_minimum_size(Size2(MAX(0, max_w - play_hb->get_minimum_size().x - right_menu_hb->get_minimum_size().x), 0)); + right_spacer->set_custom_minimum_size(Size2(MAX(0, max_w - launch_pad_hb->get_minimum_size().x - right_menu_hb->get_minimum_size().x), 0)); // Extend menu bar to window title. if (can_expand) { diff --git a/editor/editor_node.h b/editor/editor_node.h index 792d2fc879..fee9e2876b 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -335,15 +335,17 @@ private: PopupMenu *export_as_menu = nullptr; Button *export_button = nullptr; Button *prev_scene = nullptr; + Button *search_button = nullptr; + TextureProgressBar *audio_vu = nullptr; + + PanelContainer *launch_pad = nullptr; Button *play_button = nullptr; Button *pause_button = nullptr; Button *stop_button = nullptr; - Button *run_settings_button = nullptr; Button *play_scene_button = nullptr; Button *play_custom_scene_button = nullptr; - Button *search_button = nullptr; + PanelContainer *write_movie_panel = nullptr; Button *write_movie_button = nullptr; - TextureProgressBar *audio_vu = nullptr; Timer *screenshot_timer = nullptr; @@ -581,6 +583,8 @@ private: void _quick_run(); void _open_command_palette(); + void _write_movie_toggled(bool p_enabled); + void _run(bool p_current = false, const String &p_custom = ""); void _run_native(const Ref<EditorExportPreset> &p_preset); void _reset_play_buttons(); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index d20caef51c..f8f2d2252f 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -740,8 +740,26 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("ScriptEditorPanel", "EditorStyles", make_empty_stylebox(default_margin_size, 0, default_margin_size, default_margin_size)); theme->set_stylebox("ScriptEditor", "EditorStyles", make_empty_stylebox(0, 0, 0, 0)); - // Play button group - theme->set_stylebox("PlayButtonPanel", "EditorStyles", style_empty); + // Launch Pad and Play buttons + Ref<StyleBoxFlat> style_launch_pad = make_flat_stylebox(dark_color_1, 2 * EDSCALE, 0, 2 * EDSCALE, 0, corner_width); + style_launch_pad->set_corner_radius_all(corner_radius * EDSCALE); + theme->set_stylebox("LaunchPadNormal", "EditorStyles", style_launch_pad); + Ref<StyleBoxFlat> style_launch_pad_movie = style_launch_pad->duplicate(); + style_launch_pad_movie->set_bg_color(accent_color * Color(1, 1, 1, 0.1)); + style_launch_pad_movie->set_border_color(accent_color); + style_launch_pad_movie->set_border_width_all(Math::round(2 * EDSCALE)); + theme->set_stylebox("LaunchPadMovieMode", "EditorStyles", style_launch_pad_movie); + + theme->set_stylebox("MovieWriterButtonNormal", "EditorStyles", make_empty_stylebox(0, 0, 0, 0)); + Ref<StyleBoxFlat> style_write_movie_button = style_widget_pressed->duplicate(); + style_write_movie_button->set_bg_color(accent_color); + style_write_movie_button->set_corner_radius_all(corner_radius * EDSCALE); + style_write_movie_button->set_default_margin(SIDE_TOP, 0); + style_write_movie_button->set_default_margin(SIDE_BOTTOM, 0); + style_write_movie_button->set_default_margin(SIDE_LEFT, 0); + style_write_movie_button->set_default_margin(SIDE_RIGHT, 0); + style_write_movie_button->set_expand_margin_size(SIDE_RIGHT, 2 * EDSCALE); + theme->set_stylebox("MovieWriterButtonPressed", "EditorStyles", style_write_movie_button); theme->set_stylebox("normal", "MenuButton", style_menu); theme->set_stylebox("hover", "MenuButton", style_widget_hover); |