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