summaryrefslogtreecommitdiffstats
path: root/include/godot_cpp/core
diff options
context:
space:
mode:
authorDavid Snopek <dsnopek@gmail.com>2023-09-09 12:52:31 -0500
committerDavid Snopek <dsnopek@gmail.com>2023-09-12 13:21:16 -0500
commitaa6867e6c95e80e003be38037d7149e6648ed32d (patch)
tree8d17c3d87f6ea3b0c5a9f3426d691c073d5947ee /include/godot_cpp/core
parent16ffb2795ae804cee84cc9939d542e4ffa9290db (diff)
downloadredot-cpp-aa6867e6c95e80e003be38037d7149e6648ed32d.tar.gz
Support `_validate_property()`
Diffstat (limited to 'include/godot_cpp/core')
-rw-r--r--include/godot_cpp/core/class_db.hpp1
-rw-r--r--include/godot_cpp/core/property_info.hpp12
2 files changed, 13 insertions, 0 deletions
diff --git a/include/godot_cpp/core/class_db.hpp b/include/godot_cpp/core/class_db.hpp
index 6569445..1a17b57 100644
--- a/include/godot_cpp/core/class_db.hpp
+++ b/include/godot_cpp/core/class_db.hpp
@@ -186,6 +186,7 @@ void ClassDB::_register_class(bool p_virtual, bool p_exposed) {
T::free_property_list_bind, // GDExtensionClassFreePropertyList free_property_list_func;
T::property_can_revert_bind, // GDExtensionClassPropertyCanRevert property_can_revert_func;
T::property_get_revert_bind, // GDExtensionClassPropertyGetRevert property_get_revert_func;
+ T::validate_property_bind, // GDExtensionClassValidateProperty validate_property_func;
T::notification_bind, // GDExtensionClassNotification2 notification_func;
T::to_string_bind, // GDExtensionClassToString to_string_func;
nullptr, // GDExtensionClassReference reference_func;
diff --git a/include/godot_cpp/core/property_info.hpp b/include/godot_cpp/core/property_info.hpp
index 8146859..0ecfa32 100644
--- a/include/godot_cpp/core/property_info.hpp
+++ b/include/godot_cpp/core/property_info.hpp
@@ -68,6 +68,18 @@ struct PropertyInfo {
PropertyInfo(GDExtensionVariantType p_type, const StringName &p_name, PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_string = "", uint32_t p_usage = PROPERTY_USAGE_DEFAULT, const StringName &p_class_name = "") :
PropertyInfo((Variant::Type)p_type, p_name, p_hint, p_hint_string, p_usage, p_class_name) {}
+
+ PropertyInfo(const GDExtensionPropertyInfo *p_info) :
+ PropertyInfo(p_info->type, *reinterpret_cast<StringName *>(p_info->name), (PropertyHint)p_info->hint, *reinterpret_cast<String *>(p_info->hint_string), p_info->usage, *reinterpret_cast<StringName *>(p_info->class_name)) {}
+
+ void _update(GDExtensionPropertyInfo *p_info) {
+ p_info->type = (GDExtensionVariantType)type;
+ *(reinterpret_cast<StringName *>(p_info->name)) = name;
+ p_info->hint = hint;
+ *(reinterpret_cast<String *>(p_info->hint_string)) = hint_string;
+ p_info->usage = usage;
+ *(reinterpret_cast<StringName *>(p_info->class_name)) = class_name;
+ }
};
} // namespace godot