From b9d25580ce2a8d00bf372c5304f6d7c65141fac9 Mon Sep 17 00:00:00 2001 From: kobewi Date: Tue, 6 Aug 2024 00:11:02 +0200 Subject: Fix implementation of property_can_revert() in various classes --- core/config/project_settings.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'core') diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 9fe54e57a7..01f15f9c8e 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -1167,22 +1167,16 @@ bool ProjectSettings::is_project_loaded() const { } bool ProjectSettings::_property_can_revert(const StringName &p_name) const { - if (!props.has(p_name)) { - return false; - } - - return props[p_name].initial != props[p_name].variant; + return props.has(p_name); } bool ProjectSettings::_property_get_revert(const StringName &p_name, Variant &r_property) const { - if (!props.has(p_name)) { - return false; + const RBMap::Element *value = props.find(p_name); + if (value) { + r_property = value->value().initial.duplicate(); + return true; } - - // Duplicate so that if value is array or dictionary, changing the setting will not change the stored initial value. - r_property = props[p_name].initial.duplicate(); - - return true; + return false; } void ProjectSettings::set_setting(const String &p_setting, const Variant &p_value) { -- cgit v1.2.3