Merge pull request #82084 from ogapo/pr/pck-cache-merge

Merge `uid_cache.bin` and `global_script_class_cache.cfg` after mounting PCKs
This commit is contained in:
Rémi Verschelde 2024-03-11 14:01:16 +01:00
commit 0475011c66
No known key found for this signature in database
GPG key ID: C3336907360768E1
16 changed files with 112 additions and 47 deletions

View file

@ -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) {