Skip ResourceLoader's progress query if not requested.

This commit is contained in:
Dario
2025-11-24 14:18:16 -03:00
parent bbe9654327
commit f0e57a727b

View File

@ -53,10 +53,12 @@ Error ResourceLoader::load_threaded_request(const String &p_path, const String &
} }
ResourceLoader::ThreadLoadStatus ResourceLoader::load_threaded_get_status(const String &p_path, Array r_progress) { ResourceLoader::ThreadLoadStatus ResourceLoader::load_threaded_get_status(const String &p_path, Array r_progress) {
float progress = 0; // Progress being the default array indicates the user hasn't requested for it to be computed.
::ResourceLoader::ThreadLoadStatus tls = ::ResourceLoader::load_threaded_get_status(p_path, &progress);
// Default array should never be modified, it causes the hash of the method to change. // Default array should never be modified, it causes the hash of the method to change.
if (!ClassDB::is_default_array_arg(r_progress)) { const bool return_progress = !ClassDB::is_default_array_arg(r_progress);
float progress = 0;
::ResourceLoader::ThreadLoadStatus tls = ::ResourceLoader::load_threaded_get_status(p_path, return_progress ? &progress : nullptr);
if (return_progress) {
r_progress.resize(1); r_progress.resize(1);
r_progress[0] = progress; r_progress[0] = progress;
} }