1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-22 15:06:45 +00:00

Add helper count function to Variant

To get counts of items before getting the list, which is useful for
GDNative so users can pre-allocate the buffer with the correct size
without having to get the list twice.
This commit is contained in:
George Marques
2020-12-27 11:09:06 -03:00
parent d55e335026
commit d66a58a4d4
4 changed files with 25 additions and 0 deletions

View File

@@ -437,6 +437,11 @@ void Variant::get_member_list(Variant::Type p_type, List<StringName> *r_members)
}
}
int Variant::get_member_count(Type p_type) {
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, -1);
return variant_setters_getters_names[p_type].size();
}
Variant::ValidatedSetter Variant::get_member_validated_setter(Variant::Type p_type, const StringName &p_member) {
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, nullptr);