Stopped trying to revert to default values when script implementation of property_can_revert exists

This commit is contained in:
Eric M 2020-05-03 16:54:34 +10:00
parent f5cd33f39d
commit 27ada5c114

View file

@ -501,11 +501,12 @@ bool EditorPropertyRevert::can_property_revert(Object *p_object, const StringNam
} }
} }
if (p_object->call("property_can_revert", p_property).operator bool()) { // If the object implements property_can_revert, rely on that completely
// (i.e. don't then try to revert to default value - the property_get_revert implementation
has_revert = true; // can do that if so desired)
} if (p_object->has_method("property_can_revert")) {
has_revert = p_object->call("property_can_revert", p_property).operator bool();
} else {
if (!has_revert && !p_object->get_script().is_null()) { if (!has_revert && !p_object->get_script().is_null()) {
Ref<Script> scr = p_object->get_script(); Ref<Script> scr = p_object->get_script();
if (scr.is_valid()) { if (scr.is_valid()) {
@ -517,6 +518,7 @@ bool EditorPropertyRevert::can_property_revert(Object *p_object, const StringNam
} }
} }
} }
}
return has_revert; return has_revert;
} }