From ed2f92d412bbabc32e705d2f5bdbaa9e4c35ae56 Mon Sep 17 00:00:00 2001 From: shweet Date: Tue, 16 Dec 2025 01:52:06 -0500 Subject: [PATCH] Removed texture inset and fix closing document bug --- src/imgui/documents.cpp | 3 --- src/imgui/taskbar.cpp | 2 ++ src/imgui/window/animation_preview.cpp | 14 +++++--------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/imgui/documents.cpp b/src/imgui/documents.cpp index 0c12b56..def84e8 100644 --- a/src/imgui/documents.cpp +++ b/src/imgui/documents.cpp @@ -122,7 +122,6 @@ namespace anm2ed::imgui closePopup.trigger(); - bool isClosePopupOpenPrevious = closePopup.isOpen; if (ImGui::BeginPopupModal(closePopup.label(), &closePopup.isOpen, ImGuiWindowFlags_NoResize)) { if (closeDocumentIndex >= 0 && closeDocumentIndex < (int)manager.documents.size()) @@ -172,8 +171,6 @@ namespace anm2ed::imgui ImGui::EndPopup(); } - - if ((isClosePopupOpenPrevious != closePopup.isOpen) && isQuitting) isQuitting = false; } ImGui::End(); diff --git a/src/imgui/taskbar.cpp b/src/imgui/taskbar.cpp index 72ed05b..4462878 100644 --- a/src/imgui/taskbar.cpp +++ b/src/imgui/taskbar.cpp @@ -971,6 +971,8 @@ namespace anm2ed::imgui if (ImGui::Button(localize.get(LABEL_RENDER), widgetSize)) { + replace_extension(); + bool isRender = true; if (!ffmpeg_is_executable(ffmpegPath)) { diff --git a/src/imgui/window/animation_preview.cpp b/src/imgui/window/animation_preview.cpp index d80799b..e725a47 100644 --- a/src/imgui/window/animation_preview.cpp +++ b/src/imgui/window/animation_preview.cpp @@ -28,7 +28,6 @@ namespace anm2ed::imgui constexpr auto NULL_COLOR = vec4(0.0f, 0.0f, 1.0f, 0.90f); constexpr auto TARGET_SIZE = vec2(32, 32); constexpr auto POINT_SIZE = vec2(4, 4); - constexpr auto NULL_RECT_SIZE = vec2(100); constexpr auto TRIGGER_TEXT_COLOR_DARK = ImVec4(1.0f, 1.0f, 1.0f, 0.5f); constexpr auto TRIGGER_TEXT_COLOR_LIGHT = ImVec4(0.0f, 0.0f, 0.0f, 0.5f); @@ -547,22 +546,19 @@ namespace anm2ed::imgui { auto& texture = spritesheet->texture; + auto texSize = vec2(texture.size); + if (texSize.x <= 0.0f || texSize.y <= 0.0f) return; + auto layerModel = math::quad_model_get(frame.size, frame.position, frame.pivot, math::percent_to_unit(frame.scale), frame.rotation); auto layerTransform = sampleTransform * layerModel; - auto texSize = vec2(texture.size); - if (texSize.x <= 0.0f || texSize.y <= 0.0f) return; - auto uvMin = frame.crop / texSize; auto uvMax = (frame.crop + frame.size) / texSize; vec3 frameColorOffset = frame.colorOffset + colorOffset + sampleColor; vec4 frameTint = frame.tint; frameTint.a = std::max(0.0f, frameTint.a - (alphaOffset + sampleAlpha)); - auto inset = vec2(0.5f) / texSize; - uvMin += inset; - uvMax -= inset; auto vertices = math::uv_vertices_get(uvMin, uvMax); texture_render(shaderTexture, texture.id, layerTransform, frameTint, frameColorOffset, vertices.data()); @@ -619,8 +615,8 @@ namespace anm2ed::imgui if (isShowRect) { - auto rectModel = math::quad_model_get(NULL_RECT_SIZE, frame.position, NULL_RECT_SIZE * 0.5f, - math::percent_to_unit(frame.scale), frame.rotation); + auto rectModel = + math::quad_model_get(frame.scale, frame.position, frame.scale * 0.5f, vec2(1.0f), frame.rotation); auto rectTransform = sampleTransform * rectModel; rect_render(shaderLine, rectTransform, rectModel, color);