summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorThaddeus Crews <repiteo@outlook.com>2024-10-10 18:13:16 -0500
committerThaddeus Crews <repiteo@outlook.com>2024-10-10 18:13:16 -0500
commit9d5a7321a54f2a27ff8b273083c8f30e23bfd0ec (patch)
tree6d941556921414bc16fcea4564c01948341f7b0f /core
parent44b797fbe63aa8a9803836b9e4c6a175c24cb755 (diff)
parentb9d25580ce2a8d00bf372c5304f6d7c65141fac9 (diff)
downloadredot-engine-9d5a7321a54f2a27ff8b273083c8f30e23bfd0ec.tar.gz
Merge pull request #95175 from KoBeWi/bruh_can_revert
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) {