summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/editor_file_dialog.cpp45
-rw-r--r--tools/editor/editor_file_dialog.h2
-rw-r--r--tools/editor/editor_node.cpp26
-rw-r--r--tools/editor/plugins/sprite_frames_editor_plugin.cpp3
4 files changed, 62 insertions, 14 deletions
diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp
index 28a9b63412..22cd3845e1 100644
--- a/tools/editor/editor_file_dialog.cpp
+++ b/tools/editor/editor_file_dialog.cpp
@@ -53,13 +53,52 @@ void EditorFileDialog::_notification(int p_what) {
//RID ci = get_canvas_item();
//get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
+ } else if (p_what==NOTIFICATION_POPUP_HIDE) {
+
+ set_process_unhandled_input(false);
+
} else if (p_what==EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
- set_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"));
+ bool show_hidden=EditorSettings::get_singleton()->get("file_dialog/show_hidden_files");
+ if (show_hidden_files!=show_hidden)
+ set_show_hidden_files(show_hidden);
set_display_mode((DisplayMode)EditorSettings::get_singleton()->get("file_dialog/display_mode").operator int());
}
}
+void EditorFileDialog::_unhandled_input(const InputEvent& p_event) {
+
+ if (p_event.type==InputEvent::KEY && is_window_modal_on_top()) {
+
+ const InputEventKey &k=p_event.key;
+
+ if (k.pressed) {
+
+ bool handled=true;
+
+ switch (k.scancode) {
+
+ case KEY_H: {
+
+ if (k.mod.command) {
+
+ bool show=!show_hidden_files;
+ set_show_hidden_files(show);
+ EditorSettings::get_singleton()->set("file_dialog/show_hidden_files",show);
+ } else {
+ handled=false;
+ }
+
+ } break;
+ default: { handled=false; }
+ }
+
+ if (handled)
+ accept_event();
+ }
+ }
+}
+
void EditorFileDialog::set_enable_multiple_selection(bool p_enable) {
item_list->set_select_mode(p_enable?ItemList::SELECT_MULTI:ItemList::SELECT_SINGLE);
@@ -151,6 +190,8 @@ void EditorFileDialog::_post_popup() {
_update_favorites();
}
+ set_process_unhandled_input(true);
+
}
void EditorFileDialog::_thumbnail_result(const String& p_path,const Ref<Texture>& p_preview, const Variant& p_udata) {
@@ -1049,6 +1090,8 @@ EditorFileDialog::DisplayMode EditorFileDialog::get_display_mode() const{
void EditorFileDialog::_bind_methods() {
+ ObjectTypeDB::bind_method(_MD("_unhandled_input"),&EditorFileDialog::_unhandled_input);
+
ObjectTypeDB::bind_method(_MD("_item_selected"),&EditorFileDialog::_item_selected);
ObjectTypeDB::bind_method(_MD("_item_db_selected"),&EditorFileDialog::_item_dc_selected);
ObjectTypeDB::bind_method(_MD("_dir_entered"),&EditorFileDialog::_dir_entered);
diff --git a/tools/editor/editor_file_dialog.h b/tools/editor/editor_file_dialog.h
index db3201e5c4..3590964a51 100644
--- a/tools/editor/editor_file_dialog.h
+++ b/tools/editor/editor_file_dialog.h
@@ -176,6 +176,8 @@ private:
void _thumbnail_done(const String& p_path,const Ref<Texture>& p_preview, const Variant& p_udata);
void _request_single_thumbnail(const String& p_path);
+ void _unhandled_input(const InputEvent& p_event);
+
protected:
void _notification(int p_what);
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 2d9decaaf9..9fe0409c0e 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -415,7 +415,7 @@ void EditorNode::_rebuild_import_menu()
{
PopupMenu* p = import_menu->get_popup();
p->clear();
- p->add_item("Sub-Scene", FILE_IMPORT_SUBSCENE);
+ p->add_item("Node from scene", FILE_IMPORT_SUBSCENE);
p->add_separator();
for (int i = 0; i < editor_import_export->get_import_plugin_count(); i++) {
p->add_item(editor_import_export->get_import_plugin(i)->get_visible_name(), IMPORT_PLUGIN_BASE + i);
@@ -1454,8 +1454,13 @@ void EditorNode::_dialog_action(String p_file) {
Ref<ConfigFile> config;
config.instance();
Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
- if (err!=OK && err!=ERR_FILE_NOT_FOUND) {
- return; //no config
+
+ if (err==ERR_CANT_OPEN) {
+ config.instance(); // new config
+ } else if (err!=OK) {
+ confirm_error->set_text("Error trying to save layout!");
+ confirm_error->popup_centered_minsize();
+ return;
}
_save_docks_to_config(config, p_file);
@@ -1480,11 +1485,8 @@ void EditorNode::_dialog_action(String p_file) {
Ref<ConfigFile> config;
config.instance();
Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
- if (err!=OK) {
- return; //no config
- }
- if (!config->has_section(p_file)) {
+ if (err!=OK || !config->has_section(p_file)) {
confirm_error->set_text("Layout name not found!");
confirm_error->popup_centered_minsize();
return;
@@ -3533,11 +3535,13 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo
}
- for(int i=0;i<editor_data.get_edited_scene_count();i++) {
+ if(!p_set_inherited) {
+ for(int i=0;i<editor_data.get_edited_scene_count();i++) {
- if (editor_data.get_scene_path(i)==p_scene) {
- _scene_tab_changed(i);
- return OK;
+ if (editor_data.get_scene_path(i)==p_scene) {
+ _scene_tab_changed(i);
+ return OK;
+ }
}
}
diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.cpp b/tools/editor/plugins/sprite_frames_editor_plugin.cpp
index 7b8f1535be..048df2d682 100644
--- a/tools/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/tools/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -338,7 +338,6 @@ void SpriteFramesEditor::_update_library() {
TreeItem *ti = tree->create_item(root);
ti->set_cell_mode(0,TreeItem::CELL_MODE_STRING);
- ti->set_editable(0,true);
ti->set_selectable(0,true);
if (frames->get_frame(i).is_null()) {
@@ -346,7 +345,7 @@ void SpriteFramesEditor::_update_library() {
ti->set_text(0,"Frame "+itos(i)+" (empty)");
} else {
- ti->set_text(0,"Frame "+itos(i));
+ ti->set_text(0,"Frame "+itos(i)+" ("+frames->get_frame(i)->get_name()+")");
ti->set_icon(0,frames->get_frame(i));
}
if (frames->get_frame(i).is_valid())