diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-07-31 22:13:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-31 22:13:21 +0200 |
commit | 007b877cb73cd6b60c86eb7b02d4e6f1cee409ea (patch) | |
tree | da6773440b707825e7b0f29cbe304814bfc743bf /editor | |
parent | 6acbcf7a8657811f45a1f17a1ed8906b271c6417 (diff) | |
parent | 4013d03c4517fcbc6a1e411fac91674b65047154 (diff) |
Merge pull request #51114 from pycbouh/editor-fix-audio-bus-colors
Fix theming in the audio bus editor
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_audio_buses.cpp | 41 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 5 |
2 files changed, 16 insertions, 30 deletions
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 4a19f007d4..5209ee06c6 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -62,7 +62,8 @@ void EditorAudioBus::_update_visible_channels() { void EditorAudioBus::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_READY: { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_THEME_CHANGED: { for (int i = 0; i < CHANNELS_MAX; i++) { channel[i].vu_l->set_under_texture(get_theme_icon(SNAME("BusVuEmpty"), SNAME("EditorIcons"))); channel[i].vu_l->set_progress_texture(get_theme_icon(SNAME("BusVuFull"), SNAME("EditorIcons"))); @@ -86,6 +87,12 @@ void EditorAudioBus::_notification(int p_what) { bus_options->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); + audio_value_preview_label->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), SNAME("TooltipLabel"))); + audio_value_preview_label->add_theme_color_override("font_shadow_color", get_theme_color(SNAME("font_shadow_color"), SNAME("TooltipLabel"))); + audio_value_preview_box->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("TooltipPanel"))); + } break; + + case NOTIFICATION_READY: { update_bus(); set_process(true); } break; @@ -157,26 +164,7 @@ void EditorAudioBus::_notification(int p_what) { set_process(is_visible_in_tree()); } break; - case NOTIFICATION_THEME_CHANGED: { - for (int i = 0; i < CHANNELS_MAX; i++) { - channel[i].vu_l->set_under_texture(get_theme_icon(SNAME("BusVuEmpty"), SNAME("EditorIcons"))); - channel[i].vu_l->set_progress_texture(get_theme_icon(SNAME("BusVuFull"), SNAME("EditorIcons"))); - channel[i].vu_r->set_under_texture(get_theme_icon(SNAME("BusVuEmpty"), SNAME("EditorIcons"))); - channel[i].vu_r->set_progress_texture(get_theme_icon(SNAME("BusVuFull"), SNAME("EditorIcons"))); - channel[i].prev_active = true; - } - - disabled_vu = get_theme_icon(SNAME("BusVuFrozen"), SNAME("EditorIcons")); - - solo->set_icon(get_theme_icon(SNAME("AudioBusSolo"), SNAME("EditorIcons"))); - mute->set_icon(get_theme_icon(SNAME("AudioBusMute"), SNAME("EditorIcons"))); - bypass->set_icon(get_theme_icon(SNAME("AudioBusBypass"), SNAME("EditorIcons"))); - - bus_options->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); - audio_value_preview_box->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), SNAME("TooltipLabel"))); - audio_value_preview_box->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("TooltipPanel"))); - } break; case NOTIFICATION_MOUSE_EXIT: case NOTIFICATION_DRAG_END: { if (hovering_drop) { @@ -833,6 +821,11 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { slider->set_clip_contents(false); audio_value_preview_box = memnew(Panel); + slider->add_child(audio_value_preview_box); + audio_value_preview_box->set_as_top_level(true); + audio_value_preview_box->set_mouse_filter(MOUSE_FILTER_PASS); + audio_value_preview_box->hide(); + HBoxContainer *audioprev_hbc = memnew(HBoxContainer); audioprev_hbc->set_v_size_flags(SIZE_EXPAND_FILL); audioprev_hbc->set_h_size_flags(SIZE_EXPAND_FILL); @@ -842,16 +835,8 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { audio_value_preview_label->set_v_size_flags(SIZE_EXPAND_FILL); audio_value_preview_label->set_h_size_flags(SIZE_EXPAND_FILL); audio_value_preview_label->set_mouse_filter(MOUSE_FILTER_PASS); - audio_value_preview_box->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), SNAME("TooltipLabel"))); - audioprev_hbc->add_child(audio_value_preview_label); - slider->add_child(audio_value_preview_box); - audio_value_preview_box->set_as_top_level(true); - audio_value_preview_box->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("TooltipPanel"))); - audio_value_preview_box->set_mouse_filter(MOUSE_FILTER_PASS); - audio_value_preview_box->hide(); - preview_timer = memnew(Timer); preview_timer->set_wait_time(0.8f); preview_timer->set_one_shot(true); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index c230bdcb73..f0cc1530ab 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -380,6 +380,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const Color font_color = mono_color.lerp(base_color, 0.25); const Color font_hover_color = mono_color.lerp(base_color, 0.125); const Color font_disabled_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.3); + const Color font_readonly_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.65); const Color selection_color = accent_color * Color(1, 1, 1, 0.4); const Color disabled_color = mono_color.inverted().lerp(base_color, 0.7); const Color disabled_bg_color = mono_color.inverted().lerp(base_color, 0.9); @@ -1028,9 +1029,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("read_only", "LineEdit", style_line_edit_disabled); theme->set_icon("clear", "LineEdit", theme->get_icon("GuiClose", "EditorIcons")); theme->set_color("read_only", "LineEdit", font_disabled_color); - theme->set_color("font_uneditable_color", "LineEdit", font_disabled_color); theme->set_color("font_color", "LineEdit", font_color); theme->set_color("font_selected_color", "LineEdit", mono_color); + theme->set_color("font_uneditable_color", "LineEdit", font_readonly_color); theme->set_color("caret_color", "LineEdit", font_color); theme->set_color("selection_color", "LineEdit", selection_color); theme->set_color("clear_button_color", "LineEdit", font_color); @@ -1196,7 +1197,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { style_tooltip->set_default_margin(SIDE_TOP, default_margin_size * EDSCALE * 0.5); style_tooltip->set_default_margin(SIDE_RIGHT, default_margin_size * EDSCALE); style_tooltip->set_default_margin(SIDE_BOTTOM, default_margin_size * EDSCALE * 0.5); - style_tooltip->set_bg_color(mono_color.inverted()); + style_tooltip->set_bg_color(mono_color.inverted() * Color(1, 1, 1, 0.9)); style_tooltip->set_border_width_all(0); theme->set_color("font_color", "TooltipLabel", font_hover_color); theme->set_color("font_color_shadow", "TooltipLabel", Color(0, 0, 0, 0)); |