From ee00efde1fa305722393ad4da7fa1ddf8d63b806 Mon Sep 17 00:00:00 2001 From: Sara Date: Thu, 30 Jan 2025 12:50:05 +0100 Subject: [PATCH] feat: added BIND_GET_SET BIND_PROPERTY & BIND_HPROPERTY via macros.h --- engine/modules/PROJECT/macros.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 engine/modules/PROJECT/macros.h diff --git a/engine/modules/PROJECT/macros.h b/engine/modules/PROJECT/macros.h new file mode 100644 index 0000000..c1c26d6 --- /dev/null +++ b/engine/modules/PROJECT/macros.h @@ -0,0 +1,16 @@ +#ifndef GODOT_EXTRA_MACROS_H +#define GODOT_EXTRA_MACROS_H + +#define BIND_GET_SET(m_property)\ +ClassDB::bind_method(D_METHOD("set_" #m_property, #m_property), &self_type::set_##m_property);\ +ClassDB::bind_method(D_METHOD("get_" #m_property), &self_type::get_##m_property) + +#define BIND_HPROPERTY(m_type, m_property, ...)\ +BIND_GET_SET(m_property);\ +ADD_PROPERTY(PropertyInfo(m_type, #m_property, __VA_ARGS__), "set_" #m_property, "get_" #m_property) + +#define BIND_PROPERTY(m_type, m_property)\ +BIND_GET_SET(m_property);\ +ADD_PROPERTY(PropertyInfo(m_type, #m_property), "set_" #m_property, "get_" #m_property) + +#endif // !GODOT_EXTRA_MACROS_H