[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): TileSheetEditorModel::TileSheetEditorModel(turbine::Context &ctx, ox::StringView path):
m_ctx(ctx), m_ctx(ctx),
m_path(path) { m_path(path),
oxRequireT(img, readObj<TileSheet>(keelCtx(m_ctx), m_path)); m_img(*readObj<TileSheet>(keelCtx(m_ctx), m_path).unwrapThrow()),
m_img = *img; // ignore failure to load palette
if (m_img.defaultPalette) { m_pal(readObj<Palette>(keelCtx(m_ctx), m_img.defaultPalette).value) {
oxThrowError(readObj<Palette>(keelCtx(m_ctx), m_img.defaultPalette).moveTo(&m_pal));
}
m_pal.updated.connect(this, &TileSheetEditorModel::markUpdated); m_pal.updated.connect(this, &TileSheetEditorModel::markUpdated);
m_undoStack.changeTriggered.connect(this, &TileSheetEditorModel::markUpdatedCmdId); m_undoStack.changeTriggered.connect(this, &TileSheetEditorModel::markUpdatedCmdId);
} }

View File

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