[nostalgia/gfx/studio/tilesheet] Ensure config file has a Claw header

This commit is contained in:
Gary Talent 2025-05-24 00:48:54 -05:00
parent 78379f58c8
commit 1e21778059
2 changed files with 27 additions and 24 deletions

View File

@ -67,10 +67,10 @@ static ox::Vector<uint32_t> normalizePixelArrangement(
}
static ox::Error toPngFile(
ox::CStringView const&path,
ox::CStringViewCR path,
ox::Vector<uint32_t> &&pixels,
Palette const &pal,
size_t page,
size_t const page,
unsigned const width,
unsigned const height) noexcept {
for (auto &c : pixels) {
@ -88,7 +88,7 @@ static ox::Error toPngFile(
}
TileSheetEditorImGui::TileSheetEditorImGui(studio::Context &sctx, ox::StringParam path):
Editor(sctx, std::move(path)),
Editor{sctx, std::move(path)},
m_sctx{sctx},
m_tctx{m_sctx.tctx},
m_palPicker{"Palette Chooser", keelCtx(sctx), FileExt_npal},
@ -98,8 +98,11 @@ TileSheetEditorImGui::TileSheetEditorImGui(studio::Context &sctx, ox::StringPara
m_subsheetEditor.inputSubmitted.connect(this, &TileSheetEditorImGui::updateActiveSubsheet);
m_exportMenu.inputSubmitted.connect(this, &TileSheetEditorImGui::exportSubsheetToPng);
// load config
auto const&config = studio::readConfig<TileSheetEditorConfig>(
keelCtx(m_sctx), itemPath());
auto &kctx = keelCtx(m_sctx);
auto const ip = itemPath();
oxLogError(studio::headerizeConfigFile<TileSheetEditorConfig>(kctx, ip));
auto const &config =
studio::readConfig<TileSheetEditorConfig>(kctx, ip);
if (config.ok()) {
m_model.setActiveSubsheet(validateSubSheetIdx(m_model.img(), config.value.activeSubsheet));
}
@ -594,7 +597,7 @@ void TileSheetEditorImGui::drawPaletteMenu() noexcept {
}
ox::Error TileSheetEditorImGui::updateActiveSubsheet(
ox::StringView const&name, int const cols, int const rows) noexcept {
ox::StringViewCR name, int const cols, int const rows) noexcept {
return m_model.updateSubsheet(m_model.activeSubSheetIdx(), name, cols, rows);
}

View File

@ -98,7 +98,7 @@ class TileSheetEditorImGui: public studio::Editor {
void drawPaletteMenu() noexcept;
ox::Error updateActiveSubsheet(ox::StringView const&name, int cols, int rows) noexcept;
ox::Error updateActiveSubsheet(ox::StringViewCR name, int cols, int rows) noexcept;
void setActiveSubsheet(TileSheet::SubSheetIdx path) noexcept;