mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 02:21:15 +00:00
Expose _validate_property() for scripting
This commit is contained in:
parent
713bfaf5ea
commit
67db4693eb
9 changed files with 111 additions and 2 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue