queue oh el

This commit is contained in:
2026-03-19 03:46:42 -04:00
parent 4f5966dad6
commit ad125c15a2
15 changed files with 75 additions and 779 deletions
+9
View File
@@ -165,6 +165,12 @@ namespace anm2ed::imgui
auto& overlayIndex = document.overlayIndex;
auto& pan = document.previewPan;
auto stop_all_sounds = [&]()
{
for (auto& sound : anm2.content.sounds | std::views::values)
sound.audio.stop(mixer);
};
if (manager.isRecording)
{
auto& ffmpegPath = settings.renderFFmpegPath;
@@ -417,6 +423,9 @@ namespace anm2ed::imgui
frameTime = playback.time;
}
if (wasPlaybackPlaying && !playback.isPlaying) stop_all_sounds();
wasPlaybackPlaying = playback.isPlaying;
}
void AnimationPreview::update(Manager& manager, Settings& settings, Resources& resources)
+1
View File
@@ -14,6 +14,7 @@ namespace anm2ed::imgui
{
MIX_Mixer* mixer = MIX_CreateMixerDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, nullptr);
AudioStream audioStream = AudioStream(mixer);
bool wasPlaybackPlaying{};
bool isPreviewHovered{};
bool isSizeTrySet{true};
Settings savedSettings{};
-10
View File
@@ -5,7 +5,6 @@
#include <format>
<<<<<<< HEAD
#include "document.hpp"
#include "log.hpp"
#include "map_.hpp"
@@ -13,15 +12,6 @@
#include "strings.hpp"
#include "toast.hpp"
#include "vector_.hpp"
=======
#include "document.h"
#include "log.h"
#include "map_.h"
#include "math_.h"
#include "strings.h"
#include "toast.h"
#include "vector_.h"
>>>>>>> f58d894 (Render animation fixes, vs code tasks)
#include "../../util/map_.hpp"
+21 -8
View File
@@ -83,7 +83,6 @@ namespace anm2ed::imgui
constexpr auto FRAME_DRAG_PAYLOAD_ID = "Frame Drag Drop";
constexpr auto FRAME_TOOLTIP_HOVER_DELAY = 0.75f; // Extra delay for frame info tooltip.
#define ITEM_FRAME_CHILD_HEIGHT ImGui::GetTextLineHeightWithSpacing() + (ImGui::GetStyle().WindowPadding.y * 1.5)
#define ITEM_CHILD_WIDTH ImGui::GetTextLineHeightWithSpacing() * 12.5
void Timeline::update(Manager& manager, Settings& settings, Resources& resources, Clipboard& clipboard)
@@ -95,6 +94,8 @@ namespace anm2ed::imgui
auto& frames = document.frames;
auto& region = document.region;
auto animation = document.animation_get();
auto itemFrameChildHeight = (ImGui::GetTextLineHeightWithSpacing() + ImGui::GetStyle().WindowPadding.y * 1.5f) *
settings.timelineItemHeight;
style = ImGui::GetStyle();
auto isLightTheme = settings.theme == theme::LIGHT;
@@ -172,6 +173,13 @@ namespace anm2ed::imgui
frameFocusRequested = reference.frameIndex >= 0;
};
auto playback_stop = [&]()
{
playback.isPlaying = false;
playback.isFinished = false;
playback.timing_reset();
};
auto frame_insert = [&](anm2::Item* item)
{
if (!item) return;
@@ -597,7 +605,7 @@ namespace anm2ed::imgui
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing);
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, style.WindowPadding);
auto itemSize = ImVec2(ImGui::GetContentRegionAvail().x, ITEM_FRAME_CHILD_HEIGHT);
auto itemSize = ImVec2(ImGui::GetContentRegionAvail().x, itemFrameChildHeight);
if (ImGui::BeginChild(label.c_str(), itemSize, ImGuiChildFlags_Borders, ImGuiWindowFlags_NoScrollWithMouse))
{
@@ -961,7 +969,7 @@ namespace anm2ed::imgui
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing);
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, style.WindowPadding);
auto childSize = ImVec2(width, ITEM_FRAME_CHILD_HEIGHT);
auto childSize = ImVec2(width, itemFrameChildHeight);
ImGui::PopStyleVar(2);
@@ -1046,7 +1054,10 @@ namespace anm2ed::imgui
}
if (ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem) && ImGui::IsMouseDown(0))
{
if (!isDragging) playback_stop();
isDragging = true;
}
auto childPos = ImGui::GetWindowPos();
auto mousePos = ImGui::GetIO().MousePos;
@@ -1497,12 +1508,11 @@ namespace anm2ed::imgui
ImGui::GetTextLineHeightWithSpacing() + (ImGui::GetStyle().WindowPadding.y * 2));
auto playheadIndex = std::floor(playback.time);
auto lineCenterX = cursorScreenPos.x + frameSize.x * (playheadIndex + 0.6f) - scroll.x;
float lineOffsetY = frameSize.y;
auto linePos =
ImVec2(lineCenterX - (PLAYHEAD_LINE_THICKNESS * 0.5f), cursorScreenPos.y + frameSize.y + lineOffsetY);
ImVec2(lineCenterX - (PLAYHEAD_LINE_THICKNESS * 0.5f), cursorScreenPos.y + (frameSize.y * 2.0f));
auto lineSize = ImVec2((PLAYHEAD_LINE_THICKNESS / 2.0f),
viewListChildSize.y - frameSize.y - lineOffsetY -
(isHorizontalScroll ? ImGui::GetStyle().ScrollbarSize : 0.0f));
viewListChildSize.y - frameSize.y -
(isHorizontalScroll ? ImGui::GetStyle().ScrollbarSize * 2.0f : 0.0f));
auto rectMin = windowDrawList->GetClipRectMin();
auto rectMax = windowDrawList->GetClipRectMax();
@@ -1623,7 +1633,8 @@ namespace anm2ed::imgui
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2());
if (ImGui::Begin(localize.get(LABEL_TIMELINE_WINDOW), &settings.windowIsTimeline))
{
isWindowHovered = ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows);
isWindowHovered = ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows |
ImGuiHoveredFlags_AllowWhenBlockedByActiveItem);
frames_child();
items_child();
}
@@ -1853,12 +1864,14 @@ namespace anm2ed::imgui
if (shortcut(manager.chords[SHORTCUT_MOVE_PLAYHEAD_BACK], shortcut::GLOBAL))
{
playback_stop();
playback.decrement(settings.playbackIsClamp ? animation->frameNum : anm2::FRAME_NUM_MAX);
document.frameTime = playback.time;
}
if (shortcut(manager.chords[SHORTCUT_MOVE_PLAYHEAD_FORWARD], shortcut::GLOBAL))
{
playback_stop();
playback.increment(settings.playbackIsClamp ? animation->frameNum : anm2::FRAME_NUM_MAX);
document.frameTime = playback.time;
}
+4 -1
View File
@@ -23,6 +23,9 @@ namespace anm2ed::imgui::wizard
ImGui::SeparatorText(localize.get(LABEL_WINDOW_MENU));
input_float_range(localize.get(LABEL_UI_SCALE), temporary.uiScale, 0.5f, 2.0f, 0.25f, 0.25f, "%.2f");
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_UI_SCALE));
input_float_range(localize.get(LABEL_ITEM_HEIGHT), temporary.timelineItemHeight, 0.75f, 1.25f, 0.05f, 0.05f,
"%.2f");
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ITEM_HEIGHT));
ImGui::Checkbox(localize.get(LABEL_VSYNC), &temporary.isVsync);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_VSYNC));
@@ -205,4 +208,4 @@ namespace anm2ed::imgui::wizard
if (ImGui::Button(localize.get(LABEL_CLOSE), widgetSize)) isSet = true;
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CLOSE_SETTINGS));
}
}
}