[nostalgia/gfx/studio/tilesheet] Ensure config file has a Claw header
This commit is contained in:
parent
78379f58c8
commit
1e21778059
@ -67,10 +67,10 @@ static ox::Vector<uint32_t> normalizePixelArrangement(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ox::Error toPngFile(
|
static ox::Error toPngFile(
|
||||||
ox::CStringView const&path,
|
ox::CStringViewCR path,
|
||||||
ox::Vector<uint32_t> &&pixels,
|
ox::Vector<uint32_t> &&pixels,
|
||||||
Palette const &pal,
|
Palette const &pal,
|
||||||
size_t page,
|
size_t const page,
|
||||||
unsigned const width,
|
unsigned const width,
|
||||||
unsigned const height) noexcept {
|
unsigned const height) noexcept {
|
||||||
for (auto &c : pixels) {
|
for (auto &c : pixels) {
|
||||||
@ -88,7 +88,7 @@ static ox::Error toPngFile(
|
|||||||
}
|
}
|
||||||
|
|
||||||
TileSheetEditorImGui::TileSheetEditorImGui(studio::Context &sctx, ox::StringParam path):
|
TileSheetEditorImGui::TileSheetEditorImGui(studio::Context &sctx, ox::StringParam path):
|
||||||
Editor(sctx, std::move(path)),
|
Editor{sctx, std::move(path)},
|
||||||
m_sctx{sctx},
|
m_sctx{sctx},
|
||||||
m_tctx{m_sctx.tctx},
|
m_tctx{m_sctx.tctx},
|
||||||
m_palPicker{"Palette Chooser", keelCtx(sctx), FileExt_npal},
|
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_subsheetEditor.inputSubmitted.connect(this, &TileSheetEditorImGui::updateActiveSubsheet);
|
||||||
m_exportMenu.inputSubmitted.connect(this, &TileSheetEditorImGui::exportSubsheetToPng);
|
m_exportMenu.inputSubmitted.connect(this, &TileSheetEditorImGui::exportSubsheetToPng);
|
||||||
// load config
|
// load config
|
||||||
auto const&config = studio::readConfig<TileSheetEditorConfig>(
|
auto &kctx = keelCtx(m_sctx);
|
||||||
keelCtx(m_sctx), itemPath());
|
auto const ip = itemPath();
|
||||||
|
oxLogError(studio::headerizeConfigFile<TileSheetEditorConfig>(kctx, ip));
|
||||||
|
auto const &config =
|
||||||
|
studio::readConfig<TileSheetEditorConfig>(kctx, ip);
|
||||||
if (config.ok()) {
|
if (config.ok()) {
|
||||||
m_model.setActiveSubsheet(validateSubSheetIdx(m_model.img(), config.value.activeSubsheet));
|
m_model.setActiveSubsheet(validateSubSheetIdx(m_model.img(), config.value.activeSubsheet));
|
||||||
}
|
}
|
||||||
@ -594,7 +597,7 @@ void TileSheetEditorImGui::drawPaletteMenu() noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ox::Error TileSheetEditorImGui::updateActiveSubsheet(
|
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);
|
return m_model.updateSubsheet(m_model.activeSubSheetIdx(), name, cols, rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class TileSheetEditorImGui: public studio::Editor {
|
|||||||
|
|
||||||
void drawPaletteMenu() noexcept;
|
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;
|
void setActiveSubsheet(TileSheet::SubSheetIdx path) noexcept;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user