[nostalgia/core/studio] Cleanup

This commit is contained in:
Gary Talent 2022-03-05 17:49:12 -06:00
parent f40c912365
commit b225d976f5
5 changed files with 10 additions and 5 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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<unsigned>(width * height);
m_bufferSet.vertices.resize(pixels * VertexVboLength);
m_bufferSet.elements.resize(pixels * VertexEboLength);