summaryrefslogtreecommitdiff
path: root/core/object
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2021-07-23 16:01:18 -0300
committerreduz <reduzio@gmail.com>2021-07-24 09:16:52 -0300
commit32b43cfeb38dc83ba8024acec32bdfc706c86a46 (patch)
tree1ccdbbe010073a37a382955a12f241a83cc384c7 /core/object
parentc25fa02c1c242df0f256dd58af650f8c8806c066 (diff)
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/object')
-rw-r--r--core/object/class_db.cpp4
-rw-r--r--core/object/class_db.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp
index e2db5918e3..f871dd464a 100644
--- a/core/object/class_db.cpp
+++ b/core/object/class_db.cpp
@@ -1496,6 +1496,10 @@ void ClassDB::get_resource_base_extensions(List<String> *p_extensions) {
}
}
+bool ClassDB::is_resource_extension(const StringName &p_extension) {
+ return resource_base_extensions.has(p_extension);
+}
+
void ClassDB::get_extensions_for_type(const StringName &p_class, List<String> *p_extensions) {
const StringName *K = nullptr;
diff --git a/core/object/class_db.h b/core/object/class_db.h
index fd574fd2d8..3a84e9ab38 100644
--- a/core/object/class_db.h
+++ b/core/object/class_db.h
@@ -396,6 +396,7 @@ public:
static void add_resource_base_extension(const StringName &p_extension, const StringName &p_class);
static void get_resource_base_extensions(List<String> *p_extensions);
static void get_extensions_for_type(const StringName &p_class, List<String> *p_extensions);
+ static bool is_resource_extension(const StringName &p_extension);
static void add_compatibility_class(const StringName &p_class, const StringName &p_fallback);