Compare commits

..

No commits in common. "465fb06f767d95a8771bd2104f3366f1cbb62695" and "83cbac5cca8895392c185dc3dc519532344b9172" have entirely different histories.

3 changed files with 8 additions and 16 deletions

View File

@ -233,12 +233,10 @@ struct TileSheetV4 {
[[nodiscard]] [[nodiscard]]
constexpr bool valid(TileSheetV4::SubSheet const&ss, int bpp) noexcept { constexpr bool valid(TileSheetV4::SubSheet const&ss, int bpp) noexcept {
auto const bytes = static_cast<size_t>(ss.columns * ss.rows * PixelsPerTile) / (bpp == 4 ? 2 : 1); auto const bytes = static_cast<size_t>(ss.columns * ss.rows * PixelsPerTile) / (bpp == 4 ? 2 : 1);
return return ox::all_of(ss.subsheets.begin(), ss.subsheets.end(),
(ss.pixels.empty() || ss.subsheets.empty()) && [bpp, bytes](TileSheetV4::SubSheet const&s) {
ox::all_of(ss.subsheets.begin(), ss.subsheets.end(), return bytes == s.pixels.size() && valid(s, bpp);
[bpp, bytes](TileSheetV4::SubSheet const&s) { });
return bytes == s.pixels.size() && valid(s, bpp);
});
} }
[[nodiscard]] [[nodiscard]]
@ -247,14 +245,8 @@ constexpr bool valid(TileSheetV4 const&ts) noexcept {
} }
constexpr void repair(TileSheetV4::SubSheet &ss, int bpp) noexcept { constexpr void repair(TileSheetV4::SubSheet &ss, int bpp) noexcept {
if (ss.subsheets.empty()) { auto const bytes = static_cast<size_t>(ss.columns * ss.rows * PixelsPerTile) / (bpp == 4 ? 2 : 1);
auto const bytes = static_cast<size_t>(ss.columns * ss.rows * PixelsPerTile) / (bpp == 4 ? 2 : 1); ss.pixels.resize(bytes);
ss.pixels.resize(bytes);
} else {
ss.pixels.clear();
ss.columns = -1;
ss.rows = -1;
}
for (auto &s : ss.subsheets) { for (auto &s : ss.subsheets) {
repair(s, bpp); repair(s, bpp);
} }

View File

@ -544,7 +544,7 @@ void TileSheetEditorImGui::SubSheetEditor::draw(turbine::Context &tctx) noexcept
auto const popupHeight = modSize ? 130.f : 85.f; auto const popupHeight = modSize ? 130.f : 85.f;
auto const popupSz = ImVec2{popupWidth, popupHeight}; auto const popupSz = ImVec2{popupWidth, popupHeight};
if (ig::BeginPopup(tctx, popupName, m_show, popupSz)) { if (ig::BeginPopup(tctx, popupName, m_show, popupSz)) {
ig::InputText("Name", m_name); ImGui::InputText("Name", m_name.data(), m_name.cap());
if (modSize) { if (modSize) {
ImGui::InputInt("Columns", &m_cols); ImGui::InputInt("Columns", &m_cols);
ImGui::InputInt("Rows", &m_rows); ImGui::InputInt("Rows", &m_rows);

View File

@ -50,7 +50,7 @@ void NewProject::draw(studio::StudioContext &ctx) noexcept {
void NewProject::drawNewProjectName(studio::StudioContext &sctx) noexcept { void NewProject::drawNewProjectName(studio::StudioContext &sctx) noexcept {
drawWindow(sctx.tctx, &m_open, [this, &sctx] { drawWindow(sctx.tctx, &m_open, [this, &sctx] {
ig::InputText("Name", m_projectName); ImGui::InputText("Name", m_projectName.data(), m_projectName.cap());
ImGui::Text("Path: %s", m_projectPath.c_str()); ImGui::Text("Path: %s", m_projectPath.c_str());
if (ImGui::Button("Browse")) { if (ImGui::Button("Browse")) {
oxLogError(studio::chooseDirectory().moveTo(m_projectPath)); oxLogError(studio::chooseDirectory().moveTo(m_projectPath));