You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Fix slow load/save of scenes with many instances of the same script
(cherry picked from commit 2ca6b9c610)
This commit is contained in:
committed by
Rémi Verschelde
parent
461e79bd18
commit
dc203b0d13
@@ -328,7 +328,7 @@ PlaceHolderScriptInstance *GDScript::placeholder_instance_create(Object *p_this)
|
||||
#ifdef TOOLS_ENABLED
|
||||
PlaceHolderScriptInstance *si = memnew(PlaceHolderScriptInstance(GDScriptLanguage::get_singleton(), Ref<Script>(this), p_this));
|
||||
placeholders.insert(si);
|
||||
_update_exports();
|
||||
_update_exports(nullptr, false, si);
|
||||
return si;
|
||||
#else
|
||||
return NULL;
|
||||
@@ -379,10 +379,8 @@ void GDScript::_update_exports_values(Map<StringName, Variant> &values, List<Pro
|
||||
}
|
||||
#endif
|
||||
|
||||
bool GDScript::_update_exports(bool *r_err, bool p_recursive_call) {
|
||||
|
||||
bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderScriptInstance *p_instance_to_update) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
static Vector<GDScript *> base_caches;
|
||||
if (!p_recursive_call)
|
||||
base_caches.clear();
|
||||
@@ -501,15 +499,19 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call) {
|
||||
}
|
||||
}
|
||||
|
||||
if (placeholders.size()) { //hm :(
|
||||
if ((changed || p_instance_to_update) && placeholders.size()) { //hm :(
|
||||
|
||||
// update placeholders if any
|
||||
Map<StringName, Variant> values;
|
||||
List<PropertyInfo> propnames;
|
||||
_update_exports_values(values, propnames);
|
||||
|
||||
for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
|
||||
E->get()->update(propnames, values);
|
||||
if (changed) {
|
||||
for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
|
||||
E->get()->update(propnames, values);
|
||||
}
|
||||
} else {
|
||||
p_instance_to_update->update(propnames, values);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user