diff options
author | reduz <reduzio@gmail.com> | 2021-07-23 16:01:18 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2021-07-24 09:16:52 -0300 |
commit | 32b43cfeb38dc83ba8024acec32bdfc706c86a46 (patch) | |
tree | 1ccdbbe010073a37a382955a12f241a83cc384c7 /core/io/resource_loader.h | |
parent | c25fa02c1c242df0f256dd58af650f8c8806c066 (diff) | |
download | redot-engine-32b43cfeb38dc83ba8024acec32bdfc706c86a46.tar.gz |
Implement Resource UIDs
* Most resource types now have unique identifiers.
* Applies to text, binary and imported resources.
* File formats reference both by text and UID (when available). UID always has priority.
* Resource UIDs are 64 bits for better compatibility with the engine.
* Can be represented and used textually, example `uuid://dapwmgsmnl28u`.
* A special binary cache file is used and exported, containing the mappings.
Example of how it looks:
```GDScript
[gd_scene load_steps=2 format=3 uid="uid://dw86wq31afig2"]
[ext_resource type="PackedScene" uid="uid://bt36ojelx8q6c" path="res://subscene.scn" id="1_t56hs"]
```
GDScript, shaders and other special resource files can't currently provide UIDs, but this should be doable with special keywords on the files.
This will be reserved for future PRs.
Diffstat (limited to 'core/io/resource_loader.h')
-rw-r--r-- | core/io/resource_loader.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h index c656b9a69c..b9e234fdd2 100644 --- a/core/io/resource_loader.h +++ b/core/io/resource_loader.h @@ -56,6 +56,7 @@ public: virtual bool recognize_path(const String &p_path, const String &p_for_type = String()) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; + virtual ResourceUID::ID get_resource_uid(const String &p_path) const; virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false); virtual Error rename_dependencies(const String &p_path, const Map<String, String> &p_map); virtual bool is_import_valid(const String &p_path) const { return true; } @@ -157,6 +158,7 @@ public: static void add_resource_format_loader(Ref<ResourceFormatLoader> p_format_loader, bool p_at_front = false); static void remove_resource_format_loader(Ref<ResourceFormatLoader> p_format_loader); static String get_resource_type(const String &p_path); + static ResourceUID::ID get_resource_uid(const String &p_path); static void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false); static Error rename_dependencies(const String &p_path, const Map<String, String> &p_map); static bool is_import_valid(const String &p_path); |