| 3041 | /*************** RESOURCE ***************/ |
| 3042 | |
| 3043 | Ref<Resource> ResourceFormatLoaderGDScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) { |
| 3044 | Error err; |
| 3045 | bool ignoring = p_cache_mode == CACHE_MODE_IGNORE || p_cache_mode == CACHE_MODE_IGNORE_DEEP; |
| 3046 | Ref<GDScript> scr = GDScriptCache::get_full_script(p_original_path, err, "", ignoring); |
| 3047 | |
| 3048 | if (err && scr.is_valid()) { |
| 3049 | // If !scr.is_valid(), the error was likely from scr->load_source_code(), which already generates an error. |
| 3050 | ERR_PRINT_ED(vformat(R"(Failed to load script "%s" with error "%s".)", p_original_path, error_names[err])); |
| 3051 | } |
| 3052 | |
| 3053 | if (r_error) { |
| 3054 | // Don't fail loading because of parsing error. |
| 3055 | *r_error = scr.is_valid() ? OK : err; |
| 3056 | } |
| 3057 | |
| 3058 | return scr; |
| 3059 | } |
| 3060 | |
| 3061 | void ResourceFormatLoaderGDScript::get_recognized_extensions(List<String> *p_extensions) const { |
| 3062 | p_extensions->push_back("gd"); |
no test coverage detected