SPECIAL LITTLE WARNING FOR STUPID LITTLE CHUDS WHO CAN'T READ

This commit is contained in:
2026-04-15 14:12:08 -04:00
parent f1b46fbf60
commit fc54412eb9
12 changed files with 157 additions and 18 deletions
+8 -3
View File
@@ -155,10 +155,15 @@ namespace anm2ed::imgui
shortcut(manager.chords[SHORTCUT_CONFIRM]);
if (ImGui::Button(localize.get(BASIC_YES), widgetSize))
{
bool isSaved = true;
if (isDocumentDirty)
manager.save(closeDocumentIndex, {}, (anm2::Compatibility)settings.fileCompatibility,
settings.fileBakeSpecialInterpolatedFramesOnSave, settings.bakeIsRoundScale,
settings.bakeIsRoundRotation);
isSaved = taskbar.save_manual(manager, settings, closeDocumentIndex);
if (!isSaved)
{
ImGui::EndPopup();
return;
}
if (isSpritesheetDirty)
{
+79 -12
View File
@@ -21,6 +21,39 @@ using namespace glm;
namespace anm2ed::imgui
{
void Taskbar::save_execute(Manager& manager, Settings& settings, const PendingSave& request, bool bakeFrames)
{
manager.save(request.index, request.path, (anm2::Compatibility)settings.fileCompatibility, bakeFrames,
settings.bakeIsRoundScale, settings.bakeIsRoundRotation);
}
bool Taskbar::save_request(Manager& manager, Settings& settings, int index, const std::filesystem::path& path)
{
auto* document = manager.get(index);
if (!document) return false;
if (settings.fileIsSpecialInterpolatedFramesOnSaveReminder && document->anm2.has_special_interpolated_frames())
{
pendingSave = {.index = index,
.path = path,
.isOpen = true,
.disableReminder = false,
.autoBakeFrames = settings.fileBakeSpecialInterpolatedFramesOnSave};
specialInterpolatedFramesReminderPopup.open();
return false;
}
PendingSave request{.index = index, .path = path};
auto bakeFrames = settings.fileBakeSpecialInterpolatedFramesOnSave;
save_execute(manager, settings, request, bakeFrames);
return true;
}
bool Taskbar::save_manual(Manager& manager, Settings& settings, int index, const std::filesystem::path& path)
{
return save_request(manager, settings, index, path);
}
void Taskbar::update(Manager& manager, Settings& settings, Resources& resources, Dialog& dialog, bool& isQuitting)
{
auto document = manager.get();
@@ -74,9 +107,7 @@ namespace anm2ed::imgui
if (settings.fileIsWarnOverwrite)
overwritePopup.open();
else
manager.save(document->path, (anm2::Compatibility)settings.fileCompatibility,
settings.fileBakeSpecialInterpolatedFramesOnSave, settings.bakeIsRoundScale,
settings.bakeIsRoundRotation);
save_request(manager, settings, manager.selected, document->path);
}
if (ImGui::MenuItem(localize.get(LABEL_SAVE_AS), settings.shortcutSaveAs.c_str(), false, document))
@@ -102,9 +133,7 @@ namespace anm2ed::imgui
if (dialog.is_selected(Dialog::ANM2_SAVE))
{
manager.save(dialog.path, (anm2::Compatibility)settings.fileCompatibility,
settings.fileBakeSpecialInterpolatedFramesOnSave, settings.bakeIsRoundScale,
settings.bakeIsRoundRotation);
save_request(manager, settings, manager.selected, dialog.path);
dialog.reset();
}
@@ -244,9 +273,7 @@ namespace anm2ed::imgui
if (ImGui::Button(localize.get(BASIC_YES), widgetSize))
{
manager.save({}, (anm2::Compatibility)settings.fileCompatibility,
settings.fileBakeSpecialInterpolatedFramesOnSave, settings.bakeIsRoundScale,
settings.bakeIsRoundRotation);
save_request(manager, settings);
overwritePopup.close();
}
@@ -257,6 +284,48 @@ namespace anm2ed::imgui
ImGui::EndPopup();
}
specialInterpolatedFramesReminderPopup.trigger();
if (ImGui::BeginPopupModal(specialInterpolatedFramesReminderPopup.label(),
&specialInterpolatedFramesReminderPopup.isOpen, ImGuiWindowFlags_NoResize))
{
ImGui::TextWrapped("%s", localize.get(LABEL_SPECIAL_INTERPOLATED_FRAMES_REMINDER_PROMPT));
ImGui::Spacing();
ImGui::Checkbox(localize.get(LABEL_DONT_NOTIFY_ME_AGAIN), &pendingSave.disableReminder);
ImGui::BeginDisabled(!pendingSave.disableReminder);
ImGui::Checkbox(localize.get(LABEL_AUTOMATICALLY_BAKE_THESE_FRAMES_ON_SAVE), &pendingSave.autoBakeFrames);
ImGui::EndDisabled();
auto widgetSize = widget_size_with_row_get(3);
if (ImGui::Button(localize.get(LABEL_SAVE_BAKE_FRAMES), widgetSize))
{
if (pendingSave.disableReminder) settings.fileIsSpecialInterpolatedFramesOnSaveReminder = false;
settings.fileBakeSpecialInterpolatedFramesOnSave = pendingSave.autoBakeFrames;
save_execute(manager, settings, pendingSave, true);
pendingSave = {};
specialInterpolatedFramesReminderPopup.close();
}
ImGui::SameLine();
if (ImGui::Button(localize.get(LABEL_SAVE_DONT_BAKE_FRAMES), widgetSize))
{
if (pendingSave.disableReminder) settings.fileIsSpecialInterpolatedFramesOnSaveReminder = false;
settings.fileBakeSpecialInterpolatedFramesOnSave = pendingSave.autoBakeFrames;
save_execute(manager, settings, pendingSave, false);
pendingSave = {};
specialInterpolatedFramesReminderPopup.close();
}
ImGui::SameLine();
if (ImGui::Button(localize.get(BASIC_CANCEL), widgetSize))
{
pendingSave = {};
specialInterpolatedFramesReminderPopup.close();
}
ImGui::EndPopup();
}
specialInterpolatedFramesReminderPopup.end();
aboutPopup.end();
if (shortcut(manager.chords[SHORTCUT_NEW], shortcut::GLOBAL)) dialog.file_save(Dialog::ANM2_NEW);
@@ -266,9 +335,7 @@ namespace anm2ed::imgui
if (settings.fileIsWarnOverwrite)
overwritePopup.open();
else
manager.save({}, (anm2::Compatibility)settings.fileCompatibility,
settings.fileBakeSpecialInterpolatedFramesOnSave, settings.bakeIsRoundScale,
settings.bakeIsRoundRotation);
save_request(manager, settings);
}
if (shortcut(manager.chords[SHORTCUT_SAVE_AS], shortcut::GLOBAL)) dialog.file_save(Dialog::ANM2_SAVE);
if (shortcut(manager.chords[SHORTCUT_EXIT], shortcut::GLOBAL)) isQuitting = true;
+18
View File
@@ -1,5 +1,7 @@
#pragma once
#include <filesystem>
#include "canvas.hpp"
#include "dialog.hpp"
#include "imgui_.hpp"
@@ -18,6 +20,15 @@ namespace anm2ed::imgui
{
class Taskbar
{
struct PendingSave
{
int index{-1};
std::filesystem::path path{};
bool isOpen{};
bool disableReminder{};
bool autoBakeFrames{};
};
wizard::ChangeAllFrameProperties changeAllFrameProperties{};
wizard::About about{};
wizard::Configure configure{};
@@ -28,15 +39,22 @@ namespace anm2ed::imgui
PopupHelper generatePopup{PopupHelper(LABEL_TASKBAR_GENERATE_ANIMATION_FROM_GRID)};
PopupHelper changePopup{PopupHelper(LABEL_CHANGE_ALL_FRAME_PROPERTIES, imgui::POPUP_NORMAL_NO_HEIGHT)};
PopupHelper overwritePopup{PopupHelper(LABEL_TASKBAR_OVERWRITE_FILE, imgui::POPUP_SMALL_NO_HEIGHT)};
PopupHelper specialInterpolatedFramesReminderPopup{
PopupHelper(LABEL_SPECIAL_INTERPOLATED_FRAMES_REMINDER_POPUP, imgui::POPUP_NORMAL_NO_HEIGHT)};
PopupHelper renderPopup{PopupHelper(LABEL_TASKBAR_RENDER_ANIMATION, imgui::POPUP_SMALL_NO_HEIGHT)};
PopupHelper configurePopup{PopupHelper(LABEL_TASKBAR_CONFIGURE)};
PopupHelper aboutPopup{PopupHelper(LABEL_TASKBAR_ABOUT)};
Settings editSettings{};
bool isQuittingMode{};
PendingSave pendingSave{};
void save_execute(Manager&, Settings&, const PendingSave&, bool);
bool save_request(Manager&, Settings&, int = -1, const std::filesystem::path& = {});
public:
float height{};
void update(Manager&, Settings&, Resources&, Dialog&, bool&);
bool save_manual(Manager&, Settings&, int = -1, const std::filesystem::path& = {});
};
};
@@ -1,5 +1,6 @@
#include "change_all_frame_properties.hpp"
#include <algorithm>
#include <string>
#include <vector>
@@ -48,7 +49,7 @@ namespace anm2ed::imgui::wizard
auto& duration = settings.changeDuration;
auto& tint = settings.changeTint;
auto& colorOffset = settings.changeColorOffset;
auto& regionId = settings.changeRegionId;
auto& regionId = document.changeAllFramePropertiesRegionId;
auto& isVisible = settings.changeIsVisible;
auto& interpolation = settings.changeInterpolation;
auto& isFlipX = settings.changeIsFlipX;
@@ -239,6 +240,7 @@ namespace anm2ed::imgui::wizard
}
auto regionIds = regionStorage && !regionStorage->ids.empty() ? regionStorage->ids : fallbackIds;
auto regionLabels = regionStorage && !regionStorage->labels.empty() ? regionStorage->labels : fallbackLabels;
if (itemType != anm2::LAYER || std::find(regionIds.begin(), regionIds.end(), regionId) == regionIds.end()) regionId = -1;
PROPERTIES_WIDGET(combo_id_mapped(localize.get(BASIC_REGION), &regionId, regionIds, regionLabels), "##Is Region",
isRegion);
ImGui::EndDisabled();
+6
View File
@@ -72,9 +72,15 @@ namespace anm2ed::imgui::wizard
ImGui::RadioButton(localize.get(LABEL_ANM2ED_LIMITED), &temporary.fileCompatibility, anm2::ANM2ED_LIMITED);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_COMPATIBILITY_ANM2ED_LIMITED));
ImGui::Checkbox(localize.get(LABEL_SPECIAL_INTERPOLATED_FRAMES_REMINDER_ON_SAVE),
&temporary.fileIsSpecialInterpolatedFramesOnSaveReminder);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SPECIAL_INTERPOLATED_FRAMES_REMINDER_ON_SAVE));
ImGui::BeginDisabled(temporary.fileIsSpecialInterpolatedFramesOnSaveReminder);
ImGui::Checkbox(localize.get(LABEL_BAKE_SPECIAL_INTERPOLATED_FRAMES_ON_SAVE),
&temporary.fileBakeSpecialInterpolatedFramesOnSave);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BAKE_SPECIAL_INTERPOLATED_FRAMES_ON_SAVE));
ImGui::EndDisabled();
ImGui::SeparatorText(localize.get(LABEL_OPTIONS));
ImGui::Checkbox(localize.get(LABEL_OVERWRITE_WARNING), &temporary.fileIsWarnOverwrite);