From 9e9dd8bd8a52dde2601590426e61217b54887571 Mon Sep 17 00:00:00 2001 From: shweet Date: Thu, 27 Aug 2026 16:09:10 -0400 Subject: [PATCH] fix issue with animation length change acting on new reference --- README.md | 1 + src/imgui/window/timeline.cpp | 12 ++++++++---- src/imgui/window/timeline.hpp | 1 + workshop/metadata.xml | 3 ++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 79decd5..3a89703 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ This application was developed with the assistance of a large language model. - Dockable [Dear ImGui](https://github.com/ocornut/imgui) interface with draggable windows, persistent layout, drag and drop, context menus, and keyboard-focused workflows. - Timeline editing with multi-selection, cut/copy/paste, duplicate, merge, insert/delete, frame baking, frame dragging, and editable animation length/FPS/loop settings. - Animation, layer, and null groups for organizing work, including collapsible trees, group roots, visibility toggles, and save-time baking for game compatibility. +- Frame property editing for crop, size, position, pivot, scale, shear, rotation, tint, color offset, regions, shaders, visibility, interpolation, and flips, with single-frame and batch modes. - Spritesheet tools for adding, replacing, reloading, packing, saving, editing, and generating reusable regions. - Overlay spritesheets that can be placed on top of base spritesheets for editing and previewing alternate texture work. - Custom spritesheet shaders with vertex/fragment file paths, reload/compile feedback, enable/disable behavior, and configurable uniform bindings. diff --git a/src/imgui/window/timeline.cpp b/src/imgui/window/timeline.cpp index bca5011..465be20 100644 --- a/src/imgui/window/timeline.cpp +++ b/src/imgui/window/timeline.cpp @@ -3893,12 +3893,15 @@ namespace anm2ed::imgui ImGui::SameLine(); auto frameNum = animation ? animation->frameNum : dummy_value(); + auto currentAnimationIndex = reference.animationIndex; ImGui::SetNextItemWidth(widgetSize.x); - if (input_int_range(localize.get(LABEL_ANIMATION_LENGTH), frameNum, FRAME_NUM_MIN, FRAME_NUM_MAX, STEP, - STEP_FAST, !animation ? ImGuiInputTextFlags_DisplayEmptyRefVal : 0) && - animation) + auto isLengthChanged = input_int_range(localize.get(LABEL_ANIMATION_LENGTH), frameNum, FRAME_NUM_MIN, + FRAME_NUM_MAX, STEP, STEP_FAST, + !animation ? ImGuiInputTextFlags_DisplayEmptyRefVal : 0); + if (ImGui::IsItemActivated()) animationLengthEditIndex = currentAnimationIndex; + if (isLengthChanged && animation) { - auto animationIndex = reference.animationIndex; + auto animationIndex = animationLengthEditIndex != -1 ? animationLengthEditIndex : currentAnimationIndex; edit_command_push(EDIT_ANIMATION_LENGTH, Document::ANIMATIONS, [=](Manager&, Document& document) { @@ -3907,6 +3910,7 @@ namespace anm2ed::imgui animation->frameNum = frameNum; }); } + if (ImGui::IsItemDeactivated()) animationLengthEditIndex = -1; ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ANIMATION_LENGTH)); ImGui::SameLine(); diff --git a/src/imgui/window/timeline.hpp b/src/imgui/window/timeline.hpp index 2502044..60fb212 100644 --- a/src/imgui/window/timeline.hpp +++ b/src/imgui/window/timeline.hpp @@ -101,6 +101,7 @@ namespace anm2ed::imgui Reference frameSelectionSnapshotReference{}; Reference frameSelectionAnchor{}; bool isFrameSelectionAnchorSet{}; + int animationLengthEditIndex{-1}; std::vector rowDragReferences{}; glm::vec2 scroll{}; ImGuiStyle style{}; diff --git a/workshop/metadata.xml b/workshop/metadata.xml index d10d6cb..8f610c1 100644 --- a/workshop/metadata.xml +++ b/workshop/metadata.xml @@ -16,6 +16,7 @@ Anm2Ed is a modern editor for [i]The Binding of Isaac: Rebirth[/i]'s XML-based & [*] Dockable [url=https://github.com/ocornut/imgui]Dear ImGui[/url] interface with draggable windows, persistent layout, drag and drop, context menus, and keyboard-focused workflows. [*] Timeline editing with multi-selection, cut/copy/paste, duplicate, merge, insert/delete, frame baking, frame dragging, and editable animation length/FPS/loop settings. [*] Animation, layer, and null groups for organizing work, including collapsible trees, group roots, visibility toggles, and save-time baking for game compatibility. +[*] Frame property editing for crop, size, position, pivot, scale, shear, rotation, tint, color offset, regions, shaders, visibility, interpolation, and flips, with single-frame and batch modes. [*] Spritesheet tools for adding, replacing, reloading, packing, saving, editing, and generating reusable regions. [*] Overlay spritesheets that can be placed on top of base spritesheets for editing and previewing alternate texture work. [*] Custom spritesheet shaders with vertex/fragment file paths, reload/compile feedback, enable/disable behavior, and configurable uniform bindings. @@ -51,6 +52,6 @@ Alternatively, if you have subscribed to the mod, you can find the latest releas [h3]Happy animating![/h3] [img]https://files.catbox.moe/4auc1c.gif[/img] - 2.28 + 2.29 Public