From b225d976f53eab9299f12e9330836b0cd3e7608b Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 5 Mar 2022 17:49:12 -0600 Subject: [PATCH] [nostalgia/core/studio] Cleanup --- src/nostalgia/core/studio/tilesheeteditor-imgui.cpp | 6 +++++- src/nostalgia/core/studio/tilesheeteditor-imgui.hpp | 2 ++ src/nostalgia/core/studio/tilesheeteditormodel.cpp | 4 ++-- src/nostalgia/core/studio/tilesheeteditormodel.hpp | 2 +- src/nostalgia/core/studio/tilesheetpixels.cpp | 1 - 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp b/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp index d950e9f1..89aed650 100644 --- a/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp +++ b/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp @@ -16,7 +16,7 @@ TileSheetEditorImGui::TileSheetEditorImGui(Context *ctx, const ox::String &path) const auto lastSlash = std::find(m_itemPath.rbegin(), m_itemPath.rend(), '/').offset(); m_itemName = m_itemPath.substr(lastSlash + 1); undoStack()->changeTriggered.connect(this, &TileSheetEditorImGui::markUnsavedChanges); - m_subsheetEditor.inputSubmitted.connect(model(), &TileSheetEditorModel::updateActiveSubsheet); + m_subsheetEditor.inputSubmitted.connect(this, &TileSheetEditorImGui::updateActiveSubsheet); } ox::String TileSheetEditorImGui::itemName() const noexcept { @@ -232,6 +232,10 @@ void TileSheetEditorImGui::drawPalettePicker() noexcept { } } +ox::Error TileSheetEditorImGui::updateActiveSubsheet(const ox::String &name, int cols, int rows) noexcept { + return model()->updateSubsheet(model()->activeSubSheetIdx(), name, cols, rows); +} + ox::Error TileSheetEditorImGui::markUnsavedChanges(int) noexcept { setUnsavedChanges(true); return OxError(0); diff --git a/src/nostalgia/core/studio/tilesheeteditor-imgui.hpp b/src/nostalgia/core/studio/tilesheeteditor-imgui.hpp index d4924d48..7cc708a4 100644 --- a/src/nostalgia/core/studio/tilesheeteditor-imgui.hpp +++ b/src/nostalgia/core/studio/tilesheeteditor-imgui.hpp @@ -97,6 +97,8 @@ class TileSheetEditorImGui: public studio::Editor { void drawPalettePicker() noexcept; + ox::Error updateActiveSubsheet(const ox::String &name, int cols, int rows) noexcept; + // slots private: ox::Error updateAfterClicked() noexcept; diff --git a/src/nostalgia/core/studio/tilesheeteditormodel.cpp b/src/nostalgia/core/studio/tilesheeteditormodel.cpp index 1724d75f..7507744c 100644 --- a/src/nostalgia/core/studio/tilesheeteditormodel.cpp +++ b/src/nostalgia/core/studio/tilesheeteditormodel.cpp @@ -55,8 +55,8 @@ void TileSheetEditorModel::rmSubsheet(const TileSheet::SubSheetIdx &idx) noexcep pushCommand(new RmSubSheetCommand(&m_img, idx)); } -ox::Error TileSheetEditorModel::updateActiveSubsheet(const ox::String &name, int cols, int rows) noexcept { - pushCommand(new UpdateSubSheetCommand(&m_img, m_activeSubsSheetIdx, name, cols, rows)); +ox::Error TileSheetEditorModel::updateSubsheet(const TileSheet::SubSheetIdx &idx, const ox::String &name, int cols, int rows) noexcept { + pushCommand(new UpdateSubSheetCommand(&m_img, idx, name, cols, rows)); return OxError(0); } diff --git a/src/nostalgia/core/studio/tilesheeteditormodel.hpp b/src/nostalgia/core/studio/tilesheeteditormodel.hpp index 6568cc52..cc0365ce 100644 --- a/src/nostalgia/core/studio/tilesheeteditormodel.hpp +++ b/src/nostalgia/core/studio/tilesheeteditormodel.hpp @@ -303,7 +303,7 @@ class TileSheetEditorModel: public ox::SignalHandler { void rmSubsheet(const TileSheet::SubSheetIdx &idx) noexcept; - ox::Error updateActiveSubsheet(const ox::String &name, int cols, int rows) noexcept; + ox::Error updateSubsheet(const TileSheet::SubSheetIdx &idx, const ox::String &name, int cols, int rows) noexcept; void setActiveSubsheet(const TileSheet::SubSheetIdx&) noexcept; diff --git a/src/nostalgia/core/studio/tilesheetpixels.cpp b/src/nostalgia/core/studio/tilesheetpixels.cpp index 16aba39a..3fa7c427 100644 --- a/src/nostalgia/core/studio/tilesheetpixels.cpp +++ b/src/nostalgia/core/studio/tilesheetpixels.cpp @@ -82,7 +82,6 @@ void TileSheetPixels::setBufferObjects(const geo::Vec2 &paneSize, const TileShee // set buffer lengths const auto width = subSheet.columns * TileWidth; const auto height = subSheet.rows * TileHeight; - oxDebugf("rows: {}", subSheet.rows); const auto pixels = static_cast(width * height); m_bufferSet.vertices.resize(pixels * VertexVboLength); m_bufferSet.elements.resize(pixels * VertexEboLength);