diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2021-06-13 13:32:44 +0200 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2021-06-13 13:32:44 +0200 |
commit | 2ca6b9c61028b10bd1b7821cd32f6fbf505d71d1 (patch) | |
tree | 8afb950b476a1f9484b30b999d4f5953b0bc6505 /modules/mono/csharp_script.cpp | |
parent | 600b4c9c7b11622e4eb5ed1e5fd70b3d3f66170e (diff) |
Fix slow load/save of scenes with many instances of the same script
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r-- | modules/mono/csharp_script.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 67344b7719..576256b6ec 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -2370,7 +2370,7 @@ void CSharpScript::_update_member_info_no_exports() { } #endif -bool CSharpScript::_update_exports() { +bool CSharpScript::_update_exports(PlaceHolderScriptInstance *p_instance_to_update) { #ifdef TOOLS_ENABLED bool is_editor = Engine::get_singleton()->is_editor_hint(); if (is_editor) { @@ -2542,14 +2542,18 @@ bool CSharpScript::_update_exports() { if (is_editor) { placeholder_fallback_enabled = false; - if (placeholders.size()) { + if ((changed || p_instance_to_update) && placeholders.size()) { // 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); } } } @@ -3230,7 +3234,7 @@ PlaceHolderScriptInstance *CSharpScript::placeholder_instance_create(Object *p_t #ifdef TOOLS_ENABLED PlaceHolderScriptInstance *si = memnew(PlaceHolderScriptInstance(CSharpLanguage::get_singleton(), Ref<Script>(this), p_this)); placeholders.insert(si); - _update_exports(); + _update_exports(si); return si; #else return nullptr; |