diff options
| author | Alexander Stillich <dr.west@zoho.com> | 2023-10-10 23:12:17 +0200 |
|---|---|---|
| committer | Alexander Stillich <dr.west@zoho.com> | 2023-10-16 17:55:19 +0200 |
| commit | 99f87518787e6784e905cfac149298a1ad447020 (patch) | |
| tree | 9da9a5d39539aae4ef88e6dcd6b3b6642318ca49 /modules/gdscript | |
| parent | a2f90d565ad29edcb3bdab77bc7df51cdde8514a (diff) | |
| download | redot-engine-99f87518787e6784e905cfac149298a1ad447020.tar.gz | |
Fix editing exports in a base script not propagating the change to the opened property editor
This patch fixes the user having to navigate away from the selected node which has the derived script attached and back to see the changes of the base script exports reflected in the property editor.
Diffstat (limited to 'modules/gdscript')
| -rw-r--r-- | modules/gdscript/gdscript.cpp | 19 | ||||
| -rw-r--r-- | modules/gdscript/gdscript.h | 3 |
2 files changed, 15 insertions, 7 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index b5c80d9e2d..76516bb86b 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -278,6 +278,7 @@ struct _GDScriptMemberSort { void GDScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) { placeholders.erase(p_placeholder); } + #endif void GDScript::_get_script_method_list(List<MethodInfo> *r_list, bool p_include_base) const { @@ -464,7 +465,7 @@ String GDScript::get_class_icon_path() const { } #endif -bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderScriptInstance *p_instance_to_update) { +bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderScriptInstance *p_instance_to_update, bool p_base_exports_changed) { #ifdef TOOLS_ENABLED static Vector<GDScript *> base_caches; @@ -473,7 +474,7 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc } base_caches.append(this); - bool changed = false; + bool changed = p_base_exports_changed; if (source_changed_cache) { source_changed_cache = false; @@ -600,9 +601,15 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc void GDScript::update_exports() { #ifdef TOOLS_ENABLED + _update_exports_down(false); +#endif +} +#ifdef TOOLS_ENABLED +void GDScript::_update_exports_down(bool p_base_exports_changed) { bool cyclic_error = false; - _update_exports(&cyclic_error); + bool changed = _update_exports(&cyclic_error, false, nullptr, p_base_exports_changed); + if (cyclic_error) { return; } @@ -612,14 +619,14 @@ void GDScript::update_exports() { for (const ObjectID &E : copy) { Object *id = ObjectDB::get_instance(E); GDScript *s = Object::cast_to<GDScript>(id); + if (!s) { continue; } - s->update_exports(); + s->_update_exports_down(p_base_exports_changed || changed); } - -#endif } +#endif String GDScript::_get_debug_path() const { if (is_built_in() && !get_name().is_empty()) { diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index 50ccfabcc1..041cae75f1 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -163,13 +163,14 @@ class GDScript : public Script { HashSet<PlaceHolderScriptInstance *> placeholders; //void _update_placeholder(PlaceHolderScriptInstance *p_placeholder); virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder) override; + void _update_exports_down(bool p_base_exports_changed); #endif #ifdef DEBUG_ENABLED HashMap<ObjectID, List<Pair<StringName, Variant>>> pending_reload_state; #endif - bool _update_exports(bool *r_err = nullptr, bool p_recursive_call = false, PlaceHolderScriptInstance *p_instance_to_update = nullptr); + bool _update_exports(bool *r_err = nullptr, bool p_recursive_call = false, PlaceHolderScriptInstance *p_instance_to_update = nullptr, bool p_base_exports_changed = false); void _save_orphaned_subclasses(GDScript::ClearData *p_clear_data); |
