diff --git a/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp b/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp index 89aed6500..89f59bd96 100644 --- a/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp +++ b/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp @@ -248,10 +248,12 @@ void TileSheetEditorImGui::SubSheetEditor::draw() noexcept { return; } ImGui::OpenPopup(popupName); - ImGui::SetNextWindowSize(ImVec2(235, 125)); + const auto modSize = m_cols > 0; + const auto popupHeight = modSize ? 125.f : 80.f; + ImGui::SetNextWindowSize(ImVec2(235, popupHeight)); if (ImGui::BeginPopupModal(popupName, &m_show, modalFlags)) { ImGui::InputText("Name", m_name.data(), m_name.cap()); - if (m_cols != -1) { + if (modSize) { ImGui::InputInt("Columns", &m_cols); ImGui::InputInt("Rows", &m_rows); } diff --git a/src/nostalgia/core/studio/tilesheeteditormodel.hpp b/src/nostalgia/core/studio/tilesheeteditormodel.hpp index cc0365ce5..c4d35d681 100644 --- a/src/nostalgia/core/studio/tilesheeteditormodel.hpp +++ b/src/nostalgia/core/studio/tilesheeteditormodel.hpp @@ -206,7 +206,12 @@ struct UpdateSubSheetCommand: public studio::UndoCommand { sheet.name = m_newName; sheet.columns = m_newCols; sheet.rows = m_newRows; - oxLogError(sheet.setPixelCount(m_img->bpp, static_cast(m_newCols * m_newRows))); + oxDebugf("old cols: {}, old rows: {}", sheet.columns, sheet.rows); + oxDebugf("new cols: {}, new rows: {}", m_newCols, m_newRows); + oxDebugf("bpp: {}", m_img->bpp); + oxDebugf("pixel count before: {}", sheet.pixels.size()); + oxLogError(sheet.setPixelCount(m_img->bpp, static_cast(PixelsPerTile * m_newCols * m_newRows))); + oxDebugf("pixel count after: {}", sheet.pixels.size()); } void undo() noexcept final {