diff options
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r-- | modules/mono/csharp_script.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 2971706c75..1fcb2791d9 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -1656,7 +1656,8 @@ void CSharpInstance::get_property_list(List<PropertyInfo> *p_properties) const { } } - for (const PropertyInfo &prop : props) { + for (PropertyInfo &prop : props) { + validate_property(prop); p_properties->push_back(prop); } } @@ -1694,6 +1695,24 @@ bool CSharpInstance::property_can_revert(const StringName &p_name) const { return (bool)ret; } +void CSharpInstance::validate_property(PropertyInfo &p_property) const { + ERR_FAIL_COND(!script.is_valid()); + + Variant property_arg = (Dictionary)p_property; + const Variant *args[1] = { &property_arg }; + + Variant ret; + Callable::CallError call_error; + GDMonoCache::managed_callbacks.CSharpInstanceBridge_Call( + gchandle.get_intptr(), &SNAME("_validate_property"), args, 1, &call_error, &ret); + + if (call_error.error != Callable::CallError::CALL_OK) { + return; + } + + p_property = PropertyInfo::from_dict(property_arg); +} + bool CSharpInstance::property_get_revert(const StringName &p_name, Variant &r_ret) const { ERR_FAIL_COND_V(!script.is_valid(), false); |