Skip to content

Commit

Permalink
Remove FileSystem dock errors on unimported files
Browse files Browse the repository at this point in the history
* Removes error shown when file is in 'keep' mode
* Display a warning when attempting to open the file
* Closes godotengine#47296

(cherry picked from commit 4706297)
  • Loading branch information
reduz authored and geekrelief committed Apr 5, 2021
1 parent dc1ad87 commit 6f40ef2
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion editor/filesystem_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,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") {
editor->open_request(fpath);
} else {
Expand Down Expand Up @@ -2488,7 +2503,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) {
Expand Down

0 comments on commit 6f40ef2

Please sign in to comment.