Ensure skin is saved immediately after becoming mutable

Without doing this, the JSON content is not written to the file. A user
assumption is that as soon as a skin shows up in the skin list as
exportable, it should export correctly, so it makes sense that it should
be in a sane state even if the user has not made any changes in the skin
editor yet.

Going forward, we might move more of the json serialisation logic out,
and run for consistency as part of the import process. This seems like
the simplest way to guarantee things for now, though.
This commit is contained in:
Dean Herbert 2021-12-02 17:42:16 +09:00
parent fe99d4e984
commit 0e82e9355b
1 changed files with 6 additions and 0 deletions

View File

@ -156,7 +156,13 @@ public void EnsureMutableSkin()
}).Result;
if (result != null)
{
// save once to ensure the required json content is populated.
// currently this only happens on save.
result.PerformRead(skin => Save(skin.CreateInstance(this)));
CurrentSkinInfo.Value = result;
}
});
}