Add support for _notification, _set, _get, _get_property_list, _property_can_revert, _property_get_revert, and _to_string methods.

This commit is contained in:
bruvzg
2022-08-19 10:30:06 +03:00
parent f454253005
commit 270ad28931
11 changed files with 447 additions and 119 deletions

View File

@@ -32,6 +32,9 @@
#define GODOT_OBJECT_HPP
#include <godot_cpp/core/defs.hpp>
#include <godot_cpp/core/property_info.hpp>
#include <godot_cpp/variant/variant.hpp>
#include <godot_cpp/classes/object.hpp>
@@ -49,44 +52,6 @@
namespace godot {
struct PropertyInfo {
Variant::Type type = Variant::NIL;
const char *name = nullptr;
const char *class_name = nullptr;
uint32_t hint = 0;
const char *hint_string = nullptr;
uint32_t usage = 7;
operator GDNativePropertyInfo() const {
GDNativePropertyInfo info;
info.type = type;
info.name = name;
info.hint = hint;
info.hint_string = hint_string;
info.class_name = class_name;
info.usage = usage;
return info;
}
PropertyInfo() = default;
PropertyInfo(Variant::Type p_type, const char *p_name, PropertyHint p_hint = PROPERTY_HINT_NONE, const char *p_hint_string = "", uint32_t p_usage = PROPERTY_USAGE_DEFAULT, const char *p_class_name = "") :
type(p_type),
name(p_name),
hint(p_hint),
hint_string(p_hint_string),
usage(p_usage) {
if (hint == PROPERTY_HINT_RESOURCE_TYPE) {
class_name = hint_string;
} else {
class_name = p_class_name;
}
}
PropertyInfo(GDNativeVariantType p_type, const char *p_name, PropertyHint p_hint = PROPERTY_HINT_NONE, const char *p_hint_string = "", uint32_t p_usage = PROPERTY_USAGE_DEFAULT, const char *p_class_name = "") :
PropertyInfo((Variant::Type)p_type, p_name, p_hint, p_hint_string, p_usage, p_class_name) {}
};
struct MethodInfo {
const char *name;
PropertyInfo return_val;