summaryrefslogtreecommitdiffstats
path: root/core/object
diff options
context:
space:
mode:
authorDavid Nikdel <david.nikdel@gmail.com>2024-03-06 12:14:21 -0500
committerDavid Nikdel <david.nikdel@gmail.com>2024-03-06 12:14:21 -0500
commit5e6adb4a2dd947432e59ca00b6d046a68c534e10 (patch)
tree5d21549ae2b555cc4d6029391e1400dbe63919e0 /core/object
parent1b2e0b32d727ceab387afcabba422f994038e439 (diff)
downloadredot-engine-5e6adb4a2dd947432e59ca00b6d046a68c534e10.tar.gz
Merge uid_cache.bin and global_script_class_cache.cfg after mounting PCKs
fixes godotengine#82061 fixes godotengine#61556 Also, distinguish between main pack and DLC packs. It's desirable to downloaded content to be as small as possible. This change avoids bloating non-main pack files with new versions of resources that are all read on startup and never used again. They have no effect if loaded after startup. - project.godot/project.binary file - extension_list.cfg - app icon and boot_splash - .ico and .icns files (these can still be opted in for DLC by listing them explicitly in the include filter)
Diffstat (limited to 'core/object')
-rw-r--r--core/object/script_language.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp
index d358a8d2a0..5885cf515f 100644
--- a/core/object/script_language.cpp
+++ b/core/object/script_language.cpp
@@ -325,12 +325,24 @@ void ScriptServer::global_classes_clear() {
void ScriptServer::add_global_class(const StringName &p_class, const StringName &p_base, const StringName &p_language, const String &p_path) {
ERR_FAIL_COND_MSG(p_class == p_base || (global_classes.has(p_base) && get_global_class_native_base(p_base) == p_class), "Cyclic inheritance in script class.");
- GlobalScriptClass g;
- g.language = p_language;
- g.path = p_path;
- g.base = p_base;
- global_classes[p_class] = g;
- inheriters_cache_dirty = true;
+ GlobalScriptClass *existing = global_classes.getptr(p_class);
+ if (existing) {
+ // Update an existing class (only set dirty if something changed).
+ if (existing->base != p_base || existing->path != p_path || existing->language != p_language) {
+ existing->base = p_base;
+ existing->path = p_path;
+ existing->language = p_language;
+ inheriters_cache_dirty = true;
+ }
+ } else {
+ // Add new class.
+ GlobalScriptClass g;
+ g.language = p_language;
+ g.path = p_path;
+ g.base = p_base;
+ global_classes[p_class] = g;
+ inheriters_cache_dirty = true;
+ }
}
void ScriptServer::remove_global_class(const StringName &p_class) {