[jasper/world/studio] Make executing UndoCommands report errors
All checks were successful
Build / build (push) Successful in 3m8s

This commit is contained in:
Gary Talent 2024-05-23 21:50:44 -05:00
parent 058bc5c438
commit 2a55a5762d
2 changed files with 15 additions and 15 deletions

View File

@ -159,10 +159,10 @@ void WorldEditorImGui::drawPropEditor() noexcept {
int width{m_doc.columns}; int width{m_doc.columns};
int height{m_doc.rows}; int height{m_doc.rows};
if (ImGui::InputInt("Map Width", &width, 1)) { if (ImGui::InputInt("Map Width", &width, 1)) {
pushCommand<EditWorldSizeCommand>(m_objCache, m_doc, m_worldStatic, ox::Size{width, m_doc.rows}); std::ignore = pushCommand<EditWorldSizeCommand>(m_objCache, m_doc, m_worldStatic, ox::Size{width, m_doc.rows});
} }
if (ImGui::InputInt("Map Height", &height, 1)) { if (ImGui::InputInt("Map Height", &height, 1)) {
pushCommand<EditWorldSizeCommand>(m_objCache, m_doc, m_worldStatic, ox::Size{m_doc.columns, height}); std::ignore = pushCommand<EditWorldSizeCommand>(m_objCache, m_doc, m_worldStatic, ox::Size{m_doc.columns, height});
} }
} }
@ -211,7 +211,7 @@ void WorldEditorImGui::drawWorldView() noexcept {
static_cast<float>(viewSz.width) * fbPaneScale, static_cast<float>(viewSz.width) * fbPaneScale,
static_cast<float>(viewSz.height) * fbPaneScale}); static_cast<float>(viewSz.height) * fbPaneScale});
if (tileAddr.x < m_doc.columns && tileAddr.y < m_doc.rows) { if (tileAddr.x < m_doc.columns && tileAddr.y < m_doc.rows) {
pushCommand<ModifyTilesCommand>( std::ignore = pushCommand<ModifyTilesCommand>(
m_doc, m_doc,
m_worldStatic, m_worldStatic,
m_objCache, m_objCache,
@ -231,12 +231,12 @@ void WorldEditorImGui::drawWorldView() noexcept {
ox::Error WorldEditorImGui::addObjSet(ox::StringView path) noexcept { ox::Error WorldEditorImGui::addObjSet(ox::StringView path) noexcept {
oxRequire(uuid, keel::pathToUuid(keelCtx(m_sctx.tctx), path)); oxRequire(uuid, keel::pathToUuid(keelCtx(m_sctx.tctx), path));
pushCommand<AddObjectSet>(m_doc, uuid); std::ignore = pushCommand<AddObjectSet>(m_doc, uuid);
return {}; return {};
} }
void WorldEditorImGui::rmObjSet() noexcept { void WorldEditorImGui::rmObjSet() noexcept {
pushCommand<RmObjectSet>(m_doc, m_palMgr.selectedIdx); std::ignore = pushCommand<RmObjectSet>(m_doc, m_palMgr.selectedIdx);
} }
ox::Error WorldEditorImGui::handleObjectSetUpdate(ox::StringView, ox::UUID const&uuid) noexcept { ox::Error WorldEditorImGui::handleObjectSetUpdate(ox::StringView, ox::UUID const&uuid) noexcept {

View File

@ -91,7 +91,7 @@ void WorldObjectSetEditorImGui::drawTileSheetSelector() noexcept {
auto const&tilesheetList = m_sctx.project->fileList(ncore::FileExt_ng); auto const&tilesheetList = m_sctx.project->fileList(ncore::FileExt_ng);
auto sel = m_selectedTilesheetIdx; auto sel = m_selectedTilesheetIdx;
if (ig::ComboBox("Tile Sheet", tilesheetList, sel)) { if (ig::ComboBox("Tile Sheet", tilesheetList, sel)) {
undoStack()->push(ox::make_unique<ChangeTileSheet> std::ignore = undoStack()->push(ox::make_unique<ChangeTileSheet>
(m_doc, ox::FileAddress(tilesheetList[sel]), sel, m_selectedTilesheetIdx)); (m_doc, ox::FileAddress(tilesheetList[sel]), sel, m_selectedTilesheetIdx));
loadObj(); loadObj();
} }
@ -102,12 +102,12 @@ void WorldObjectSetEditorImGui::drawObjSelector() noexcept {
if (ig::PushButton("+", btnSize)) { if (ig::PushButton("+", btnSize)) {
auto cmd = ox::make_unique<AddObject>(m_doc); auto cmd = ox::make_unique<AddObject>(m_doc);
m_selectedObj = cmd->insertIdx(); m_selectedObj = cmd->insertIdx();
undoStack()->push(std::move(cmd)); std::ignore = undoStack()->push(std::move(cmd));
loadObj(); loadObj();
} }
ImGui::SameLine(); ImGui::SameLine();
if (ig::PushButton("-", btnSize)) { if (ig::PushButton("-", btnSize)) {
undoStack()->push(ox::make_unique<RmObject>(m_doc, m_selectedObj)); std::ignore = undoStack()->push(ox::make_unique<RmObject>(m_doc, m_selectedObj));
} }
if (ig::ListBox("Objects", [this](size_t i) -> ox::CStringView { if (ig::ListBox("Objects", [this](size_t i) -> ox::CStringView {
return m_doc.objects[i].name; return m_doc.objects[i].name;
@ -156,7 +156,7 @@ void WorldObjectSetEditorImGui::drawObjEditor() noexcept {
ImGui::NewLine(); ImGui::NewLine();
auto &nameBuff = m_objEditor.nameBuff; auto &nameBuff = m_objEditor.nameBuff;
if (ImGui::InputText("Name", nameBuff.data(), nameBuff.size())) { if (ImGui::InputText("Name", nameBuff.data(), nameBuff.size())) {
undoStack()->push(ox::make_unique<EditObjectName>( std::ignore = undoStack()->push(ox::make_unique<EditObjectName>(
m_doc, m_doc,
m_selectedObj, m_selectedObj,
ox::String(nameBuff.data(), ox::strnlen(nameBuff.data(), nameBuff.size())))); ox::String(nameBuff.data(), ox::strnlen(nameBuff.data(), nameBuff.size()))));
@ -165,7 +165,7 @@ void WorldObjectSetEditorImGui::drawObjEditor() noexcept {
{ {
ig::IDStackItem const subsheetSelectorStackItem("SubsheetSelector"); ig::IDStackItem const subsheetSelectorStackItem("SubsheetSelector");
if (ig::ComboBox("Palette", m_paletteDisplayNames, m_objEditor.palette)) { if (ig::ComboBox("Palette", m_paletteDisplayNames, m_objEditor.palette)) {
undoStack()->push(ox::make_unique<EditObjectPalette>( std::ignore = undoStack()->push(ox::make_unique<EditObjectPalette>(
m_doc, m_selectedObj, static_cast<uint16_t>(m_objEditor.palette))); m_doc, m_selectedObj, static_cast<uint16_t>(m_objEditor.palette)));
} }
ImGui::Separator(); ImGui::Separator();
@ -205,7 +205,7 @@ void WorldObjectSetEditorImGui::drawObjEditor() noexcept {
auto &obj = activeObj(); auto &obj = activeObj();
auto intermediate = obj.collisionMap; auto intermediate = obj.collisionMap;
if (m_colView.click(mousePos, intermediate)) { if (m_colView.click(mousePos, intermediate)) {
undoStack()->push(ox::make_unique<EditObjectCollisionMap>(m_doc, m_selectedObj, intermediate)); std::ignore = undoStack()->push(ox::make_unique<EditObjectCollisionMap>(m_doc, m_selectedObj, intermediate));
} }
} }
} }
@ -225,7 +225,7 @@ void WorldObjectSetEditorImGui::drawSubSheetNode(ncore::TileSheet::SubSheet cons
} }
} else if (ImGui::TreeNodeEx(ss.name.c_str(), ImGuiTreeNodeFlags_Leaf | selected)) { } else if (ImGui::TreeNodeEx(ss.name.c_str(), ImGuiTreeNodeFlags_Leaf | selected)) {
if (ImGui::IsItemClicked()) { if (ImGui::IsItemClicked()) {
undoStack()->push(ox::make_unique<EditObjectSubSheet>(m_doc, m_selectedObj, ss.id)); std::ignore = undoStack()->push(ox::make_unique<EditObjectSubSheet>(m_doc, m_selectedObj, ss.id));
} }
ImGui::TreePop(); ImGui::TreePop();
} }
@ -284,7 +284,7 @@ void WorldObjectSetEditorImGui::drawAddPalettePopup() noexcept {
auto const&palettes = m_sctx.project->fileList(ncore::FileExt_npal); auto const&palettes = m_sctx.project->fileList(ncore::FileExt_npal);
ig::ComboBox("Palette", palettes, m_addPalPopup.selectedIdx); ig::ComboBox("Palette", palettes, m_addPalPopup.selectedIdx);
if (ig::PopupControlsOkCancel(popupSz.x, m_addPalPopup.show) == ig::PopupResponse::OK) { if (ig::PopupControlsOkCancel(popupSz.x, m_addPalPopup.show) == ig::PopupResponse::OK) {
undoStack()->push(ox::make_unique<AddPalette>( std::ignore = undoStack()->push(ox::make_unique<AddPalette>(
m_doc, m_doc,
ox::FileAddress(palettes[m_addPalPopup.selectedIdx]))); ox::FileAddress(palettes[m_addPalPopup.selectedIdx])));
} }
@ -305,7 +305,7 @@ void WorldObjectSetEditorImGui::drawEditPalettePopup() noexcept {
m_editPalPopup.intervalInputVal = m_editPalPopup.intervalInputVal =
static_cast<uint16_t>(ox::clamp(m_editPalPopup.intervalInputVal, 0, 60000)); static_cast<uint16_t>(ox::clamp(m_editPalPopup.intervalInputVal, 0, 60000));
if (ig::PopupControlsOkCancel(popupSz.x, m_editPalPopup.show) == ig::PopupResponse::OK) { if (ig::PopupControlsOkCancel(popupSz.x, m_editPalPopup.show) == ig::PopupResponse::OK) {
undoStack()->push(ox::make_unique<EditPalette>( std::ignore = undoStack()->push(ox::make_unique<EditPalette>(
pal, static_cast<uint16_t>(m_editPalPopup.intervalInputVal))); pal, static_cast<uint16_t>(m_editPalPopup.intervalInputVal)));
} }
ImGui::EndPopup(); ImGui::EndPopup();
@ -318,7 +318,7 @@ void WorldObjectSetEditorImGui::addPalette() noexcept {
} }
void WorldObjectSetEditorImGui::rmPalette() noexcept { void WorldObjectSetEditorImGui::rmPalette() noexcept {
undoStack()->push(ox::make_unique<RmPalette>( std::ignore = undoStack()->push(ox::make_unique<RmPalette>(
m_doc, m_selectedPal)); m_doc, m_selectedPal));
} }