Fix implementation of property_can_revert() in PropertyListHelper
This commit is contained in:
parent
8bad68df1a
commit
5473c7e222
|
@ -220,7 +220,7 @@
|
||||||
<return type="bool" />
|
<return type="bool" />
|
||||||
<param index="0" name="property" type="StringName" />
|
<param index="0" name="property" type="StringName" />
|
||||||
<description>
|
<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].
|
[b]Note:[/b] This method must return consistently, regardless of the current value of the [param property].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
|
|
@ -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 {
|
bool PropertyListHelper::property_can_revert(const String &p_property) const {
|
||||||
int index;
|
int index;
|
||||||
const Property *property = _get_property(p_property, &index);
|
return _get_property(p_property, &index) != nullptr;
|
||||||
|
|
||||||
if (property) {
|
|
||||||
return _call_getter(property->getter, index) != property->default_value;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PropertyListHelper::property_get_revert(const String &p_property, Variant &r_value) const {
|
bool PropertyListHelper::property_get_revert(const String &p_property, Variant &r_value) const {
|
||||||
|
|
Loading…
Reference in New Issue