[nostalgia/core/studio] Cleanup TileSheetEditor constructor

This commit is contained in:
Gary Talent 2023-12-09 17:12:04 -06:00
parent 1c4fb80702
commit 500c012713
2 changed files with 6 additions and 8 deletions

View File

@ -566,12 +566,10 @@ class PaletteChangeCommand: public TileSheetCommand {
TileSheetEditorModel::TileSheetEditorModel(turbine::Context &ctx, ox::StringView path):
m_ctx(ctx),
m_path(path) {
oxRequireT(img, readObj<TileSheet>(keelCtx(m_ctx), m_path));
m_img = *img;
if (m_img.defaultPalette) {
oxThrowError(readObj<Palette>(keelCtx(m_ctx), m_img.defaultPalette).moveTo(&m_pal));
}
m_path(path),
m_img(*readObj<TileSheet>(keelCtx(m_ctx), m_path).unwrapThrow()),
// ignore failure to load palette
m_pal(readObj<Palette>(keelCtx(m_ctx), m_img.defaultPalette).value) {
m_pal.updated.connect(this, &TileSheetEditorModel::markUpdated);
m_undoStack.changeTriggered.connect(this, &TileSheetEditorModel::markUpdatedCmdId);
}

View File

@ -24,14 +24,14 @@ class TileSheetEditorModel: public ox::SignalHandler {
private:
static const Palette s_defaultPalette;
turbine::Context &m_ctx;
ox::String m_path;
TileSheet m_img;
TileSheet::SubSheetIdx m_activeSubsSheetIdx;
keel::AssetRef<Palette> m_pal;
studio::UndoStack m_undoStack;
class DrawCommand *m_ongoingDrawCommand = nullptr;
bool m_updated = false;
turbine::Context &m_ctx;
ox::String m_path;
bool m_selectionOngoing = false;
ox::Point m_selectionOrigin = {-1, -1};
ox::Bounds m_selectionBounds = {{-1, -1}, {-1, -1}};