[keel,nostalgia/core/studio] Fix asset update notifications

This commit is contained in:
2023-07-15 17:30:26 -05:00
parent 9ceb1df49e
commit 4cf96878a9
4 changed files with 24 additions and 6 deletions

View File

@ -95,6 +95,25 @@ void createUuidMapping(Context *ctx, const ox::String &filePath, const ox::UUID
ox::Error buildUuidMap(Context *ctx) noexcept;
template<typename T>
ox::Result<AssetRef<T>> setAsset(keel::Context *ctx, ox::StringView assetId, T const&asset) noexcept {
#ifndef OX_BARE_METAL
if (assetId.len() == 0) {
return OxError(1, "Invalid asset ID");
}
ox::UUIDStr idStr;
if (assetId[0] == '/') {
const auto [id, err] = ctx->pathToUuid.at(assetId);
oxReturnError(err);
idStr = id->toString();
assetId = idStr;
}
return ctx->assetManager.setAsset(assetId, asset);
#else
return OxError(1, "Not supported on this platform");
#endif
}
template<typename T>
ox::Result<keel::AssetRef<T>> readObj(
keel::Context *ctx,