[jasper/world/studio] Integrate new FilePickerPopup
Some checks failed
Build / build (push) Failing after 1m7s

This commit is contained in:
2025-01-23 21:52:35 -06:00
parent 67c796ec04
commit bd461ebeeb
5 changed files with 13 additions and 25 deletions

View File

@@ -28,7 +28,8 @@ WorldObjectSetEditorImGui::WorldObjectSetEditorImGui(
m_sctx(ctx),
m_itemPath(itemPath()),
m_doc(*readObj<WorldObjectSet>(keelCtx(m_sctx), itemPath()).unwrapThrow()),
m_tileSheet(readObj<ngfx::TileSheet>(keelCtx(m_sctx), m_doc.tilesheet).unwrapThrow()) {
m_tileSheet(readObj<ngfx::TileSheet>(keelCtx(m_sctx), m_doc.tilesheet).unwrapThrow()),
m_addPalPopup{"Palette Chooser", keelCtx(m_sctx), ngfx::FileExt_npal} {
auto &kctx = keelCtx(m_sctx);
auto const [tsPath, err] = getPath(kctx, m_doc.tilesheet);
if (!err) {
@@ -308,19 +309,8 @@ void WorldObjectSetEditorImGui::drawPaletteListItems() noexcept {
}
void WorldObjectSetEditorImGui::drawAddPalettePopup() noexcept {
if (!m_addPalPopup.show) {
return;
}
auto constexpr popupName = ox::CStringView("Add Palette");
auto constexpr popupSz = ImVec2{285.f, 0};
ig::IDStackItem const idStackItem{"AddPalette"};
if (ig::BeginPopup(m_sctx.tctx, popupName, m_addPalPopup.show, popupSz)) {
auto const&palettes = m_sctx.project->fileList(ngfx::FileExt_npal);
ig::ComboBox("Palette", palettes, m_addPalPopup.selectedIdx);
if (ig::PopupControlsOkCancel(popupSz.x, m_addPalPopup.show) == ig::PopupResponse::OK) {
addPalette(palettes[m_addPalPopup.selectedIdx]);
}
ImGui::EndPopup();
if (auto o = m_addPalPopup.draw(m_sctx)) {
addPalette(*o);
}
}
@@ -338,8 +328,7 @@ void WorldObjectSetEditorImGui::addPalette(ox::StringViewCR path) noexcept {
}
void WorldObjectSetEditorImGui::showAddPalette() noexcept {
m_addPalPopup.show = true;
m_addPalPopup.selectedIdx = 0;
m_addPalPopup.open();
}
void WorldObjectSetEditorImGui::rmSelectedPalette() noexcept {

View File

@@ -24,10 +24,7 @@ class WorldObjectSetEditorImGui: public studio::Editor {
size_t m_selectedObj{};
size_t m_selectedPal{};
ox::String m_tilesheetPath{};
struct {
bool show{};
size_t selectedIdx{};
} m_addPalPopup;
studio::FilePickerPopup m_addPalPopup;
CollisionView m_colView{m_sctx};
struct {
ox::IString<256> nameBuff;