summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-01-23 23:12:08 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-01-23 23:12:41 -0300
commit3b019bf644f61aaa2eaf9276448d97fb6e6a868a (patch)
treed9ccb2ad27aedad99d9781be1d1030bd28baf661
parent2527566ca899e2ac9d8baa8b4e68a22bf7077f35 (diff)
Ability to delete, drag and drop audio buses!
-rw-r--r--core/undo_redo.cpp2
-rw-r--r--main/input_default.cpp2
-rw-r--r--scene/main/viewport.cpp76
-rw-r--r--scene/main/viewport.h2
-rw-r--r--servers/audio_server.cpp100
-rw-r--r--servers/audio_server.h7
-rw-r--r--tools/editor/editor_audio_buses.cpp194
-rw-r--r--tools/editor/editor_audio_buses.h30
-rw-r--r--tools/editor/editor_node.cpp10
9 files changed, 397 insertions, 26 deletions
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp
index 1a0ccc4a7e..8326e262b6 100644
--- a/core/undo_redo.cpp
+++ b/core/undo_redo.cpp
@@ -323,8 +323,10 @@ void UndoRedo::redo() {
void UndoRedo::undo() {
ERR_FAIL_COND(action_level>0);
+ print_line("undo");
if (current_action<0)
return; //nothing to redo
+ print_line("CACTION IS: "+actions[current_action].name);
_process_operation_list(actions[current_action].undo_ops.front());
current_action--;
version--;
diff --git a/main/input_default.cpp b/main/input_default.cpp
index ea4e3f9505..82dec86067 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -486,7 +486,7 @@ Point2 InputDefault::get_last_mouse_speed() const {
int InputDefault::get_mouse_button_mask() const {
- return OS::get_singleton()->get_mouse_button_state();
+ return mouse_button_mask;// do not trust OS implementaiton, should remove it - OS::get_singleton()->get_mouse_button_state();
}
void InputDefault::warp_mouse_pos(const Vector2& p_to) {
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 63c86c8e9d..989c048682 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1796,6 +1796,42 @@ Control* Viewport::_gui_find_control_at_pos(CanvasItem* p_node,const Point2& p_g
return NULL;
}
+bool Viewport::_gui_drop(Control *p_at_control,Point2 p_at_pos,bool p_just_check) {
+
+
+ { //attempt grab, try parent controls too
+ CanvasItem *ci=p_at_control;
+ while(ci) {
+
+ Control *control = ci->cast_to<Control>();
+ if (control) {
+
+
+ if (control->can_drop_data(p_at_pos,gui.drag_data)) {
+ if (!p_just_check) {
+ control->drop_data(p_at_pos,gui.drag_data);
+ }
+
+ return true;
+ }
+
+ if (control->data.mouse_filter==Control::MOUSE_FILTER_STOP)
+ break;
+ }
+
+ p_at_pos = ci->get_transform().xform(p_at_pos);
+
+ if (ci->is_set_as_toplevel())
+ break;
+
+ ci=ci->get_parent_item();
+ }
+ }
+
+ return false;
+}
+
+
void Viewport::_gui_input_event(InputEvent p_event) {
@@ -1937,8 +1973,8 @@ void Viewport::_gui_input_event(InputEvent p_event) {
if (gui.drag_data.get_type()!=Variant::NIL && p_event.mouse_button.button_index==BUTTON_LEFT) {
//alternate drop use (when using force_drag(), as proposed by #5342
- if (gui.mouse_focus && gui.mouse_focus->can_drop_data(pos,gui.drag_data)) {
- gui.mouse_focus->drop_data(pos,gui.drag_data);
+ if (gui.mouse_focus) {
+ _gui_drop(gui.mouse_focus,pos,false);
}
gui.drag_data=Variant();
@@ -1965,9 +2001,9 @@ void Viewport::_gui_input_event(InputEvent p_event) {
if (gui.mouse_over) {
Size2 pos = mpos;
pos = gui.focus_inv_xform.xform(pos);
- if (gui.mouse_over->can_drop_data(pos,gui.drag_data)) {
- gui.mouse_over->drop_data(pos,gui.drag_data);
- }
+
+ _gui_drop(gui.mouse_over,pos,false);
+
}
if (gui.drag_preview && p_event.mouse_button.button_index==BUTTON_LEFT) {
@@ -2028,11 +2064,33 @@ void Viewport::_gui_input_event(InputEvent p_event) {
gui.drag_accum+=Point2(p_event.mouse_motion.relative_x,p_event.mouse_motion.relative_y);
float len = gui.drag_accum.length();
if (len>10) {
- gui.drag_data=gui.mouse_focus->get_drag_data(gui.focus_inv_xform.xform(mpos)-gui.drag_accum);
- if (gui.drag_data.get_type()!=Variant::NIL) {
- gui.mouse_focus=NULL;
+ { //attempt grab, try parent controls too
+ CanvasItem *ci=gui.mouse_focus;
+ while(ci) {
+
+ Control *control = ci->cast_to<Control>();
+ if (control) {
+
+ gui.drag_data=control->get_drag_data(control->get_global_transform_with_canvas().affine_inverse().xform(mpos)-gui.drag_accum);
+ if (gui.drag_data.get_type()!=Variant::NIL) {
+
+ gui.mouse_focus=NULL;
+ }
+
+ if (control->data.mouse_filter==Control::MOUSE_FILTER_STOP)
+ break;
+ }
+
+ if (ci->is_set_as_toplevel())
+ break;
+
+ ci=ci->get_parent_item();
+ }
}
+
+
+
gui.drag_attempted=true;
if (gui.drag_data.get_type()!=Variant::NIL) {
@@ -2159,7 +2217,7 @@ void Viewport::_gui_input_event(InputEvent p_event) {
if (gui.drag_data.get_type()!=Variant::NIL && p_event.mouse_motion.button_mask&BUTTON_MASK_LEFT) {
- bool can_drop = over->can_drop_data(pos,gui.drag_data);
+ bool can_drop = _gui_drop(over,pos,true);
if (!can_drop) {
OS::get_singleton()->set_cursor_shape( OS::CURSOR_FORBIDDEN );
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 2831d177c9..59e34d5c62 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -306,6 +306,8 @@ friend class Control;
Vector2 _get_window_offset() const;
+ bool _gui_drop(Control *p_at_control,Point2 p_at_pos,bool p_just_check);
+
friend class Listener;
void _listener_transform_changed_notify();
void _listener_set(Listener* p_listener);
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index 60f7881c9c..43ab246fbc 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -384,6 +384,92 @@ void AudioServer::set_bus_count(int p_count) {
emit_signal("bus_layout_changed");
}
+
+void AudioServer::remove_bus(int p_index) {
+
+ ERR_FAIL_INDEX(p_index,buses.size());
+ ERR_FAIL_COND(p_index==0);
+
+ lock();
+ bus_map.erase(buses[p_index]->name);
+ memdelete(buses[p_index]);
+ buses.remove(p_index);
+ unlock();
+}
+
+void AudioServer::add_bus(int p_at_pos) {
+
+ if (p_at_pos>=buses.size()) {
+ p_at_pos=-1;
+ } else if (p_at_pos==0) {
+ if (buses.size()>1)
+ p_at_pos=1;
+ else
+ p_at_pos=-1;
+ }
+
+ String attempt="New Bus";
+ int attempts=1;
+ while(true) {
+
+ bool name_free=true;
+ for(int j=0;j<buses.size();j++) {
+
+ if (buses[j]->name==attempt) {
+ name_free=false;
+ break;
+ }
+ }
+
+ if (!name_free) {
+ attempts++;
+ attempt="New Bus " +itos(attempts);
+ } else {
+ break;
+ }
+
+ }
+
+ Bus* bus =memnew(Bus);
+ bus->channels.resize(_get_channel_count());
+ for(int j=0;j<_get_channel_count();j++) {
+ bus->channels[j].buffer.resize(buffer_size);
+ }
+ bus->name=attempt;
+ bus->solo=false;
+ bus->mute=false;
+ bus->bypass=false;
+ bus->volume_db=0;
+
+ bus_map[attempt]=bus;
+
+ if (p_at_pos==-1)
+ buses.push_back(bus);
+ else
+ buses.insert(p_at_pos,bus);
+
+}
+
+void AudioServer::move_bus(int p_bus,int p_to_pos) {
+
+ ERR_FAIL_COND(p_bus<1 || p_bus>=buses.size());
+ ERR_FAIL_COND(p_to_pos!=-1 && (p_to_pos<1 || p_to_pos>buses.size()));
+
+ if (p_bus==p_to_pos)
+ return;
+
+ Bus *bus = buses[p_bus];
+ buses.remove(p_bus);
+
+ if (p_to_pos==-1) {
+ buses.push_back(bus);
+ } else if (p_to_pos<p_bus) {
+ buses.insert(p_to_pos,bus);
+ } else {
+ buses.insert(p_to_pos-1,bus);
+ }
+}
+
int AudioServer::get_bus_count() const {
return buses.size();
@@ -607,14 +693,6 @@ bool AudioServer::is_bus_effect_enabled(int p_bus,int p_effect) const {
}
-void AudioServer::move_bus(int p_bus,int p_to_bus) {
-
- ERR_FAIL_COND(p_bus<1 || p_bus>=buses.size());
- ERR_FAIL_COND(p_bus<1 || p_to_bus>=buses.size());
-
-
-
-}
float AudioServer::get_bus_peak_volume_left_db(int p_bus,int p_channel) const {
@@ -800,6 +878,10 @@ void AudioServer::_bind_methods() {
ClassDB::bind_method(_MD("set_bus_count","amount"),&AudioServer::set_bus_count);
ClassDB::bind_method(_MD("get_bus_count"),&AudioServer::get_bus_count);
+ ClassDB::bind_method(_MD("remove_bus","index"),&AudioServer::remove_bus);
+ ClassDB::bind_method(_MD("add_bus","at_pos"),&AudioServer::add_bus,DEFVAL(-1));
+ ClassDB::bind_method(_MD("move_bus","index","to_index"),&AudioServer::move_bus);
+
ClassDB::bind_method(_MD("set_bus_name","bus_idx","name"),&AudioServer::set_bus_name);
ClassDB::bind_method(_MD("get_bus_name","bus_idx"),&AudioServer::get_bus_name);
@@ -818,7 +900,7 @@ void AudioServer::_bind_methods() {
ClassDB::bind_method(_MD("set_bus_bypass_effects","bus_idx","enable"),&AudioServer::set_bus_bypass_effects);
ClassDB::bind_method(_MD("is_bus_bypassing_effects","bus_idx"),&AudioServer::is_bus_bypassing_effects);
- ClassDB::bind_method(_MD("add_bus_effect","bus_idx","effect:AudioEffect"),&AudioServer::add_bus_effect);
+ ClassDB::bind_method(_MD("add_bus_effect","bus_idx","effect:AudioEffect"),&AudioServer::add_bus_effect,DEFVAL(-1));
ClassDB::bind_method(_MD("remove_bus_effect","bus_idx","effect_idx"),&AudioServer::remove_bus_effect);
ClassDB::bind_method(_MD("get_bus_effect_count","bus_idx"),&AudioServer::add_bus_effect);
diff --git a/servers/audio_server.h b/servers/audio_server.h
index 8cc31752ba..9de330482b 100644
--- a/servers/audio_server.h
+++ b/servers/audio_server.h
@@ -223,6 +223,11 @@ public:
void set_bus_count(int p_count);
int get_bus_count() const;
+ void remove_bus(int p_index);
+ void add_bus(int p_at_pos=-1);
+
+ void move_bus(int p_bus,int p_to_pos);
+
void set_bus_name(int p_bus,const String& p_name);
String get_bus_name(int p_bus) const;
@@ -253,8 +258,6 @@ public:
void set_bus_effect_enabled(int p_bus,int p_effect,bool p_enabled);
bool is_bus_effect_enabled(int p_bus,int p_effect) const;
- void move_bus(int p_bus,int p_to_bus);
-
float get_bus_peak_volume_left_db(int p_bus,int p_channel) const;
float get_bus_peak_volume_right_db(int p_bus,int p_channel) const;
diff --git a/tools/editor/editor_audio_buses.cpp b/tools/editor/editor_audio_buses.cpp
index d570abcc82..5e34dbd07e 100644
--- a/tools/editor/editor_audio_buses.cpp
+++ b/tools/editor/editor_audio_buses.cpp
@@ -1,7 +1,7 @@
#include "editor_audio_buses.h"
#include "editor_node.h"
#include "servers/audio_server.h"
-
+#include "os/keyboard.h"
void EditorAudioBus::_notification(int p_what) {
@@ -372,6 +372,68 @@ void EditorAudioBus::_effect_add(int p_which) {
ur->commit_action();
}
+void EditorAudioBus::_gui_input(const InputEvent& p_event) {
+
+ if (p_event.type==InputEvent::KEY && p_event.key.pressed && p_event.key.scancode==KEY_DELETE && !p_event.key.echo) {
+ accept_event();
+ emit_signal("delete_request");
+ }
+ if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index==2 && p_event.mouse_button.pressed) {
+
+ Vector2 pos = Vector2(p_event.mouse_button.x,p_event.mouse_button.y);
+ delete_popup->set_pos(get_global_pos()+pos);
+ delete_popup->popup();
+ }
+}
+
+void EditorAudioBus::_delete_pressed(int p_option) {
+
+ if (p_option==1) {
+ emit_signal("delete_request");
+ }
+
+}
+
+
+Variant EditorAudioBus::get_drag_data(const Point2& p_point) {
+
+ if (get_index()==0) {
+ return Variant();
+ }
+
+ Control *c = memnew(Control);
+ Panel *p = memnew( Panel );
+ c->add_child(p);
+ p->add_style_override("panel",get_stylebox("focus","Button"));
+ p->set_size(get_size());
+ p->set_pos(-p_point);
+ set_drag_preview(c);
+ Dictionary d;
+ d["type"]="move_audio_bus";
+ d["index"]=get_index();
+ emit_signal("drop_end_request");
+ return d;
+}
+
+bool EditorAudioBus::can_drop_data(const Point2& p_point,const Variant& p_data) const {
+
+ if (get_index()==0)
+ return false;
+ Dictionary d=p_data;
+ if (d.has("type") && String(d["type"])=="move_audio_bus") {
+ return true;
+ }
+
+ return false;
+}
+void EditorAudioBus::drop_data(const Point2& p_point,const Variant& p_data) {
+
+ Dictionary d=p_data;
+ emit_signal("dropped",d["index"],get_index());
+
+}
+
+
void EditorAudioBus::_bind_methods() {
ClassDB::bind_method("update_bus",&EditorAudioBus::update_bus);
@@ -386,6 +448,13 @@ void EditorAudioBus::_bind_methods() {
ClassDB::bind_method("_effect_edited",&EditorAudioBus::_effect_edited);
ClassDB::bind_method("_effect_selected",&EditorAudioBus::_effect_selected);
ClassDB::bind_method("_effect_add",&EditorAudioBus::_effect_add);
+ ClassDB::bind_method("_gui_input",&EditorAudioBus::_gui_input);
+ ClassDB::bind_method("_delete_pressed",&EditorAudioBus::_delete_pressed);
+
+ ADD_SIGNAL(MethodInfo("delete_request"));
+ ADD_SIGNAL(MethodInfo("drop_end_request"));
+ ADD_SIGNAL(MethodInfo("dropped"));
+
}
EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) {
@@ -455,7 +524,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) {
scale = memnew( TextureRect );
hb->add_child(scale);
- add_child(hb);
+ //add_child(hb);
effects = memnew( Tree );
effects->set_hide_root(true);
@@ -494,6 +563,40 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) {
effect_options->set_item_icon(effect_options->get_item_count()-1,icon);
}
+ delete_popup = memnew( PopupMenu );
+ delete_popup->add_item("Duplicate");
+ delete_popup->add_item("Delete");
+ add_child(delete_popup);
+ delete_popup->connect("index_pressed",this,"_delete_pressed");
+
+
+}
+
+
+
+bool EditorAudioBusDrop::can_drop_data(const Point2& p_point,const Variant& p_data) const {
+
+ Dictionary d=p_data;
+ if (d.has("type") && String(d["type"])=="move_audio_bus") {
+ return true;
+ }
+
+ return false;
+}
+void EditorAudioBusDrop::drop_data(const Point2& p_point,const Variant& p_data){
+
+ Dictionary d=p_data;
+ emit_signal("dropped",d["index"],-1);
+
+}
+
+void EditorAudioBusDrop::_bind_methods() {
+
+ ADD_SIGNAL(MethodInfo("dropped"));
+}
+
+EditorAudioBusDrop::EditorAudioBusDrop() {
+
}
@@ -504,6 +607,8 @@ void EditorAudioBuses::_update_buses() {
memdelete(bus_hb->get_child(0));
}
+ drop_end=NULL;
+
for(int i=0;i<AudioServer::get_singleton()->get_bus_count();i++) {
EditorAudioBus *audio_bus = memnew( EditorAudioBus(this) );
@@ -511,6 +616,11 @@ void EditorAudioBuses::_update_buses() {
audio_bus->set_self_modulate(Color(1,0.9,0.9));
}
bus_hb->add_child(audio_bus);
+ audio_bus->connect("delete_request",this,"_delete_bus",varray(audio_bus),CONNECT_DEFERRED);
+ audio_bus->connect("drop_end_request",this,"_request_drop_end");
+ audio_bus->connect("dropped",this,"_drop_at_index",varray(),CONNECT_DEFERRED);
+
+
}
}
@@ -526,6 +636,13 @@ void EditorAudioBuses::_notification(int p_what) {
if (p_what==NOTIFICATION_READY) {
_update_buses();
}
+
+ if (p_what==NOTIFICATION_DRAG_END) {
+ if (drop_end) {
+ drop_end->queue_delete();
+ drop_end=NULL;
+ }
+ }
}
@@ -558,17 +675,90 @@ void EditorAudioBuses::_update_sends() {
}
}
+void EditorAudioBuses::_delete_bus(Object* p_which) {
+
+ EditorAudioBus *bus = p_which->cast_to<EditorAudioBus>();
+ int index = bus->get_index();
+ if (index==0) {
+ EditorNode::get_singleton()->show_warning("Master bus can't be deleted!");
+ return;
+ }
+
+
+ UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+
+ ur->create_action("Delete Audio Bus");
+ ur->add_do_method(AudioServer::get_singleton(),"remove_bus",index);
+ ur->add_undo_method(AudioServer::get_singleton(),"add_bus",index);
+ ur->add_undo_method(AudioServer::get_singleton(),"set_bus_name",index,AudioServer::get_singleton()->get_bus_name(index));
+ ur->add_undo_method(AudioServer::get_singleton(),"set_bus_volume_db",index,AudioServer::get_singleton()->get_bus_volume_db(index));
+ ur->add_undo_method(AudioServer::get_singleton(),"set_bus_send",index,AudioServer::get_singleton()->get_bus_send(index));
+ ur->add_undo_method(AudioServer::get_singleton(),"set_bus_solo",index,AudioServer::get_singleton()->is_bus_solo(index));
+ ur->add_undo_method(AudioServer::get_singleton(),"set_bus_mute",index,AudioServer::get_singleton()->is_bus_mute(index));
+ ur->add_undo_method(AudioServer::get_singleton(),"set_bus_bypass_effects",index,AudioServer::get_singleton()->is_bus_bypassing_effects(index));
+ for(int i=0;i<AudioServer::get_singleton()->get_bus_effect_count(index);i++) {
+
+ ur->add_undo_method(AudioServer::get_singleton(),"add_bus_effect",index,AudioServer::get_singleton()->get_bus_effect(index,i));
+ ur->add_undo_method(AudioServer::get_singleton(),"set_bus_effect_enabled",index,i,AudioServer::get_singleton()->is_bus_effect_enabled(index,i));
+ }
+ ur->add_do_method(this,"_update_buses");
+ ur->add_undo_method(this,"_update_buses");
+ ur->commit_action();
+
+}
+
+void EditorAudioBuses::_request_drop_end() {
+
+ if (!drop_end && bus_hb->get_child_count()) {
+ drop_end = memnew( EditorAudioBusDrop );
+
+ bus_hb->add_child(drop_end);
+ drop_end->set_custom_minimum_size(bus_hb->get_child(0)->cast_to<Control>()->get_size());
+ drop_end->connect("dropped",this,"_drop_at_index",varray(),CONNECT_DEFERRED);
+ }
+}
+
+void EditorAudioBuses::_drop_at_index(int p_bus,int p_index) {
+
+
+ UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+
+ //need to simulate new name, so we can undi :(
+ ur->create_action("Move Audio Bus");
+ ur->add_do_method(AudioServer::get_singleton(),"move_bus",p_bus,p_index);
+ int final_pos;
+ if (p_index==p_bus) {
+ final_pos=p_bus;
+ } else if (p_index==-1) {
+ final_pos = AudioServer::get_singleton()->get_bus_count()-1;
+ } else if (p_index<p_bus) {
+ final_pos = p_index;
+ } else {
+ final_pos = p_index -1;
+ }
+ ur->add_undo_method(AudioServer::get_singleton(),"move_bus",final_pos,p_bus);
+
+ ur->add_do_method(this,"_update_buses");
+ ur->add_undo_method(this,"_update_buses");
+ ur->commit_action();
+}
+
+
void EditorAudioBuses::_bind_methods() {
ClassDB::bind_method("_add_bus",&EditorAudioBuses::_add_bus);
ClassDB::bind_method("_update_buses",&EditorAudioBuses::_update_buses);
ClassDB::bind_method("_update_bus",&EditorAudioBuses::_update_bus);
ClassDB::bind_method("_update_sends",&EditorAudioBuses::_update_sends);
+ ClassDB::bind_method("_delete_bus",&EditorAudioBuses::_delete_bus);
+ ClassDB::bind_method("_request_drop_end",&EditorAudioBuses::_request_drop_end);
+ ClassDB::bind_method("_drop_at_index",&EditorAudioBuses::_drop_at_index);
}
EditorAudioBuses::EditorAudioBuses()
{
+ drop_end = NULL;
top_hb = memnew( HBoxContainer );
add_child(top_hb);
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:
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 9adb82a3b4..2d66429ea5 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -55,7 +55,7 @@
#include "animation_editor.h"
#include "io/stream_peer_ssl.h"
#include "main/input_default.h"
-
+#include "os/input.h"
// plugins
#include "plugins/sprite_frames_editor_plugin.h"
#include "plugins/texture_region_editor_plugin.h"
@@ -2405,8 +2405,12 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
case EDIT_UNDO: {
- if (OS::get_singleton()->get_mouse_button_state())
+
+
+ if (Input::get_singleton()->get_mouse_button_mask()&0x7) {
+ print_line("no because state");
break; // can't undo while mouse buttons are pressed
+ }
String action = editor_data.get_undo_redo().get_current_action_name();
if (action!="")
@@ -2416,7 +2420,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
} break;
case EDIT_REDO: {
- if (OS::get_singleton()->get_mouse_button_state())
+ if (Input::get_singleton()->get_mouse_button_mask()&0x7)
break; // can't redo while mouse buttons are pressed
editor_data.get_undo_redo().redo();