summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <juan@godotengine.org>2021-03-23 11:20:14 -0300
committerJuan Linietsky <juan@godotengine.org>2021-03-23 11:33:07 -0300
commit4706297356a73f47cc071d46964bc8ce3b97cbba (patch)
tree508876c5b7b886f34252bd22835561f060ae2e68
parentcd05653e308c2263e23debd45211c48af134040d (diff)
Remove FileSystem dock errors on unimported files
* Removes error shown when file is in 'keep' mode * Display a warning when attempting to open the file * Closes #47296
-rw-r--r--editor/filesystem_dock.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 772eff5f45..90244ca820 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -944,6 +944,21 @@ void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorit
fpath = fpath.substr(0, fpath.length() - 1);
}
} else if (fpath != "Favorites") {
+ if (FileAccess::exists(fpath + ".import")) {
+ Ref<ConfigFile> config;
+ config.instance();
+ Error err = config->load(fpath + ".import");
+ if (err == OK) {
+ if (config->has_section_key("remap", "importer")) {
+ String importer = config->get_value("remap", "importer");
+ if (importer == "keep") {
+ EditorNode::get_singleton()->show_warning(TTR("Importing has been disabled for this file, so it can't be opened for editing."));
+ return;
+ }
+ }
+ }
+ }
+
if (ResourceLoader::get_resource_type(fpath) == "PackedScene") {
bool is_imported = false;
@@ -2644,7 +2659,10 @@ void FileSystemDock::_update_import_dock() {
break;
}
- String type = cf->get_value("remap", "type");
+ String type;
+ if (cf->has_section_key("remap", "type")) {
+ type = cf->get_value("remap", "type");
+ }
if (import_type == "") {
import_type = type;
} else if (import_type != type) {