This commit is contained in:
parent
72f4db3d5e
commit
df44fe235b
@ -63,10 +63,8 @@ namespace detail {
|
||||
template<typename T>
|
||||
constexpr auto makeLoader(Context &ctx) {
|
||||
return [&ctx](ox::StringView assetId) -> ox::Result<T> {
|
||||
ox::StringView path;
|
||||
oxRequire(p, ctx.uuidToPath.at(assetId));
|
||||
path = *p;
|
||||
oxRequire(buff, ctx.rom->read(path));
|
||||
oxRequire(buff, ctx.rom->read(*p));
|
||||
auto [obj, err] = readAsset<T>(buff);
|
||||
if (err) {
|
||||
if (err != ox::Error_ClawTypeVersionMismatch && err != ox::Error_ClawTypeMismatch) {
|
||||
@ -84,21 +82,17 @@ ox::Result<keel::AssetRef<T>> readObjFile(
|
||||
keel::Context &ctx,
|
||||
ox::StringView assetId,
|
||||
bool forceLoad) noexcept {
|
||||
ox::UUIDStr uuidStr;
|
||||
if (beginsWith(assetId, "uuid://")) {
|
||||
assetId = substr(assetId, 7);
|
||||
oxRequire(p, keel::uuidToPath(ctx, assetId));
|
||||
} else {
|
||||
auto const [uuid, uuidErr] = getUuid(ctx, assetId);
|
||||
if (!uuidErr) {
|
||||
uuidStr = uuid.toString();
|
||||
assetId = uuidStr;
|
||||
assetId = uuid.toString();
|
||||
}
|
||||
}
|
||||
if (forceLoad) {
|
||||
ctx.assetManager.initTypeManager<T>(detail::makeLoader<T>, ctx);
|
||||
oxRequire(cached, ctx.assetManager.loadAsset<T>(assetId));
|
||||
return cached;
|
||||
return ctx.assetManager.loadAsset<T>(assetId);
|
||||
} else {
|
||||
auto [cached, err] = ctx.assetManager.getAsset<T>(assetId);
|
||||
if (err) {
|
||||
|
Loading…
Reference in New Issue
Block a user