Profile: fix bug in material saving when array doesn't exist.

This commit is contained in:
Guillaume Jacquemin 2022-12-13 21:03:43 +01:00
parent aff84ccc96
commit b909f0ac13
1 changed files with 4 additions and 0 deletions

View File

@ -458,6 +458,7 @@ auto Profile::setResource(Containers::StringView container, MaterialID id, Int a
if(!mats_prop) {
mats_prop = new ArrayProperty;
mats_prop->name.emplace(container);
mats_prop->itemType = "StructProperty";
_profile.appendProperty(ArrayProperty::ptr{mats_prop});
}
@ -471,6 +472,9 @@ auto Profile::setResource(Containers::StringView container, MaterialID id, Int a
ResourceItemValue* res_prop;
if(it == mats_prop->items.end()) {
res_prop = new ResourceItemValue;
if(mats_prop->items.isEmpty()) {
res_prop->name.emplace("ResourceMaterial");
}
res_prop->id = id;
ResourceItemValue::ptr prop{res_prop};
arrayAppend(mats_prop->items, std::move(prop));