You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Allow implementing ScriptInstance::validate_property() from GDExtension
This commit is contained in:
@@ -688,7 +688,24 @@ public:
|
||||
return Variant::NIL;
|
||||
}
|
||||
virtual void validate_property(PropertyInfo &p_property) const override {
|
||||
// TODO
|
||||
if (native_info->validate_property_func) {
|
||||
GDExtensionPropertyInfo gdext_prop = {
|
||||
(GDExtensionVariantType)p_property.type,
|
||||
&p_property.name,
|
||||
&p_property.class_name,
|
||||
(uint32_t)p_property.hint,
|
||||
&p_property.hint_string,
|
||||
p_property.usage,
|
||||
};
|
||||
if (native_info->validate_property_func(instance, &gdext_prop)) {
|
||||
p_property.type = (Variant::Type)gdext_prop.type;
|
||||
p_property.name = *reinterpret_cast<StringName *>(gdext_prop.name);
|
||||
p_property.class_name = *reinterpret_cast<StringName *>(gdext_prop.class_name);
|
||||
p_property.hint = (PropertyHint)gdext_prop.hint;
|
||||
p_property.hint_string = *reinterpret_cast<String *>(gdext_prop.hint_string);
|
||||
p_property.usage = gdext_prop.usage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool property_can_revert(const StringName &p_name) const override {
|
||||
|
||||
Reference in New Issue
Block a user