From 3b019bf644f61aaa2eaf9276448d97fb6e6a868a Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 23 Jan 2017 23:12:08 -0300 Subject: Ability to delete, drag and drop audio buses! --- tools/editor/editor_audio_buses.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tools/editor/editor_audio_buses.h') diff --git a/tools/editor/editor_audio_buses.h b/tools/editor/editor_audio_buses.h index 8787101393..137c78de30 100644 --- a/tools/editor/editor_audio_buses.h +++ b/tools/editor/editor_audio_buses.h @@ -13,6 +13,7 @@ #include "scene/gui/line_edit.h" #include "scene/gui/tree.h" #include "scene/gui/option_button.h" +#include "scene/gui/panel.h" class EditorAudioBuses; @@ -33,6 +34,7 @@ class EditorAudioBus : public PanelContainer { OptionButton *send; PopupMenu *effect_options; + PopupMenu *delete_popup; Button *solo; Button *mute; @@ -42,6 +44,9 @@ class EditorAudioBus : public PanelContainer { bool updating_bus; + void _gui_input(const InputEvent& p_event); + void _delete_pressed(int p_option); + void _name_changed(const String& p_new_name); void _name_focus_exit() { _name_changed(track_name->get_text()); } void _volume_db_changed(float p_db); @@ -53,6 +58,11 @@ class EditorAudioBus : public PanelContainer { void _effect_add(int p_which); void _effect_selected(); + virtual Variant get_drag_data(const Point2& p_point); + virtual bool can_drop_data(const Point2& p_point,const Variant& p_data) const; + virtual void drop_data(const Point2& p_point,const Variant& p_data); + + friend class EditorAudioBuses; EditorAudioBuses *buses; @@ -70,6 +80,20 @@ public: }; +class EditorAudioBusDrop : public Panel { + + GDCLASS(EditorAudioBusDrop,Panel); + + virtual bool can_drop_data(const Point2& p_point,const Variant& p_data) const; + virtual void drop_data(const Point2& p_point,const Variant& p_data); +protected: + + static void _bind_methods(); +public: + + EditorAudioBusDrop(); +}; + class EditorAudioBuses : public VBoxContainer { GDCLASS(EditorAudioBuses,VBoxContainer) @@ -84,11 +108,17 @@ class EditorAudioBuses : public VBoxContainer { ScrollContainer *group_scroll; HBoxContainer *group_hb; + EditorAudioBusDrop *drop_end; + void _add_bus(); void _update_buses(); void _update_bus(int p_index); void _update_sends(); + void _delete_bus(Object* p_which); + + void _request_drop_end(); + void _drop_at_index(int p_bus,int p_index); protected: -- cgit v1.2.3