You've already forked godot
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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user