summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorJakub Grzesik <kubecz3k@gmail.com>2017-07-05 15:44:53 +0200
committerJakub Grzesik <kubecz3k@gmail.com>2017-07-10 10:31:15 +0200
commit29c2aabdafca48cbc6aee6b2d4e1f09c8164abc2 (patch)
treeba89ec6d2a9fa7327f49bb321e5d8afb597ac035 /editor
parent159b1fc65f650df0428dbfa9d14e3fd0bcfb94d0 (diff)
ability to reposition scene tabs with drag & drop
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_node.cpp7
-rw-r--r--editor/editor_node.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index a83906ddf3..2f50842a52 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4436,6 +4436,11 @@ void EditorNode::_scene_tab_input(const Ref<InputEvent> &p_input) {
}
}
+void EditorNode::_reposition_active_tab(int idx_to) {
+ editor_data.move_edited_scene_to_index(idx_to);
+ _update_scene_tabs();
+}
+
void EditorNode::_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Variant &p_udata) {
int p_tab = p_udata.operator signed int();
if (p_preview.is_valid()) {
@@ -5025,6 +5030,7 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method("_scene_tab_hover", &EditorNode::_scene_tab_hover);
ClassDB::bind_method("_scene_tab_exit", &EditorNode::_scene_tab_exit);
ClassDB::bind_method("_scene_tab_input", &EditorNode::_scene_tab_input);
+ ClassDB::bind_method("_reposition_active_tab", &EditorNode::_reposition_active_tab);
ClassDB::bind_method("_thumbnail_done", &EditorNode::_thumbnail_done);
ClassDB::bind_method("_scene_tab_script_edited", &EditorNode::_scene_tab_script_edited);
ClassDB::bind_method("_set_main_scene_state", &EditorNode::_set_main_scene_state);
@@ -5399,6 +5405,7 @@ EditorNode::EditorNode() {
scene_tabs->connect("tab_hover", this, "_scene_tab_hover");
scene_tabs->connect("mouse_exited", this, "_scene_tab_exit");
scene_tabs->connect("gui_input", this, "_scene_tab_input");
+ scene_tabs->connect("reposition_active_tab_request", this, "_reposition_active_tab");
HBoxContainer *tabbar_container = memnew(HBoxContainer);
scene_tabs->set_h_size_flags(Control::SIZE_EXPAND_FILL);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 49ac04243c..991cf1df71 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -572,6 +572,7 @@ private:
void _scene_tab_hover(int p_tab);
void _scene_tab_exit();
void _scene_tab_input(const Ref<InputEvent> &p_input);
+ void _reposition_active_tab(int idx_to);
void _thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Variant &p_udata);
void _scene_tab_script_edited(int p_tab);