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);