summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-02-22 16:39:44 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-02-22 16:39:44 +0100
commitc17f3d7c05fafda9b6fceb578c11bbf1682ebf9c (patch)
treea3820f06447a8c38cc5d512b5e385819f4f01bbb
parent43771659cb481f8743e419f36b874605fbef0975 (diff)
parent5473c7e2224c489fde7375155d67e4470e7d1c81 (diff)
downloadredot-engine-c17f3d7c05fafda9b6fceb578c11bbf1682ebf9c.tar.gz
Merge pull request #88665 from KoBeWi/nice_help_bro
Fix implementation of `property_can_revert()` in PropertyListHelper
-rw-r--r--doc/classes/Object.xml2
-rw-r--r--scene/property_list_helper.cpp7
2 files changed, 2 insertions, 7 deletions
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index bb27ea6eb7..0f8a458bae 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -220,7 +220,7 @@
<return type="bool" />
<param index="0" name="property" type="StringName" />
<description>
- Override this method to customize the given [param property]'s revert behavior. Should return [code]true[/code] if the [param property] can be reverted in the Inspector dock. Use [method _property_get_revert] to specify the [param property]'s default value.
+ Override this method to customize the given [param property]'s revert behavior. Should return [code]true[/code] if the [param property] has a custom default value and is revertible in the Inspector dock. Use [method _property_get_revert] to specify the [param property]'s default value.
[b]Note:[/b] This method must return consistently, regardless of the current value of the [param property].
</description>
</method>
diff --git a/scene/property_list_helper.cpp b/scene/property_list_helper.cpp
index 2d3179d9fd..d9a80011b0 100644
--- a/scene/property_list_helper.cpp
+++ b/scene/property_list_helper.cpp
@@ -111,12 +111,7 @@ bool PropertyListHelper::property_set_value(const String &p_property, const Vari
bool PropertyListHelper::property_can_revert(const String &p_property) const {
int index;
- const Property *property = _get_property(p_property, &index);
-
- if (property) {
- return _call_getter(property->getter, index) != property->default_value;
- }
- return false;
+ return _get_property(p_property, &index) != nullptr;
}
bool PropertyListHelper::property_get_revert(const String &p_property, Variant &r_value) const {