Add MAKE_RESOURCE_TYPE_HINT macro to simplify binding arrays of resources

This commit is contained in:
Rémi Verschelde 2022-11-22 16:10:41 +01:00
parent f6f8a48459
commit 5d20dccade
No known key found for this signature in database
GPG key ID: C3336907360768E1
9 changed files with 16 additions and 12 deletions

View file

@ -149,6 +149,10 @@ enum PropertyUsageFlags {
#define ADD_ARRAY_COUNT_WITH_USAGE_FLAGS(m_label, m_count_property, m_count_property_setter, m_count_property_getter, m_prefix, m_property_usage_flags) ClassDB::add_property_array_count(get_class_static(), m_label, m_count_property, _scs_create(m_count_property_setter), _scs_create(m_count_property_getter), m_prefix, m_property_usage_flags)
#define ADD_ARRAY(m_array_path, m_prefix) ClassDB::add_property_array(get_class_static(), m_array_path, m_prefix)
// Helper macro to use with PROPERTY_HINT_ARRAY_TYPE for arrays of specific resources:
// PropertyInfo(Variant::ARRAY, "fallbacks", PROPERTY_HINT_ARRAY_TYPE, MAKE_RESOURCE_TYPE_HINT("Font")
#define MAKE_RESOURCE_TYPE_HINT(m_type) vformat("%s/%s:%s", Variant::OBJECT, PROPERTY_HINT_RESOURCE_TYPE, m_type)
struct PropertyInfo {
Variant::Type type = Variant::NIL;
String name;