diff options
author | Danil Alexeev <dalexeev12@yandex.ru> | 2024-11-22 14:03:21 +0300 |
---|---|---|
committer | Danil Alexeev <dalexeev12@yandex.ru> | 2024-11-22 14:03:21 +0300 |
commit | 03b05cf9acd69b7eeced919012c215b22cd901ab (patch) | |
tree | 19860a7e651b7b7a22772b8d02f08fd04479ce86 /tests/core | |
parent | f952bfe9985ad8f507cc29b2c7601bbba18b8039 (diff) | |
download | redot-engine-03b05cf9acd69b7eeced919012c215b22cd901ab.tar.gz |
Core: Fix built-in enum constant bindings
Diffstat (limited to 'tests/core')
-rw-r--r-- | tests/core/object/test_class_db.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/tests/core/object/test_class_db.h b/tests/core/object/test_class_db.h index 924e93129d..b38d3d3e61 100644 --- a/tests/core/object/test_class_db.h +++ b/tests/core/object/test_class_db.h @@ -863,16 +863,19 @@ void add_global_enums(Context &r_context) { } } - // HARDCODED - List<StringName> hardcoded_enums; - hardcoded_enums.push_back("Vector2.Axis"); - hardcoded_enums.push_back("Vector2i.Axis"); - hardcoded_enums.push_back("Vector3.Axis"); - hardcoded_enums.push_back("Vector3i.Axis"); - for (const StringName &E : hardcoded_enums) { - // These enums are not generated and must be written manually (e.g.: Vector3.Axis) - // Here, we assume core types do not begin with underscore - r_context.enum_types.push_back(E); + for (int i = 0; i < Variant::VARIANT_MAX; i++) { + if (i == Variant::OBJECT) { + continue; + } + + const Variant::Type type = Variant::Type(i); + + List<StringName> enum_names; + Variant::get_enums_for_type(type, &enum_names); + + for (const StringName &enum_name : enum_names) { + r_context.enum_types.push_back(Variant::get_type_name(type) + "." + enum_name); + } } } |