Merge commit 'f48824793cfce315971fe2e699ece198c7a79407'
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
namespace keel {
|
||||
|
||||
class Context;
|
||||
using PackTransform = ox::Error(*)(Context&, ox::Buffer &clawData, ox::StringView);
|
||||
using PackTransform = ox::Result<bool>(*)(Context&, ox::Buffer &clawData, ox::StringView);
|
||||
|
||||
class Context {
|
||||
public:
|
||||
|
@ -162,11 +162,12 @@ ox::Result<ox::Buffer> convertBuffToBuff(
|
||||
}
|
||||
|
||||
template<typename From, typename To, ox::ClawFormat fmt = ox::ClawFormat::Metal>
|
||||
auto transformRule(keel::Context &ctx, ox::Buffer &buff, ox::StringView typeId) noexcept -> ox::Error {
|
||||
ox::Result<bool> transformRule(keel::Context &ctx, ox::Buffer &buff, ox::StringView typeId) noexcept {
|
||||
if (typeId == ox::ModelTypeId_v<From>) {
|
||||
oxReturnError(keel::convertBuffToBuff<To>(ctx, buff, fmt).moveTo(buff));
|
||||
return true;
|
||||
}
|
||||
return {};
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
|
@ -102,9 +102,13 @@ ox::Result<ox::String> uuidToPath(Context &ctx, ox::UUID const&uuid) noexcept {
|
||||
}
|
||||
|
||||
ox::Error performPackTransforms(Context &ctx, ox::Buffer &clawData) noexcept {
|
||||
oxRequire(typeId, readAssetTypeId(clawData).to<ox::String>());
|
||||
oxRequireM(typeId, readAssetTypeId(clawData));
|
||||
for (auto const tr : packTransforms(ctx)) {
|
||||
oxReturnError(tr(ctx, clawData, typeId));
|
||||
bool changed{};
|
||||
oxReturnError(tr(ctx, clawData, typeId).moveTo(changed));
|
||||
if (changed) {
|
||||
oxReturnError(readAssetTypeId(clawData).moveTo(typeId));
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
Reference in New Issue
Block a user