summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2024-08-06 00:11:02 +0200
committerkobewi <kobewi4e@gmail.com>2024-10-04 23:02:04 +0200
commitb9d25580ce2a8d00bf372c5304f6d7c65141fac9 (patch)
tree23f97ad7851ac2c151b72ac780e0b31979c706b9 /core
parentdb66bd35af704fe0d83ba9348b8c50a48e51b2ba (diff)
downloadredot-engine-b9d25580ce2a8d00bf372c5304f6d7c65141fac9.tar.gz
Fix implementation of property_can_revert() in various classes
Diffstat (limited to 'core')
-rw-r--r--core/config/project_settings.cpp18
1 files changed, 6 insertions, 12 deletions
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<StringName, ProjectSettings::VariantContainer>::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) {