@@ -970,7 +970,7 @@ bool EditorFileSystem::_update_scan_actions() {
970970 Vector<String> dependencies = _get_dependencies (full_path);
971971 for (const String &dep : dependencies) {
972972 const String &dependency_path = dep.contains (" ::" ) ? dep.get_slice (" ::" , 0 ) : dep;
973- if (import_extensions. has (dep. get_extension () )) {
973+ if (_can_import_file (dep)) {
974974 reimports.push_back (dependency_path);
975975 }
976976 }
@@ -1224,7 +1224,7 @@ void EditorFileSystem::_process_file_system(const ScannedDirectory *p_scan_dir,
12241224 FileCache *fc = file_cache.getptr (path);
12251225 uint64_t mt = FileAccess::get_modified_time (path);
12261226
1227- if (import_extensions. has (ext )) {
1227+ if (_can_import_file (scan_file )) {
12281228 // is imported
12291229 uint64_t import_mt = FileAccess::get_modified_time (path + " .import" );
12301230
@@ -1514,7 +1514,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, ScanPr
15141514 scan_actions.push_back (ia);
15151515 }
15161516
1517- if (import_extensions. has (ext )) {
1517+ if (_can_import_file (f )) {
15181518 // if it can be imported, and it was added, it needs to be reimported
15191519 ItemAction ia;
15201520 ia.action = ItemAction::ACTION_FILE_TEST_REIMPORT;
@@ -1546,7 +1546,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, ScanPr
15461546
15471547 String path = cd.path_join (p_dir->files [i]->file );
15481548
1549- if (import_extensions. has (p_dir->files [i]->file . get_extension (). to_lower () )) {
1549+ if (_can_import_file (p_dir->files [i]->file )) {
15501550 // Check here if file must be imported or not.
15511551 // Same logic as in _process_file_system, the last modifications dates
15521552 // needs to be trusted to prevent reading all the .import files and the md5
@@ -2820,7 +2820,7 @@ Error EditorFileSystem::_reimport_file(const String &p_file, const HashMap<Strin
28202820
28212821 if (importer.is_null ()) {
28222822 // not found by name, find by extension
2823- importer = ResourceFormatImporter::get_singleton ()->get_importer_by_extension (p_file. get_extension () );
2823+ importer = ResourceFormatImporter::get_singleton ()->get_importer_by_file (p_file);
28242824 load_default = true ;
28252825 if (importer.is_null ()) {
28262826 ERR_FAIL_V_MSG (ERR_FILE_CANT_OPEN, " BUG: File queued for import, but can't be imported, importer for type '" + importer_name + " ' not found." );
@@ -3626,8 +3626,18 @@ void EditorFileSystem::_update_extensions() {
36263626 extensionsl.clear ();
36273627 ResourceFormatImporter::get_singleton ()->get_recognized_extensions (&extensionsl);
36283628 for (const String &E : extensionsl) {
3629- import_extensions.insert (E);
3629+ import_extensions.insert (!E.begins_with (" ." ) ? " ." + E : E);
3630+ }
3631+ }
3632+
3633+ bool EditorFileSystem::_can_import_file (const String &p_file) {
3634+ for (const String &F : import_extensions) {
3635+ if (p_file.right (F.length ()).nocasecmp_to (F) == 0 ) {
3636+ return true ;
3637+ }
36303638 }
3639+
3640+ return false ;
36313641}
36323642
36333643void EditorFileSystem::add_import_format_support_query (Ref<EditorFileSystemImportFormatSupportQuery> p_query) {
0 commit comments