[nostalgia/core/studio] Make TileSheetEditorModel write type descriptor

This commit is contained in:
Gary Talent 2022-02-21 19:55:24 -06:00
parent 5c28ebe6d7
commit 917d88f997

View File

@ -16,8 +16,7 @@ TileSheetEditorModel::TileSheetEditorModel(Context *ctx, const ox::String &path)
oxRequireT(img, readObj<TileSheet>(ctx, path.c_str()));
m_img = *img;
oxThrowError(readObj<Palette>(ctx, m_img.defaultPalette).moveTo(&m_pal));
m_undoStack.undoTriggered.connect(this, &TileSheetEditorModel::markUpdated);
m_undoStack.redoTriggered.connect(this, &TileSheetEditorModel::markUpdated);
m_undoStack.changeTriggered.connect(this, &TileSheetEditorModel::markUpdated);
}
void TileSheetEditorModel::cut() {
@ -58,8 +57,8 @@ void TileSheetEditorModel::ackUpdate() noexcept {
}
ox::Error TileSheetEditorModel::saveFile() noexcept {
oxRequire(buff, ox::writeClaw(&m_img));
oxReturnError(m_ctx->rom->write(m_path.c_str(), buff.data(), buff.size()));
auto sctx = applicationData<studio::StudioContext>(m_ctx);
oxReturnError(sctx->project->writeObj(m_path, &m_img));
return m_ctx->assetManager.setAsset(m_path, m_img).error;
}
@ -101,4 +100,4 @@ void TileSheetEditorModel::pushCommand(studio::UndoCommand *cmd) noexcept {
m_updated = true;
}
}
}