You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Merge pull request #104047 from YYF233333/dict_iter
Add const iteration support to `Dictionary`
This commit is contained in:
@@ -1286,11 +1286,9 @@ Variant Variant::get(const Variant &p_index, bool *r_valid, VariantGetError *err
|
||||
void Variant::get_property_list(List<PropertyInfo> *p_list) const {
|
||||
if (type == DICTIONARY) {
|
||||
const Dictionary *dic = reinterpret_cast<const Dictionary *>(_data._mem);
|
||||
List<Variant> keys;
|
||||
dic->get_key_list(&keys);
|
||||
for (const Variant &E : keys) {
|
||||
if (E.is_string()) {
|
||||
p_list->push_back(PropertyInfo(dic->get_valid(E).get_type(), E));
|
||||
for (const KeyValue<Variant, Variant> &kv : *dic) {
|
||||
if (kv.key.is_string()) {
|
||||
p_list->push_back(PropertyInfo(dic->get_valid(kv.key).get_type(), kv.key));
|
||||
}
|
||||
}
|
||||
} else if (type == OBJECT) {
|
||||
|
||||
Reference in New Issue
Block a user