diff options
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index f154cbd1e2..e2741f6e3a 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -825,6 +825,7 @@ void EditorNode::_notification(int p_what) { if (EditorSettings::get_singleton()->check_changed_settings_in_group("docks/filesystem")) { HashSet<String> updated_textfile_extensions; + HashSet<String> updated_other_file_extensions; bool extensions_match = true; const Vector<String> textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false); for (const String &E : textfile_ext) { @@ -833,9 +834,17 @@ void EditorNode::_notification(int p_what) { extensions_match = false; } } + const Vector<String> other_file_ext = ((String)(EDITOR_GET("docks/filesystem/other_file_extensions"))).split(",", false); + for (const String &E : other_file_ext) { + updated_other_file_extensions.insert(E); + if (extensions_match && !other_file_extensions.has(E)) { + extensions_match = false; + } + } - if (!extensions_match || updated_textfile_extensions.size() < textfile_extensions.size()) { + if (!extensions_match || updated_textfile_extensions.size() < textfile_extensions.size() || updated_other_file_extensions.size() < other_file_extensions.size()) { textfile_extensions = updated_textfile_extensions; + other_file_extensions = updated_other_file_extensions; EditorFileSystem::get_singleton()->scan(); } } @@ -1326,6 +1335,9 @@ Error EditorNode::load_resource(const String &p_resource, bool p_ignore_broken_d res = ResourceLoader::load(p_resource, "", ResourceFormatLoader::CACHE_MODE_REUSE, &err); } else if (textfile_extensions.has(p_resource.get_extension())) { res = ScriptEditor::get_singleton()->open_file(p_resource); + } else if (other_file_extensions.has(p_resource.get_extension())) { + OS::get_singleton()->shell_open(ProjectSettings::get_singleton()->globalize_path(p_resource)); + return OK; } ERR_FAIL_COND_V(!res.is_valid(), ERR_CANT_OPEN); @@ -6980,6 +6992,10 @@ EditorNode::EditorNode() { for (const String &E : textfile_ext) { textfile_extensions.insert(E); } + const Vector<String> other_file_ext = ((String)(EDITOR_GET("docks/filesystem/other_file_extensions"))).split(",", false); + for (const String &E : other_file_ext) { + other_file_extensions.insert(E); + } resource_preview = memnew(EditorResourcePreview); add_child(resource_preview); |