summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/code_editor.cpp5
-rw-r--r--tools/editor/editor_file_system.cpp2
-rw-r--r--tools/editor/editor_node.cpp10
-rw-r--r--tools/editor/editor_node.h3
-rw-r--r--tools/editor/filesystem_dock.cpp10
-rw-r--r--tools/editor/io_plugins/editor_mesh_import_plugin.cpp1
-rw-r--r--tools/editor/project_manager.cpp134
-rw-r--r--tools/editor/project_manager.h1
-rw-r--r--tools/editor/scene_tree_dock.cpp25
-rw-r--r--tools/editor/scene_tree_dock.h4
10 files changed, 181 insertions, 14 deletions
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp
index 71ae171dfe..6c8d25aa01 100644
--- a/tools/editor/code_editor.cpp
+++ b/tools/editor/code_editor.cpp
@@ -133,8 +133,9 @@ bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col)
if (found) {
if (!preserve_cursor) {
- text_edit->cursor_set_line(line);
- text_edit->cursor_set_column(col+text.length());
+ text_edit->cursor_set_line(line, false);
+ text_edit->cursor_set_column(col+text.length(), false);
+ text_edit->center_viewport_to_cursor();
}
text_edit->set_search_text(text);
diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp
index cb7cefea26..582b9e2490 100644
--- a/tools/editor/editor_file_system.cpp
+++ b/tools/editor/editor_file_system.cpp
@@ -657,7 +657,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess
da->change_dir("..");
}
} else {
- ERR_PRINTS(TTR("Cannot go into subdir:")+" "+E->get());
+ ERR_PRINTS("Cannot go into subdir: "+E->get());
}
p_progress.update(idx,total);
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 8b55e73ee7..30b89cacc5 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -3822,6 +3822,11 @@ void EditorNode::request_instance_scene(const String &p_path) {
}
+void EditorNode::request_instance_scenes(const Vector<String>& p_files) {
+
+ scene_tree_dock->instance_scenes(p_files);
+}
+
FileSystemDock *EditorNode::get_scenes_dock() {
return scenes_dock;
@@ -3831,10 +3836,9 @@ SceneTreeDock *EditorNode::get_scene_tree_dock() {
return scene_tree_dock;
}
-void EditorNode::_instance_request(const String& p_path){
-
+void EditorNode::_instance_request(const Vector<String>& p_files) {
- request_instance_scene(p_path);
+ request_instance_scenes(p_files);
}
void EditorNode::_property_keyed(const String& p_keyed,const Variant& p_value,bool p_advance) {
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index 9a227d3644..793c148671 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -452,7 +452,7 @@ private:
void _save_scene(String p_file, int idx = -1);
- void _instance_request(const String& p_path);
+ void _instance_request(const Vector<String>& p_files);
void _property_keyed(const String& p_keyed, const Variant& p_value, bool p_advance);
void _transform_keyed(Object *sp,const String& p_sub,const Transform& p_key);
@@ -666,6 +666,7 @@ public:
static VSplitContainer *get_top_split() { return singleton->top_split; }
void request_instance_scene(const String &p_path);
+ void request_instance_scenes(const Vector<String>& p_files);
FileSystemDock *get_scenes_dock();
SceneTreeDock *get_scene_tree_dock();
static UndoRedo* get_undo_redo() { return &singleton->editor_data.get_undo_redo(); }
diff --git a/tools/editor/filesystem_dock.cpp b/tools/editor/filesystem_dock.cpp
index 3be122cc7d..378edd6667 100644
--- a/tools/editor/filesystem_dock.cpp
+++ b/tools/editor/filesystem_dock.cpp
@@ -950,14 +950,20 @@ void FileSystemDock::_file_option(int p_option) {
} break;
case FILE_INSTANCE: {
+ Vector<String> paths;
+
for (int i = 0; i<files->get_item_count(); i++) {
if (!files->is_selected(i))
continue;
String path =files->get_item_metadata(i);
if (EditorFileSystem::get_singleton()->get_file_type(path)=="PackedScene") {
- emit_signal("instance",path);
+ paths.push_back(path);
}
}
+
+ if (!paths.empty()) {
+ emit_signal("instance", paths);
+ }
} break;
case FILE_DEPENDENCIES: {
@@ -1596,7 +1602,7 @@ void FileSystemDock::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_preview_invalidated"),&FileSystemDock::_preview_invalidated);
- ADD_SIGNAL(MethodInfo("instance"));
+ ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::STRING_ARRAY, "files")));
ADD_SIGNAL(MethodInfo("open"));
}
diff --git a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp
index 2c3ed2afd6..da608292c1 100644
--- a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp
@@ -496,7 +496,6 @@ Error EditorMeshImportPlugin::import(const String& p_path, const Ref<ResourceImp
}
int vtx = face[idx][0].to_int()-1;
- print_line("vtx: "+itos(vtx)+"/"+itos(vertices.size()));
ERR_FAIL_INDEX_V(vtx,vertices.size(),ERR_PARSE_ERROR);
Vector3 vertex = vertices[vtx];
diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp
index b7d3abfd5b..caf116523a 100644
--- a/tools/editor/project_manager.cpp
+++ b/tools/editor/project_manager.cpp
@@ -31,6 +31,7 @@
#include "os/os.h"
#include "os/dir_access.h"
#include "os/file_access.h"
+#include "os/keyboard.h"
#include "editor_settings.h"
#include "scene/gui/separator.h"
#include "scene/gui/tool_button.h"
@@ -491,6 +492,10 @@ void ProjectManager::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) {
get_tree()->set_editor_hint(true);
+
+ } else if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {
+
+ set_process_unhandled_input(is_visible());
}
}
@@ -576,6 +581,134 @@ void ProjectManager::_panel_input(const InputEvent& p_ev,Node *p_hb) {
}
}
+void ProjectManager::_unhandled_input(const InputEvent& p_ev) {
+
+ if (p_ev.type==InputEvent::KEY) {
+
+ const InputEventKey &k = p_ev.key;
+
+ if (!k.pressed)
+ return;
+
+ bool scancode_handled = true;
+
+ switch (k.scancode) {
+
+ case KEY_HOME: {
+
+ for (int i=0; i<scroll_childs->get_child_count(); i++) {
+
+ HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>();
+ if (hb) {
+ selected_list.clear();
+ selected_list.insert(hb->get_meta("name"), hb->get_meta("main_scene"));
+ scroll->set_v_scroll(0);
+ break;
+ }
+ }
+
+ } break;
+ case KEY_END: {
+
+ for (int i=scroll_childs->get_child_count()-1; i>=0; i--) {
+
+ HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>();
+ if (hb) {
+ selected_list.clear();
+ selected_list.insert(hb->get_meta("name"), hb->get_meta("main_scene"));
+ scroll->set_v_scroll(scroll_childs->get_size().y);
+ break;
+ }
+ }
+
+ } break;
+ case KEY_UP: {
+
+ if (k.mod.shift)
+ break;
+
+ if (selected_list.size()) {
+
+ bool found = false;
+
+ for (int i=scroll_childs->get_child_count()-1; i>=0; i--) {
+
+ HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>();
+ if (!hb) continue;
+
+ String current = hb->get_meta("name");
+
+ if (found) {
+ selected_list.clear();
+ selected_list.insert(current, hb->get_meta("main_scene"));
+
+ int offset_diff = scroll->get_v_scroll() - hb->get_pos().y;
+
+ if (offset_diff > 0)
+ scroll->set_v_scroll(scroll->get_v_scroll() - offset_diff);
+
+ break;
+
+ } else if (current==selected_list.back()->key()) {
+
+ found = true;
+ }
+ }
+
+ break;
+ }
+ // else fallthrough to key_down
+ }
+ case KEY_DOWN: {
+
+ if (k.mod.shift)
+ break;
+
+ bool found = selected_list.empty();
+
+ for (int i=0; i<scroll_childs->get_child_count(); i++) {
+
+ HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>();
+ if (!hb) continue;
+
+ String current = hb->get_meta("name");
+
+ if (found) {
+ selected_list.clear();
+ selected_list.insert(current, hb->get_meta("main_scene"));
+
+ int last_y_visible = scroll->get_v_scroll() + scroll->get_size().y;
+ int offset_diff = (hb->get_pos().y + hb->get_size().y) - last_y_visible;
+
+ if (offset_diff > 0)
+ scroll->set_v_scroll(scroll->get_v_scroll() + offset_diff);
+
+ break;
+
+ } else if (current==selected_list.back()->key()) {
+
+ found = true;
+ }
+ }
+
+ } break;
+ default: {
+ scancode_handled = false;
+ } break;
+ }
+
+ if (scancode_handled) {
+ accept_event();
+
+ for(int i=0;i<scroll_childs->get_child_count();i++) {
+ CanvasItem *item = scroll_childs->get_child(i)->cast_to<CanvasItem>();
+ if (item)
+ item->update();
+ }
+ }
+ }
+}
+
void ProjectManager::_favorite_pressed(Node *p_hb) {
String clicked = p_hb->get_meta("name");
@@ -964,6 +1097,7 @@ void ProjectManager::_bind_methods() {
ObjectTypeDB::bind_method("_load_recent_projects",&ProjectManager::_load_recent_projects);
ObjectTypeDB::bind_method("_panel_draw",&ProjectManager::_panel_draw);
ObjectTypeDB::bind_method("_panel_input",&ProjectManager::_panel_input);
+ ObjectTypeDB::bind_method("_unhandled_input",&ProjectManager::_unhandled_input);
ObjectTypeDB::bind_method("_favorite_pressed",&ProjectManager::_favorite_pressed);
ObjectTypeDB::bind_method("_install_project",&ProjectManager::_install_project);
diff --git a/tools/editor/project_manager.h b/tools/editor/project_manager.h
index 69467f50e7..74d1d3693c 100644
--- a/tools/editor/project_manager.h
+++ b/tools/editor/project_manager.h
@@ -92,6 +92,7 @@ class ProjectManager : public Control {
void _panel_draw(Node *p_hb);
void _panel_input(const InputEvent& p_ev,Node *p_hb);
+ void _unhandled_input(const InputEvent& p_ev);
void _favorite_pressed(Node *p_hb);
protected:
diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp
index a240b575aa..35ddb49465 100644
--- a/tools/editor/scene_tree_dock.cpp
+++ b/tools/editor/scene_tree_dock.cpp
@@ -106,11 +106,30 @@ void SceneTreeDock::instance(const String& p_file) {
Vector<String> scenes;
scenes.push_back(p_file);
- instance_scenes(scenes,parent,-1);
+ _perform_instance_scenes(scenes,parent,-1);
}
-void SceneTreeDock::instance_scenes(const Vector<String>& p_files,Node* parent,int p_pos) {
+void SceneTreeDock::instance_scenes(const Vector<String>& p_files, Node *p_parent) {
+
+ Node *parent = p_parent;
+
+ if (!parent) {
+ parent = scene_tree->get_selected();
+ }
+
+ if (!parent || !edited_scene) {
+
+ accept->get_ok()->set_text(TTR("OK"));
+ accept->set_text(TTR("No parent to instance the scenes at."));
+ accept->popup_centered_minsize();
+ return;
+ };
+
+ _perform_instance_scenes(p_files, parent, -1);
+}
+
+void SceneTreeDock::_perform_instance_scenes(const Vector<String>& p_files,Node* parent,int p_pos) {
@@ -1677,7 +1696,7 @@ void SceneTreeDock::_files_dropped(Vector<String> p_files,NodePath p_to,int p_ty
int to_pos=-1;
_normalize_drop(node,to_pos,p_type);
- instance_scenes(p_files,node,to_pos);
+ _perform_instance_scenes(p_files,node,to_pos);
}
void SceneTreeDock::_nodes_dragged(Array p_nodes,NodePath p_to,int p_type) {
diff --git a/tools/editor/scene_tree_dock.h b/tools/editor/scene_tree_dock.h
index 51041a235b..04ed16967f 100644
--- a/tools/editor/scene_tree_dock.h
+++ b/tools/editor/scene_tree_dock.h
@@ -148,6 +148,8 @@ class SceneTreeDock : public VBoxContainer {
void _filter_changed(const String& p_filter);
+ void _perform_instance_scenes(const Vector<String>& p_files,Node* parent,int p_pos);
+
protected:
void _notification(int p_what);
@@ -160,7 +162,7 @@ public:
void import_subscene();
void set_edited_scene(Node* p_scene);
void instance(const String& p_path);
- void instance_scenes(const Vector<String>& p_files,Node* parent,int p_pos);
+ void instance_scenes(const Vector<String>& p_files, Node *p_parent=NULL);
void set_selected(Node *p_node, bool p_emit_selected=false);
void fill_path_renames(Node* p_node, Node *p_new_parent, List<Pair<NodePath,NodePath> > *p_renames);
void perform_node_renames(Node* p_base,List<Pair<NodePath,NodePath> > *p_renames, Map<Ref<Animation>, Set<int> > *r_rem_anims=NULL);