1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-05 17:15:09 +00:00

Merge pull request #113353 from SatLess/oversight

Prevent double counting and cyclical error when gathering Resources
This commit is contained in:
Rémi Verschelde
2025-12-01 13:38:29 +01:00
2 changed files with 11 additions and 7 deletions

View File

@@ -1815,7 +1815,9 @@ void EditorNode::gather_resources(const Variant &p_variant, List<Ref<Resource>>
r_list.push_back(res);
}
}
gather_resources(v, r_list, p_subresources, p_allow_external);
if (Object::cast_to<Node>(v) == nullptr) {
gather_resources(v, r_list, p_subresources, p_allow_external);
}
}
return;
}
@@ -1839,8 +1841,12 @@ void EditorNode::gather_resources(const Variant &p_variant, List<Ref<Resource>>
r_list.push_back(res_value);
}
}
gather_resources(kv.key, r_list, p_subresources, p_allow_external);
gather_resources(kv.value, r_list, p_subresources, p_allow_external);
if (Object::cast_to<Node>(kv.key) == nullptr) {
gather_resources(kv.key, r_list, p_subresources, p_allow_external);
}
if (Object::cast_to<Node>(kv.value) == nullptr) {
gather_resources(kv.value, r_list, p_subresources, p_allow_external);
}
}
return;
}
@@ -1855,12 +1861,10 @@ void EditorNode::gather_resources(const Variant &p_variant, List<Ref<Resource>>
Variant property_value = p_variant.get(E.name);
Variant::Type property_type = property_value.get_type();
if (property_type == Variant::ARRAY || property_type == Variant::DICTIONARY) {
gather_resources(property_value, r_list, p_subresources, p_allow_external);
continue;
}
Ref<Resource> res = property_value;
if (res.is_null()) {
continue;