Merge commit '09b4a705a9251d54e797eb75db1f3d4687829a24'

This commit is contained in:
2025-04-16 19:48:37 -05:00
32 changed files with 3065 additions and 87 deletions

View File

@@ -183,8 +183,8 @@ ox::Error TileSheetV4ToTileSheetV5Converter::convert(
keel::Context&,
TileSheetV4 &src,
TileSheetV5 &dst) const noexcept {
dst.bpp = src.bpp;
dst.idIt = src.idIt;
dst.bpp = src.bpp;
dst.idIt = src.idIt;
OX_RETURN_ERROR(src.defaultPalette.getPath().moveTo(dst.defaultPalette));
convertSubsheet(dst.bpp, src.subsheet, dst.subsheet);
return {};

View File

@@ -96,7 +96,7 @@ TileSheetEditorImGui::TileSheetEditorImGui(studio::StudioContext &sctx, ox::Stri
m_model{m_view.model()} {
// connect signal/slots
m_subsheetEditor.inputSubmitted.connect(this, &TileSheetEditorImGui::updateActiveSubsheet);
m_exportMenu.inputSubmitted.connect(this, &TileSheetEditorImGui::exportSubhseetToPng);
m_exportMenu.inputSubmitted.connect(this, &TileSheetEditorImGui::exportSubsheetToPng);
// load config
auto const&config = studio::readConfig<TileSheetEditorConfig>(
keelCtx(m_sctx), itemPath());
@@ -397,7 +397,7 @@ void TileSheetEditorImGui::showSubsheetEditor() noexcept {
}
}
ox::Error TileSheetEditorImGui::exportSubhseetToPng(int const scale) const noexcept {
ox::Error TileSheetEditorImGui::exportSubsheetToPng(int const scale) const noexcept {
OX_REQUIRE(path, studio::saveFile({{"PNG", "png"}}));
// subsheet to png
auto const&s = m_model.activeSubSheet();

View File

@@ -10,7 +10,6 @@
#include <studio/editor.hpp>
#include <studio/filepickerpopup.hpp>
#include "tilesheetpixelgrid.hpp"
#include "tilesheetpixels.hpp"
#include "tilesheeteditorview.hpp"
@@ -91,7 +90,7 @@ class TileSheetEditorImGui: public studio::Editor {
private:
void showSubsheetEditor() noexcept;
ox::Error exportSubhseetToPng(int scale) const noexcept;
ox::Error exportSubsheetToPng(int scale) const noexcept;
void drawTileSheet(ox::Vec2 const&fbSize) noexcept;
@@ -99,8 +98,6 @@ class TileSheetEditorImGui: public studio::Editor {
ox::Error updateActiveSubsheet(ox::StringView const&name, int cols, int rows) noexcept;
// slots
private:
void setActiveSubsheet(TileSheet::SubSheetIdx path) noexcept;
};

View File

@@ -120,7 +120,7 @@ bool TileSheetEditorModel::acceptsClipboardPayload() const noexcept {
return cb.ok();
}
ox::StringView TileSheetEditorModel::palPath() const noexcept {
ox::String const &TileSheetEditorModel::palPath() const & noexcept {
return m_palPath;
}
@@ -263,7 +263,13 @@ ox::Error TileSheetEditorModel::rotateRight() noexcept {
}
void TileSheetEditorModel::setSelection(studio::Selection const&sel) noexcept {
m_selection.emplace(sel);
auto const &ss = activeSubSheet();
if (sel.a.x < ss.columns * TileWidth && sel.a.y < ss.rows * TileHeight) {
m_selection.emplace(sel);
} else {
m_selTracker.finishSelection();
m_selection.reset();
}
m_updated = true;
}

View File

@@ -62,7 +62,7 @@ class TileSheetEditorModel: public ox::SignalHandler {
constexpr Palette const&pal() const noexcept;
[[nodiscard]]
ox::StringView palPath() const noexcept;
ox::String const &palPath() const & noexcept;
ox::Error setPalette(ox::StringViewCR path) noexcept;