1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-04 17:04:49 +00:00

Removed interactive loader, added proper thread loading.

This commit is contained in:
Juan Linietsky
2020-02-28 08:27:04 -03:00
parent 5beccaf86f
commit 475e4ea67b
57 changed files with 872 additions and 592 deletions

View File

@@ -35,7 +35,7 @@
#include "core/io/resource_saver.h"
#include "core/os/file_access.h"
class ResourceInteractiveLoaderBinary : public ResourceInteractiveLoader {
class ResourceLoaderBinary {
bool translation_remapped;
String local_path;
@@ -58,8 +58,11 @@ class ResourceInteractiveLoaderBinary : public ResourceInteractiveLoader {
struct ExtResource {
String path;
String type;
RES cache;
};
bool use_sub_threads;
float *progress;
Vector<ExtResource> external_resources;
struct IntResource {
@@ -75,32 +78,30 @@ class ResourceInteractiveLoaderBinary : public ResourceInteractiveLoader {
Map<String, String> remaps;
Error error;
int stage;
friend class ResourceFormatLoaderBinary;
Error parse_variant(Variant &r_v);
Map<String, RES> dependency_cache;
public:
virtual void set_local_path(const String &p_local_path);
virtual Ref<Resource> get_resource();
virtual Error poll();
virtual int get_stage() const;
virtual int get_stage_count() const;
virtual void set_translation_remapped(bool p_remapped);
void set_local_path(const String &p_local_path);
Ref<Resource> get_resource();
Error load();
void set_translation_remapped(bool p_remapped);
void set_remaps(const Map<String, String> &p_remaps) { remaps = p_remaps; }
void open(FileAccess *p_f);
String recognize(FileAccess *p_f);
void get_dependencies(FileAccess *p_f, List<String> *p_dependencies, bool p_add_types);
ResourceInteractiveLoaderBinary();
~ResourceInteractiveLoaderBinary();
ResourceLoaderBinary();
~ResourceLoaderBinary();
};
class ResourceFormatLoaderBinary : public ResourceFormatLoader {
public:
virtual Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;