From 9846a514adc088d3c830fe33d54a339fdef95572 Mon Sep 17 00:00:00 2001 From: shweet Date: Sat, 15 Nov 2025 11:35:01 -0500 Subject: [PATCH] Actually oops meant t add multiply/divide to here --- src/anm2/anm2_type.h | 4 +++- src/anm2/frame.h | 4 ---- src/anm2/item.cpp | 25 +++++++++++++++++++++++++ src/imgui/window/frame_properties.cpp | 18 +++++++++++++----- 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/anm2/anm2_type.h b/src/anm2/anm2_type.h index b5dc72e..455aa16 100644 --- a/src/anm2/anm2_type.h +++ b/src/anm2/anm2_type.h @@ -77,8 +77,10 @@ namespace anm2ed::anm2 enum ChangeType { + ADJUST, ADD, SUBTRACT, - ADJUST + MULTIPLY, + DIVIDE }; } diff --git a/src/anm2/frame.h b/src/anm2/frame.h index 461c125..708d39b 100644 --- a/src/anm2/frame.h +++ b/src/anm2/frame.h @@ -7,10 +7,6 @@ #include "anm2_type.h" #include "types.h" -#if defined(TRANSPARENT) - #undef TRANSPARENT -#endif - namespace anm2ed::anm2 { constexpr auto FRAME_DURATION_MIN = 1; diff --git a/src/anm2/item.cpp b/src/anm2/item.cpp index 079c0ee..7e2d963 100644 --- a/src/anm2/item.cpp +++ b/src/anm2/item.cpp @@ -176,6 +176,31 @@ namespace anm2ed::anm2 if (change.colorOffset) frame.colorOffset = glm::clamp(frame.colorOffset - *change.colorOffset, 0.0f, 1.0f); if (change.tint) frame.tint = glm::clamp(frame.tint - *change.tint, 0.0f, 1.0f); break; + + case MULTIPLY: + if (change.rotation) frame.rotation *= *change.rotation; + if (change.duration) frame.duration = std::max(FRAME_DURATION_MIN, frame.duration * *change.duration); + if (change.crop) frame.crop *= *change.crop; + if (change.pivot) frame.pivot *= *change.pivot; + if (change.position) frame.position *= *change.position; + if (change.size) frame.size *= *change.size; + if (change.scale) frame.scale *= *change.scale; + if (change.colorOffset) frame.colorOffset = glm::clamp(frame.colorOffset * *change.colorOffset, 0.0f, 1.0f); + if (change.tint) frame.tint = glm::clamp(frame.tint * *change.tint, 0.0f, 1.0f); + break; + + case DIVIDE: + if (change.rotation && *change.rotation != 0.0f) frame.rotation /= *change.rotation; + if (change.duration && *change.duration != 0) + frame.duration = std::max(FRAME_DURATION_MIN, frame.duration / *change.duration); + if (change.crop) frame.crop /= *change.crop; + if (change.pivot) frame.pivot /= *change.pivot; + if (change.position) frame.position /= *change.position; + if (change.size) frame.size /= *change.size; + if (change.scale) frame.scale /= *change.scale; + if (change.colorOffset) frame.colorOffset = glm::clamp(frame.colorOffset / *change.colorOffset, 0.0f, 1.0f); + if (change.tint) frame.tint = glm::clamp(frame.tint / *change.tint, 0.0f, 1.0f); + break; } } } diff --git a/src/imgui/window/frame_properties.cpp b/src/imgui/window/frame_properties.cpp index 34e275d..2135663 100644 --- a/src/imgui/window/frame_properties.cpp +++ b/src/imgui/window/frame_properties.cpp @@ -216,16 +216,24 @@ namespace anm2ed::imgui document.item_get()->frames_change(frameChange, type, *frames.begin(), (int)frames.size())); }; - auto widgetSize = widget_size_with_row_get(3); + auto rowOneWidgetSize = widget_size_with_row_get(1); - if (ImGui::Button("Adjust", widgetSize)) frame_change(anm2::ADJUST); + if (ImGui::Button("Adjust", rowOneWidgetSize)) frame_change(anm2::ADJUST); ImGui::SetItemTooltip("Set the value of each specified value onto the frame's equivalent."); - ImGui::SameLine(); - if (ImGui::Button("Add", widgetSize)) frame_change(anm2::ADD); + + auto rowTwoWidgetSize = widget_size_with_row_get(4); + + if (ImGui::Button("Add", rowTwoWidgetSize)) frame_change(anm2::ADD); ImGui::SetItemTooltip("Add the specified values onto each frame.\n(Boolean values will simply be set.)"); ImGui::SameLine(); - if (ImGui::Button("Subtract", widgetSize)) frame_change(anm2::SUBTRACT); + if (ImGui::Button("Subtract", rowTwoWidgetSize)) frame_change(anm2::SUBTRACT); ImGui::SetItemTooltip("Subtract the specified values from each frame.\n(Boolean values will simply be set.)"); + ImGui::SameLine(); + if (ImGui::Button("Multiply", rowTwoWidgetSize)) frame_change(anm2::MULTIPLY); + ImGui::SetItemTooltip("Multiply the specified values for each frame.\n(Boolean values will simply be set.)"); + ImGui::SameLine(); + if (ImGui::Button("Divide", rowTwoWidgetSize)) frame_change(anm2::DIVIDE); + ImGui::SetItemTooltip("Divide the specified values for each frame.\n(Boolean values will simply be set.)"); } } ImGui::End();