From 58077b5522b07390a921d603d4557e2111de9c18 Mon Sep 17 00:00:00 2001 From: shweet Date: Mon, 29 Dec 2025 00:17:46 -0500 Subject: [PATCH] fix mp4 crash --- src/dialog.cpp | 3 +++ src/imgui/wizard/render_animation.cpp | 29 ++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/dialog.cpp b/src/dialog.cpp index 32b4efb..895c018 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -43,6 +43,7 @@ namespace anm2ed void Dialog::file_open(Type type) { + if (type == Dialog::NONE) return; SDL_ShowOpenFileDialog(callback, this, window, FILTERS[TYPE_FILTERS[type]], std::size(FILTERS[TYPE_FILTERS[type]]), nullptr, false); this->type = type; @@ -50,6 +51,7 @@ namespace anm2ed void Dialog::file_save(Type type) { + if (type == Dialog::NONE) return; SDL_ShowSaveFileDialog(callback, this, window, FILTERS[TYPE_FILTERS[type]], std::size(FILTERS[TYPE_FILTERS[type]]), nullptr); this->type = type; @@ -57,6 +59,7 @@ namespace anm2ed void Dialog::folder_open(Type type) { + if (type == Dialog::NONE) return; SDL_ShowOpenFolderDialog(callback, this, window, nullptr, false); this->type = type; } diff --git a/src/imgui/wizard/render_animation.cpp b/src/imgui/wizard/render_animation.cpp index 3530e13..d22a3aa 100644 --- a/src/imgui/wizard/render_animation.cpp +++ b/src/imgui/wizard/render_animation.cpp @@ -71,11 +71,29 @@ namespace anm2ed::imgui::wizard auto& frameNum = animation->frameNum; auto widgetSize = widget_size_with_row_get(2); - auto dialogType = type == render::PNGS ? Dialog::PNG_DIRECTORY_SET - : type == render::SPRITESHEET ? Dialog::PNG_PATH_SET - : type == render::GIF ? Dialog::GIF_PATH_SET - : type == render::WEBM ? Dialog::WEBM_PATH_SET - : Dialog::NONE; + + Dialog::Type dialogType{Dialog::NONE}; + switch (type) + { + case render::PNGS: + dialogType = Dialog::PNG_DIRECTORY_SET; + break; + case render::SPRITESHEET: + dialogType = Dialog::PNG_PATH_SET; + break; + case render::GIF: + dialogType = Dialog::GIF_PATH_SET; + break; + case render::WEBM: + dialogType = Dialog::WEBM_PATH_SET; + break; + case render::MP4: + dialogType = Dialog::MP4_PATH_SET; + break; + default: + dialogType = Dialog::NONE; + break; + } if (ImGui::ImageButton("##FFmpeg Path Set", resources.icons[icon::FOLDER].id, icon_size_get())) dialog.file_open(Dialog::FFMPEG_PATH_SET); @@ -96,6 +114,7 @@ namespace anm2ed::imgui::wizard else dialog.file_save(dialogType); } + ImGui::SameLine(); auto pathLabel = type == render::PNGS ? LABEL_OUTPUT_DIRECTORY : LABEL_OUTPUT_PATH; input_text_path(localize.get(pathLabel), &path);