Removed texture inset and fix closing document bug

This commit is contained in:
2025-12-16 01:52:06 -05:00
parent ffed82a591
commit ed2f92d412
3 changed files with 7 additions and 12 deletions

View File

@@ -122,7 +122,6 @@ namespace anm2ed::imgui
closePopup.trigger(); closePopup.trigger();
bool isClosePopupOpenPrevious = closePopup.isOpen;
if (ImGui::BeginPopupModal(closePopup.label(), &closePopup.isOpen, ImGuiWindowFlags_NoResize)) if (ImGui::BeginPopupModal(closePopup.label(), &closePopup.isOpen, ImGuiWindowFlags_NoResize))
{ {
if (closeDocumentIndex >= 0 && closeDocumentIndex < (int)manager.documents.size()) if (closeDocumentIndex >= 0 && closeDocumentIndex < (int)manager.documents.size())
@@ -172,8 +171,6 @@ namespace anm2ed::imgui
ImGui::EndPopup(); ImGui::EndPopup();
} }
if ((isClosePopupOpenPrevious != closePopup.isOpen) && isQuitting) isQuitting = false;
} }
ImGui::End(); ImGui::End();

View File

@@ -971,6 +971,8 @@ namespace anm2ed::imgui
if (ImGui::Button(localize.get(LABEL_RENDER), widgetSize)) if (ImGui::Button(localize.get(LABEL_RENDER), widgetSize))
{ {
replace_extension();
bool isRender = true; bool isRender = true;
if (!ffmpeg_is_executable(ffmpegPath)) if (!ffmpeg_is_executable(ffmpegPath))
{ {

View File

@@ -28,7 +28,6 @@ namespace anm2ed::imgui
constexpr auto NULL_COLOR = vec4(0.0f, 0.0f, 1.0f, 0.90f); constexpr auto NULL_COLOR = vec4(0.0f, 0.0f, 1.0f, 0.90f);
constexpr auto TARGET_SIZE = vec2(32, 32); constexpr auto TARGET_SIZE = vec2(32, 32);
constexpr auto POINT_SIZE = vec2(4, 4); 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_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); 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& 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, auto layerModel = math::quad_model_get(frame.size, frame.position, frame.pivot,
math::percent_to_unit(frame.scale), frame.rotation); math::percent_to_unit(frame.scale), frame.rotation);
auto layerTransform = sampleTransform * layerModel; 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 uvMin = frame.crop / texSize;
auto uvMax = (frame.crop + frame.size) / texSize; auto uvMax = (frame.crop + frame.size) / texSize;
vec3 frameColorOffset = frame.colorOffset + colorOffset + sampleColor; vec3 frameColorOffset = frame.colorOffset + colorOffset + sampleColor;
vec4 frameTint = frame.tint; vec4 frameTint = frame.tint;
frameTint.a = std::max(0.0f, frameTint.a - (alphaOffset + sampleAlpha)); 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); auto vertices = math::uv_vertices_get(uvMin, uvMax);
texture_render(shaderTexture, texture.id, layerTransform, frameTint, frameColorOffset, vertices.data()); texture_render(shaderTexture, texture.id, layerTransform, frameTint, frameColorOffset, vertices.data());
@@ -619,8 +615,8 @@ namespace anm2ed::imgui
if (isShowRect) if (isShowRect)
{ {
auto rectModel = math::quad_model_get(NULL_RECT_SIZE, frame.position, NULL_RECT_SIZE * 0.5f, auto rectModel =
math::percent_to_unit(frame.scale), frame.rotation); math::quad_model_get(frame.scale, frame.position, frame.scale * 0.5f, vec2(1.0f), frame.rotation);
auto rectTransform = sampleTransform * rectModel; auto rectTransform = sampleTransform * rectModel;
rect_render(shaderLine, rectTransform, rectModel, color); rect_render(shaderLine, rectTransform, rectModel, color);