feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -61,8 +61,6 @@ bool ResourceFormatLoader::recognize_path(const String &p_path, const String &p_
|
|||
return ret;
|
||||
}
|
||||
|
||||
String extension = p_path.get_extension();
|
||||
|
||||
List<String> extensions;
|
||||
if (p_for_type.is_empty()) {
|
||||
get_recognized_extensions(&extensions);
|
||||
|
|
@ -71,7 +69,8 @@ bool ResourceFormatLoader::recognize_path(const String &p_path, const String &p_
|
|||
}
|
||||
|
||||
for (const String &E : extensions) {
|
||||
if (E.nocasecmp_to(extension) == 0) {
|
||||
const String ext = !E.begins_with(".") ? "." + E : E;
|
||||
if (p_path.right(ext.length()).nocasecmp_to(ext) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -264,6 +263,14 @@ void ResourceLoader::LoadToken::clear() {
|
|||
thread_load_tasks.erase(local_path);
|
||||
}
|
||||
local_path.clear(); // Mark as already cleared.
|
||||
if (task_to_await) {
|
||||
for (KeyValue<String, ResourceLoader::ThreadLoadTask> &E : thread_load_tasks) {
|
||||
if (E.value.task_id == task_to_await) {
|
||||
task_to_await = 0;
|
||||
break; // Same task is reused by nested loads, do not wait for completion here.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -322,7 +329,7 @@ Ref<Resource> ResourceLoader::_load(const String &p_path, const String &p_origin
|
|||
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
if (ResourceFormatImporter::get_singleton()->get_importer_by_extension(p_path.get_extension()).is_valid()) {
|
||||
if (ResourceFormatImporter::get_singleton()->get_importer_by_file(p_path).is_valid()) {
|
||||
// The format is known to the editor, but the file hasn't been imported
|
||||
// (otherwise, ResourceFormatImporter would have been found as a suitable loader).
|
||||
found = true;
|
||||
|
|
@ -772,6 +779,10 @@ Ref<Resource> ResourceLoader::_load_complete(LoadToken &p_load_token, Error *r_e
|
|||
return _load_complete_inner(p_load_token, r_error, thread_load_lock);
|
||||
}
|
||||
|
||||
void ResourceLoader::set_is_import_thread(bool p_import_thread) {
|
||||
import_thread = p_import_thread;
|
||||
}
|
||||
|
||||
Ref<Resource> ResourceLoader::_load_complete_inner(LoadToken &p_load_token, Error *r_error, MutexLock<SafeBinaryMutex<BINARY_MUTEX_TAG>> &p_thread_load_lock) {
|
||||
if (r_error) {
|
||||
*r_error = OK;
|
||||
|
|
@ -825,6 +836,12 @@ Ref<Resource> ResourceLoader::_load_complete_inner(LoadToken &p_load_token, Erro
|
|||
|
||||
p_thread_load_lock.temp_relock();
|
||||
load_task.awaited = true;
|
||||
// Mark nested loads with the same task id as awaited.
|
||||
for (KeyValue<String, ResourceLoader::ThreadLoadTask> &E : thread_load_tasks) {
|
||||
if (E.value.task_id == load_task.task_id) {
|
||||
E.value.awaited = true;
|
||||
}
|
||||
}
|
||||
|
||||
DEV_ASSERT(load_task.status == THREAD_LOAD_FAILED || load_task.status == THREAD_LOAD_LOADED);
|
||||
} else if (load_task.need_wait) {
|
||||
|
|
@ -886,9 +903,11 @@ Ref<Resource> ResourceLoader::_load_complete_inner(LoadToken &p_load_token, Erro
|
|||
MessageQueue::get_main_singleton()->push_callable(callable_mp(rcc.source, &Resource::connect_changed).bind(rcc.callable, rcc.flags));
|
||||
}
|
||||
}
|
||||
core_bind::Semaphore done;
|
||||
MessageQueue::get_main_singleton()->push_callable(callable_mp(&done, &core_bind::Semaphore::post).bind(1));
|
||||
done.wait();
|
||||
if (!import_thread) { // Main thread is blocked by initial resource reimport, do not wait.
|
||||
CoreBind::Semaphore done;
|
||||
MessageQueue::get_main_singleton()->push_callable(callable_mp(&done, &CoreBind::Semaphore::post).bind(1));
|
||||
done.wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1339,10 +1358,8 @@ void ResourceLoader::load_translation_remaps() {
|
|||
}
|
||||
|
||||
Dictionary remaps = GLOBAL_GET("internationalization/locale/translation_remaps");
|
||||
List<Variant> keys;
|
||||
remaps.get_key_list(&keys);
|
||||
for (const Variant &E : keys) {
|
||||
Array langs = remaps[E];
|
||||
for (const KeyValue<Variant, Variant> &kv : remaps) {
|
||||
Array langs = kv.value;
|
||||
Vector<String> lang_remaps;
|
||||
lang_remaps.resize(langs.size());
|
||||
String *lang_remaps_ptrw = lang_remaps.ptrw();
|
||||
|
|
@ -1350,7 +1367,7 @@ void ResourceLoader::load_translation_remaps() {
|
|||
*lang_remaps_ptrw++ = lang;
|
||||
}
|
||||
|
||||
translation_remaps[String(E)] = lang_remaps;
|
||||
translation_remaps[String(kv.key)] = lang_remaps;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1565,6 +1582,7 @@ bool ResourceLoader::create_missing_resources_if_class_unavailable = false;
|
|||
bool ResourceLoader::abort_on_missing_resource = true;
|
||||
bool ResourceLoader::timestamp_on_load = false;
|
||||
|
||||
thread_local bool ResourceLoader::import_thread = false;
|
||||
thread_local int ResourceLoader::load_nesting = 0;
|
||||
thread_local Vector<String> ResourceLoader::load_paths_stack;
|
||||
thread_local HashMap<int, HashMap<String, Ref<Resource>>> ResourceLoader::res_ref_overrides;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue