[keel] Remove setAsset
All checks were successful
Build / build (push) Successful in 2m36s

This commit is contained in:
Gary Talent 2024-05-27 21:13:17 -05:00
parent 27b38ed250
commit f189469926
3 changed files with 0 additions and 52 deletions

View File

@ -50,7 +50,6 @@ void SceneEditorImGui::onActivated() noexcept {
ox::Error SceneEditorImGui::saveItem() noexcept { ox::Error SceneEditorImGui::saveItem() noexcept {
const auto sctx = applicationData<studio::StudioContext>(m_ctx); const auto sctx = applicationData<studio::StudioContext>(m_ctx);
oxReturnError(sctx->project->writeObj(itemPath(), m_editor.scene())); oxReturnError(sctx->project->writeObj(itemPath(), m_editor.scene()));
oxReturnError(keelCtx(m_ctx).assetManager.setAsset(itemPath(), m_editor.scene()));
return {}; return {};
} }

View File

@ -212,28 +212,6 @@ class AssetManager {
return AssetRef<T>(out->get()); return AssetRef<T>(out->get());
} }
ox::Result<AssetRef<T>> setAsset(ox::StringView const assetId, T const&obj) noexcept {
auto &p = m_cache[assetId];
if (!p) {
p = ox::make_unique<AssetContainer<T>>(obj);
} else {
p->set(obj);
p->updated.emit();
}
return AssetRef<T>(p.get());
}
ox::Result<AssetRef<T>> setAsset(ox::StringView const assetId, T &&obj) noexcept {
auto &p = m_cache[assetId];
if (!p) {
p = ox::make_unique<AssetContainer<T>>(obj);
} else {
p->set(std::move(obj));
p->updated.emit();
}
return AssetRef<T>(p.get());
}
ox::Result<AssetRef<T>> loadAsset(ox::StringView const assetId) noexcept { ox::Result<AssetRef<T>> loadAsset(ox::StringView const assetId) noexcept {
auto &p = m_cache[assetId]; auto &p = m_cache[assetId];
oxRequireM(obj, m_loader(assetId)); oxRequireM(obj, m_loader(assetId));
@ -303,13 +281,6 @@ class AssetManager {
return m->getAsset(assetId); return m->getAsset(assetId);
} }
template<typename T>
ox::Result<AssetRef<T>> setAsset(ox::StringView assetId, T const&obj) noexcept {
oxRequire(m, getTypeManager<T>());
oxReturnError(m->setAsset(assetId, obj));
return {};
}
ox::Error reloadAsset(ox::StringView assetId) noexcept { ox::Error reloadAsset(ox::StringView assetId) noexcept {
m_fileTrackers[assetId].updated.emit(assetId); m_fileTrackers[assetId].updated.emit(assetId);
return {}; return {};

View File

@ -129,28 +129,6 @@ ox::Result<keel::AssetRef<T>> readObjNoCache(
ox::Error reloadAsset(keel::Context &ctx, ox::StringView assetId) noexcept; ox::Error reloadAsset(keel::Context &ctx, ox::StringView assetId) 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 uuidStr;
if (assetId[0] == '/') {
oxRequire(id, ctx.pathToUuid.at(assetId));
uuidStr = id->toString();
assetId = uuidStr;
}
ctx.assetManager.initTypeManager<T>(detail::makeLoader<T>, ctx);
return ctx.assetManager.setAsset(assetId, asset);
#else
return OxError(1, "Not supported on this platform");
#endif
}
template<typename T> template<typename T>
ox::Result<keel::AssetRef<T>> readObj( ox::Result<keel::AssetRef<T>> readObj(
keel::Context &ctx, keel::Context &ctx,