Paste Property is one item; spritesheet reload every 3 s; Snapshots reads Undo/Redo

- Paste > Property pastes the property that was copied, enabled only when
  the clipboard holds one the selected frames can take.
- Auto spritesheet reload checks every 3 seconds (no interval setting); its
  Enabled checkbox no longer shares an ID with Autosave's.
- The Snapshots section in Configure is now Undo/Redo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-03 21:21:44 -04:00
1 parent 97be81b5c1
commit ded95f436a
6 files changed
+26 -27

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@ namespace anm2ed::imgui
if (!settings.fileIsAutoReloadSpritesheets) return;
spritesheetReloadTime += deltaSeconds;
if (spritesheetReloadTime < settings.fileAutoReloadInterval) return;
if (spritesheetReloadTime < AUTO_RELOAD_INTERVAL) return;
spritesheetReloadTime = 0.0f;
for (auto& document : manager.documents)
if (auto ids = document.spritesheets_changed_get(); !ids.empty()) document.spritesheets_reload(ids);
+21 -14
View File
@@ -160,42 +160,49 @@ namespace anm2ed::imgui
auto source = property_source_get();
auto sourceFrame = source ? model.frame_get(*source) : nullptr;
auto clipboardFrame = property_clipboard_frame_get();
auto clipboard_menu_add = [&](ActionType type, std::function<bool()> isFrameEnabled, std::function<void()> frameRun,
int propertyType, std::function<bool(edit::FrameProperty)> is_property_enabled,
std::function<void(edit::FrameProperty)> property_run)
// A submenu of the properties a frame type has.
auto properties_get = [&](int itemType, std::function<bool(edit::FrameProperty)> is_property_enabled,
std::function<void(edit::FrameProperty)> property_run)
{
Action properties{.label = LABEL_PROPERTY};
for (int i = 0; i < (int)edit::FrameProperty::COUNT; ++i)
{
auto property = (edit::FrameProperty)i;
if (!edit::is_frame_property_valid(property, (ItemType)propertyType)) continue;
if (!edit::is_frame_property_valid(property, (ItemType)itemType)) continue;
properties.children.push_back({.label = FRAME_PROPERTY_LABELS[i],
.isEnabled = [=]() { return is_property_enabled(property); },
.run = [=]() { property_run(property); }});
}
properties.isEnabled = [children = properties.children]()
{ return std::ranges::any_of(children, is_action_enabled); };
return properties;
};
auto clipboard_menu_add =
[&](ActionType type, std::function<bool()> isFrameEnabled, std::function<void()> frameRun, Action property)
{
actions.add({.label = ACTION_INFOS[type].label,
.children = {{.label = BASIC_FRAME,
.shortcut = ACTION_INFOS[type].shortcut,
.isEnabled = isFrameEnabled,
.run = frameRun},
properties}});
property}});
};
auto sourceType = source ? source->itemType : NONE;
auto is_source = [=](edit::FrameProperty) { return sourceFrame != nullptr; };
clipboard_menu_add(
ACTION_CUT, [=, this]() { return !selectedFrames.empty(); }, [this]() { cut(); }, sourceType,
[=](edit::FrameProperty) { return sourceFrame != nullptr; },
[this](edit::FrameProperty property) { property_cut(property); });
ACTION_CUT, [=, this]() { return !selectedFrames.empty(); }, [this]() { cut(); },
properties_get(sourceType, is_source, [this](edit::FrameProperty property) { property_cut(property); }));
clipboard_menu_add(
ACTION_COPY, [=, this]() { return !copyFrames.empty(); }, [this]() { copy(); }, sourceType,
[=](edit::FrameProperty) { return sourceFrame != nullptr; },
[this](edit::FrameProperty property) { property_copy(property); });
ACTION_COPY, [=, this]() { return !copyFrames.empty(); }, [this]() { copy(); },
properties_get(sourceType, is_source, [this](edit::FrameProperty property) { property_copy(property); }));
// Only one property is ever on the clipboard, so pasting one is a single item.
auto clipboardProperty = (edit::FrameProperty)frameClipboard.property;
clipboard_menu_add(
ACTION_PASTE, [&]() { return !clipboard.is_empty(); }, [this]() { paste(); },
clipboardFrame ? frameClipboard.itemType : NONE,
[this](edit::FrameProperty property) { return is_property_pasteable(property); },
[this](edit::FrameProperty property) { property_paste(property); });
{.label = LABEL_PROPERTY,
.isEnabled = [=, this]()
{ return clipboardFrame && frameClipboard.property != -1 && is_property_pasteable(clipboardProperty); },
.run = [=, this]() { property_paste(clipboardProperty); }});
// The numbered row has its own (marker) menu.
if (isRulerHovered)
actions_popup_draw("##Context Menu", actions, settings);
+2 -5
View File
@@ -67,13 +67,10 @@ namespace anm2ed::imgui::wizard
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_AUTOSAVE_ENABLED));
ImGui::SeparatorText(localize.get(LABEL_AUTO_SPRITESHEET_RELOAD));
ImGui::PushID(LABEL_AUTO_SPRITESHEET_RELOAD);
ImGui::Checkbox(localize.get(BASIC_ENABLED), &temporary.fileIsAutoReloadSpritesheets);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_AUTO_SPRITESHEET_RELOAD));
ImGui::BeginDisabled(!temporary.fileIsAutoReloadSpritesheets);
input_float_range(localize.get(LABEL_INTERVAL), temporary.fileAutoReloadInterval, AUTO_RELOAD_INTERVAL_MIN,
AUTO_RELOAD_INTERVAL_MAX, AUTO_RELOAD_INTERVAL_STEP, AUTO_RELOAD_INTERVAL_STEP, "%.1f s");
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_AUTO_SPRITESHEET_RELOAD_INTERVAL));
ImGui::EndDisabled();
ImGui::PopID();
ImGui::SeparatorText(localize.get(LABEL_SNAPSHOTS));
input_int_range(localize.get(LABEL_STACK_SIZE), temporary.fileSnapshotStackSize, 0, 100);
+1 -2
View File
@@ -423,7 +423,7 @@ namespace anm2ed
X(LABEL_SHORTCUTS_TAB, "Shortcuts", "Atajos", "Сочетания клавиш", "快捷键", "단축키") \
X(LABEL_SHORTCUT_COLUMN, "Shortcut", "Atajo", "Сочетание клавиш", "快捷方式", "단축") \
X(LABEL_SNAP, "Snap", "Ajustar", "Привязка", "吸附", "맞추기") \
X(LABEL_SNAPSHOTS, "Snapshots", "Snapshots", "Снапшоты", "快照", "스냅숏") \
X(LABEL_SNAPSHOTS, "Undo/Redo", "Deshacer/Rehacer", "Отмена/Повтор", "撤销/重做", "실행 취소/다시 실행") \
X(LABEL_SOUND, "Sound", "Sonido", "Звук", "声音", "사운드") \
X(LABEL_SOUNDS, "Sounds", "Sonidos", "Звук", "声音", "사운드") \
X(LABEL_SOUNDS_WINDOW, "Sounds###Sounds", "Sonidos###Sounds", "Звук###Sounds", "声音###Sounds", "사운드###Sounds") \
@@ -534,7 +534,6 @@ namespace anm2ed
X(TEXT_SELECT_FRAME, "Select a frame first!", "¡Selecciona primero un frame!", "Сначала выберите кадр!", "请先选择帧!", "먼저 프레임을 선택하세요!") \
X(TEXT_SELECT_FRAME_OR_REGION, "Select a frame or region first!", "¡Selecciona primero un frame o región!", "Сначала выберите кадр или регион!", "请先选择帧或区域!", "먼저 프레임 또는 영역을 선택하세요!") \
X(TOOLTIP_AUTO_SPRITESHEET_RELOAD, "Reload spritesheets automatically when their files change on disk.\n(Spritesheets with unsaved edits are left alone.)", "Recarga los spritesheets automáticamente cuando sus archivos cambian en el disco.\n(Los spritesheets con cambios sin guardar no se tocan.)", "Автоматически перезагружать спрайт-листы при изменении их файлов на диске.\n(Спрайт-листы с несохранёнными изменениями не затрагиваются.)", "当图集文件在磁盘上更改时自动重新加载。\n(有未保存修改的图集不受影响。)", "디스크의 파일이 바뀌면 스프라이트 시트를 자동으로 새로고침합니다.\n(저장하지 않은 수정이 있는 스프라이트 시트는 건드리지 않습니다.)") \
X(TOOLTIP_AUTO_SPRITESHEET_RELOAD_INTERVAL, "How often (in seconds) spritesheet files are checked for changes.", "Cada cuánto (en segundos) se revisan los archivos de spritesheets en busca de cambios.", "Как часто (в секундах) проверять файлы спрайт-листов на изменения.", "检查图集文件更改的间隔(秒)。", "스프라이트 시트 파일의 변경을 확인하는 간격(초).") \
X(TOOLTIP_ISAAC_COMPATIBILITY_WARNING, "Before saving, list anything the game doesn't support and what will happen to it.", "Antes de guardar, muestra lo que el juego no soporta y lo que pasará con ello.", "Перед сохранением показывать всё, что игра не поддерживает, и что с этим произойдёт.", "保存前列出游戏不支持的内容及其处理方式。", "저장하기 전에 게임이 지원하지 않는 항목과 그 처리 방식을 알려줍니다.") \
X(TOOLTIP_MERGE_SPRITESHEETS, "Merge selected spritesheets into the first selected spritesheet.", "Combina los spritesheets seleccionados en el primer spritesheet seleccionado.", "Объединить выбранные спрайт-листы в первый выбранный спрайт-лист.", "将所选图集合并到第一个选中的图集中。", "선택된 스프라이트 시트를 첫 번째 선택된 스프라이트 시트로 병합합니다.") \
X(TEXT_SELECT_SPRITESHEET, "Select a spritesheet first!", "¡Selecciona primero un spritesheet!", "Сначала выберите спрайт-лист!", "请先选择图集!", "먼저 스프라이트 시트를 선택하세요!") \
-1
View File
@@ -272,7 +272,6 @@ DockSpace ID=0x123F8F08 Window=0x6D581B32 Pos=8,62 Size=1902,991
for (auto [scale, min, max] : {std::tuple{&uiScale, UI_SCALE_MIN, UI_SCALE_MAX},
std::tuple{&renderScale, RENDER_SCALE_MIN, RENDER_SCALE_MAX}})
*scale = std::clamp(*scale < min ? math::unit_to_percent(*scale) : *scale, min, max);
fileAutoReloadInterval = std::clamp(fileAutoReloadInterval, AUTO_RELOAD_INTERVAL_MIN, AUTO_RELOAD_INTERVAL_MAX);
}
Options Settings::anm2_options_get() const { return {.isExtendedFormat = isFileExtendedFormat}; }
+1 -4
View File
@@ -25,9 +25,7 @@ namespace anm2ed
constexpr auto OUTPUT_PATH_DEFAULT = "./output.gif";
#endif
constexpr auto AUTO_RELOAD_INTERVAL_MIN = 0.5f;
constexpr auto AUTO_RELOAD_INTERVAL_MAX = 60.0f;
constexpr auto AUTO_RELOAD_INTERVAL_STEP = 0.5f;
constexpr auto AUTO_RELOAD_INTERVAL = 3.0f; // seconds between checks of spritesheet files
// Scales are percents.
constexpr auto UI_SCALE_MIN = 50.0f;
constexpr auto UI_SCALE_MAX = 200.0f;
@@ -66,7 +64,6 @@ namespace anm2ed
X(FILE_IS_WARN_OVERWRITE, fileIsWarnOverwrite, STRING_UNDEFINED, BOOL, true) \
X(FILE_IS_WARN_ISAAC, fileIsWarnIsaac, STRING_UNDEFINED, BOOL, true) \
X(FILE_IS_AUTO_RELOAD_SPRITESHEETS, fileIsAutoReloadSpritesheets, STRING_UNDEFINED, BOOL, true) \
X(FILE_AUTO_RELOAD_INTERVAL, fileAutoReloadInterval, STRING_UNDEFINED, FLOAT, 2.0f) \
X(FILE_IS_EXTENDED_FORMAT, isFileExtendedFormat, STRING_UNDEFINED, BOOL, false) \
X(FILE_SNAPSHOT_STACK_SIZE, fileSnapshotStackSize, STRING_UNDEFINED, INT, 50) \
\