Merge pull request #83123 from astillich/82998-propagate-base-class-exports
Fix modifying base script exports not propagating to derived scripts
This commit is contained in:
commit
6a0716dedd
|
@ -278,6 +278,7 @@ struct _GDScriptMemberSort {
|
||||||
void GDScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) {
|
void GDScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) {
|
||||||
placeholders.erase(p_placeholder);
|
placeholders.erase(p_placeholder);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GDScript::_get_script_method_list(List<MethodInfo> *r_list, bool p_include_base) const {
|
void GDScript::_get_script_method_list(List<MethodInfo> *r_list, bool p_include_base) const {
|
||||||
|
@ -468,7 +469,7 @@ String GDScript::get_class_icon_path() const {
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
#ifdef TOOLS_ENABLED
|
||||||
|
|
||||||
static Vector<GDScript *> base_caches;
|
static Vector<GDScript *> base_caches;
|
||||||
|
@ -477,7 +478,7 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc
|
||||||
}
|
}
|
||||||
base_caches.append(this);
|
base_caches.append(this);
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = p_base_exports_changed;
|
||||||
|
|
||||||
if (source_changed_cache) {
|
if (source_changed_cache) {
|
||||||
source_changed_cache = false;
|
source_changed_cache = false;
|
||||||
|
@ -604,9 +605,15 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc
|
||||||
|
|
||||||
void GDScript::update_exports() {
|
void GDScript::update_exports() {
|
||||||
#ifdef TOOLS_ENABLED
|
#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;
|
bool cyclic_error = false;
|
||||||
_update_exports(&cyclic_error);
|
bool changed = _update_exports(&cyclic_error, false, nullptr, p_base_exports_changed);
|
||||||
|
|
||||||
if (cyclic_error) {
|
if (cyclic_error) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -616,14 +623,14 @@ void GDScript::update_exports() {
|
||||||
for (const ObjectID &E : copy) {
|
for (const ObjectID &E : copy) {
|
||||||
Object *id = ObjectDB::get_instance(E);
|
Object *id = ObjectDB::get_instance(E);
|
||||||
GDScript *s = Object::cast_to<GDScript>(id);
|
GDScript *s = Object::cast_to<GDScript>(id);
|
||||||
|
|
||||||
if (!s) {
|
if (!s) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
s->update_exports();
|
s->_update_exports_down(p_base_exports_changed || changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
String GDScript::_get_debug_path() const {
|
String GDScript::_get_debug_path() const {
|
||||||
if (is_built_in() && !get_name().is_empty()) {
|
if (is_built_in() && !get_name().is_empty()) {
|
||||||
|
|
|
@ -163,13 +163,14 @@ class GDScript : public Script {
|
||||||
HashSet<PlaceHolderScriptInstance *> placeholders;
|
HashSet<PlaceHolderScriptInstance *> placeholders;
|
||||||
//void _update_placeholder(PlaceHolderScriptInstance *p_placeholder);
|
//void _update_placeholder(PlaceHolderScriptInstance *p_placeholder);
|
||||||
virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder) override;
|
virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder) override;
|
||||||
|
void _update_exports_down(bool p_base_exports_changed);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
HashMap<ObjectID, List<Pair<StringName, Variant>>> pending_reload_state;
|
HashMap<ObjectID, List<Pair<StringName, Variant>>> pending_reload_state;
|
||||||
#endif
|
#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);
|
void _save_orphaned_subclasses(GDScript::ClearData *p_clear_data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue