From 9b413333409dd354fa72084795bdafdf1c228ef2 Mon Sep 17 00:00:00 2001 From: "Daniel J. Ramirez" Date: Thu, 10 Aug 2017 18:07:24 -0500 Subject: Fixes to buses editor Fixed unselectable bus Added bus options button --- editor/editor_audio_buses.cpp | 34 ++++++--- editor/editor_audio_buses.h | 2 + editor/icons/2x/icon_GUI_mini_tab_menu.png | Bin 0 -> 206 bytes editor/icons/icon_GUI_mini_tab_menu.png | Bin 0 -> 139 bytes editor/icons/source/icon_GUI_mini_tab_menu.svg | 93 +++++++++++++++++++++++++ scene/gui/tree.cpp | 2 +- 6 files changed, 120 insertions(+), 11 deletions(-) create mode 100644 editor/icons/2x/icon_GUI_mini_tab_menu.png create mode 100644 editor/icons/icon_GUI_mini_tab_menu.png create mode 100644 editor/icons/source/icon_GUI_mini_tab_menu.svg diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 219f05ef95..993429a5a4 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -51,6 +51,8 @@ void EditorAudioBus::_notification(int p_what) { mute->set_icon(get_icon("AudioBusMute", "EditorIcons")); bypass->set_icon(get_icon("AudioBusBypass", "EditorIcons")); + bus_options->set_icon(get_icon("GuiMiniTabMenu", "EditorIcons")); + prev_active = true; update_bus(); set_process(true); @@ -620,15 +622,26 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) { buses = p_buses; updating_bus = false; + set_tooltip(TTR("Audio Bus, Drag and Drop to rearrange.")); + VBoxContainer *vb = memnew(VBoxContainer); add_child(vb); set_v_size_flags(SIZE_EXPAND_FILL); + HBoxContainer *head = memnew(HBoxContainer); track_name = memnew(LineEdit); - vb->add_child(track_name); + head->add_child(track_name); track_name->connect("text_entered", this, "_name_changed"); track_name->connect("focus_exited", this, "_name_focus_exit"); + track_name->set_h_size_flags(SIZE_EXPAND_FILL); + + bus_options = memnew(MenuButton); + bus_options->set_h_size_flags(SIZE_SHRINK_END); + bus_options->set_tooltip(TTR("Bus options")); + head->add_child(bus_options); + + vb->add_child(head); HBoxContainer *hbc = memnew(HBoxContainer); vb->add_child(hbc); @@ -636,24 +649,18 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) { solo = memnew(ToolButton); solo->set_toggle_mode(true); solo->set_tooltip(TTR("Solo")); - solo->add_color_override("font_color_pressed", Color(0.2, 0.9, 0.2)); - solo->add_color_override("font_color_hover", Color(0.6, 0.9, 0.6)); solo->set_focus_mode(FOCUS_NONE); solo->connect("pressed", this, "_solo_toggled"); hbc->add_child(solo); mute = memnew(ToolButton); mute->set_toggle_mode(true); mute->set_tooltip(TTR("Mute")); - mute->add_color_override("font_color_pressed", Color(0.9, 0.2, 0.2)); - mute->add_color_override("font_color_hover", Color(0.9, 0.6, 0.6)); mute->set_focus_mode(FOCUS_NONE); mute->connect("pressed", this, "_mute_toggled"); hbc->add_child(mute); bypass = memnew(ToolButton); bypass->set_toggle_mode(true); bypass->set_tooltip(TTR("Bypass")); - bypass->add_color_override("font_color_pressed", Color(0.9, 0.9, 0.2)); - bypass->add_color_override("font_color_hover", Color(0.9, 0.9, 0.6)); bypass->set_focus_mode(FOCUS_NONE); bypass->connect("pressed", this, "_bypass_toggled"); hbc->add_child(bypass); @@ -689,7 +696,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) { effects = memnew(Tree); effects->set_hide_root(true); - effects->set_custom_minimum_size(Size2(0, 90) * EDSCALE); + effects->set_custom_minimum_size(Size2(0, 100) * EDSCALE); effects->set_hide_folding(true); vb->add_child(effects); effects->connect("item_edited", this, "_effect_edited"); @@ -698,6 +705,8 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) { effects->set_drag_forwarding(this); effects->connect("item_rmb_selected", this, "_effect_rmb"); effects->set_allow_rmb_select(true); + effects->set_single_select_cell_editing_only_when_already_selected(true); + effects->set_focus_mode(FOCUS_CLICK); send = memnew(OptionButton); send->set_clip_text(true); @@ -726,7 +735,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) { effect_options->set_item_icon(effect_options->get_item_count() - 1, icon); } - delete_popup = memnew(PopupMenu); + delete_popup = bus_options->get_popup(); delete_popup->add_item("Duplicate"); delete_popup->add_item("Delete"); add_child(delete_popup); @@ -1069,6 +1078,7 @@ EditorAudioBuses::EditorAudioBuses() { add = memnew(Button); top_hb->add_child(add); add->set_text(TTR("Add Bus")); + add->set_tooltip(TTR("Create a new Bus Layout.")); add->connect("pressed", this, "_add_bus"); @@ -1076,21 +1086,25 @@ EditorAudioBuses::EditorAudioBuses() { load = memnew(Button); load->set_text(TTR("Load")); + load->set_tooltip(TTR("Load an existing Bus Layout.")); top_hb->add_child(load); load->connect("pressed", this, "_load_layout"); save_as = memnew(Button); save_as->set_text(TTR("Save As")); + save_as->set_tooltip(TTR("Save this Bus Layout to a file.")); top_hb->add_child(save_as); save_as->connect("pressed", this, "_save_as_layout"); _default = memnew(Button); - _default->set_text(TTR("Default")); + _default->set_text(TTR("Load Default")); + _default->set_tooltip(TTR("Load the default Bus Layout.")); top_hb->add_child(_default); _default->connect("pressed", this, "_load_default_layout"); _new = memnew(Button); _new->set_text(TTR("Create")); + _new->set_tooltip(TTR("Create a new Bus Layout.")); top_hb->add_child(_new); _new->connect("pressed", this, "_new_layout"); diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h index f5bf464fd0..ef7f5e0adf 100644 --- a/editor/editor_audio_buses.h +++ b/editor/editor_audio_buses.h @@ -35,6 +35,7 @@ #include "scene/gui/box_container.h" #include "scene/gui/button.h" #include "scene/gui/line_edit.h" +#include "scene/gui/menu_button.h" #include "scene/gui/option_button.h" #include "scene/gui/panel.h" #include "scene/gui/panel_container.h" @@ -57,6 +58,7 @@ class EditorAudioBus : public PanelContainer { Ref disabled_vu; LineEdit *track_name; + MenuButton *bus_options; VSlider *slider; TextureProgress *vu_l; TextureProgress *vu_r; diff --git a/editor/icons/2x/icon_GUI_mini_tab_menu.png b/editor/icons/2x/icon_GUI_mini_tab_menu.png new file mode 100644 index 0000000000..8c3aa73aaf Binary files /dev/null and b/editor/icons/2x/icon_GUI_mini_tab_menu.png differ diff --git a/editor/icons/icon_GUI_mini_tab_menu.png b/editor/icons/icon_GUI_mini_tab_menu.png new file mode 100644 index 0000000000..1dc793de1a Binary files /dev/null and b/editor/icons/icon_GUI_mini_tab_menu.png differ diff --git a/editor/icons/source/icon_GUI_mini_tab_menu.svg b/editor/icons/source/icon_GUI_mini_tab_menu.svg new file mode 100644 index 0000000000..65d71e86a0 --- /dev/null +++ b/editor/icons/source/icon_GUI_mini_tab_menu.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 0ce29b7472..dc525712b6 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1478,7 +1478,7 @@ void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_c if (!r_in_range && &selected_cell == &c) { - if (!selected_cell.selected) { + if (!selected_cell.selected || force_select_on_already_selected) { selected_cell.selected = true; -- cgit v1.2.3