Profile: setResource() now can create an array if it's missing.

This commit is contained in:
Guillaume Jacquemin 2022-11-21 18:59:30 +01:00
parent fb6246cff7
commit bf820f65ec

View file

@ -412,9 +412,9 @@ auto Profile::setResource(Containers::StringView container, MaterialID id, Int a
auto mats_prop = _profile.at<ArrayProperty>(container); auto mats_prop = _profile.at<ArrayProperty>(container);
if(!mats_prop) { if(!mats_prop) {
_lastError = "Couldn't find "_s + container + " in "_s + _filename; mats_prop = new ArrayProperty;
_valid = false; mats_prop->name.emplace(container);
return false; _profile.appendProperty(ArrayProperty::ptr{mats_prop});
} }
auto predicate = [&id](UnrealPropertyBase::ptr& prop){ auto predicate = [&id](UnrealPropertyBase::ptr& prop){