diff options
author | kobewi <kobewi4e@gmail.com> | 2023-04-07 14:01:57 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2023-08-28 15:18:48 +0200 |
commit | 67db4693ebdc972eae2395fecd39dc174045b980 (patch) | |
tree | 54bd2a4097fd2b744459e45f3f14a66895a46cb2 /core/object/object.cpp | |
parent | 713bfaf5eac1eb8a770e5ee825db29de99f3d0f7 (diff) | |
download | redot-engine-67db4693ebdc972eae2395fecd39dc174045b980.tar.gz |
Expose _validate_property() for scripting
Diffstat (limited to 'core/object/object.cpp')
-rw-r--r-- | core/object/object.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/object/object.cpp b/core/object/object.cpp index 4ae0ecdefd..b803d57cd9 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -526,6 +526,10 @@ void Object::get_property_list(List<PropertyInfo> *p_list, bool p_reversed) cons void Object::validate_property(PropertyInfo &p_property) const { _validate_propertyv(p_property); + + if (script_instance) { // Call it last to allow user altering already validated properties. + script_instance->validate_property(p_property); + } } bool Object::property_can_revert(const StringName &p_name) const { @@ -1604,6 +1608,8 @@ void Object::_bind_methods() { plget.return_val.hint_string = "Dictionary"; BIND_OBJ_CORE_METHOD(plget); + BIND_OBJ_CORE_METHOD(MethodInfo(Variant::NIL, "_validate_property", PropertyInfo(Variant::DICTIONARY, "property"))); + BIND_OBJ_CORE_METHOD(MethodInfo(Variant::BOOL, "_property_can_revert", PropertyInfo(Variant::STRING_NAME, "property"))); MethodInfo mipgr("_property_get_revert", PropertyInfo(Variant::STRING_NAME, "property")); mipgr.return_val.name = "Variant"; |