fix mp4 crash

This commit is contained in:
2025-12-29 00:17:46 -05:00
parent f7109c24d0
commit 58077b5522
2 changed files with 27 additions and 5 deletions

View File

@@ -43,6 +43,7 @@ namespace anm2ed
void Dialog::file_open(Type type) 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]]), SDL_ShowOpenFileDialog(callback, this, window, FILTERS[TYPE_FILTERS[type]], std::size(FILTERS[TYPE_FILTERS[type]]),
nullptr, false); nullptr, false);
this->type = type; this->type = type;
@@ -50,6 +51,7 @@ namespace anm2ed
void Dialog::file_save(Type type) 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]]), SDL_ShowSaveFileDialog(callback, this, window, FILTERS[TYPE_FILTERS[type]], std::size(FILTERS[TYPE_FILTERS[type]]),
nullptr); nullptr);
this->type = type; this->type = type;
@@ -57,6 +59,7 @@ namespace anm2ed
void Dialog::folder_open(Type type) void Dialog::folder_open(Type type)
{ {
if (type == Dialog::NONE) return;
SDL_ShowOpenFolderDialog(callback, this, window, nullptr, false); SDL_ShowOpenFolderDialog(callback, this, window, nullptr, false);
this->type = type; this->type = type;
} }

View File

@@ -71,11 +71,29 @@ namespace anm2ed::imgui::wizard
auto& frameNum = animation->frameNum; auto& frameNum = animation->frameNum;
auto widgetSize = widget_size_with_row_get(2); auto widgetSize = widget_size_with_row_get(2);
auto dialogType = type == render::PNGS ? Dialog::PNG_DIRECTORY_SET
: type == render::SPRITESHEET ? Dialog::PNG_PATH_SET Dialog::Type dialogType{Dialog::NONE};
: type == render::GIF ? Dialog::GIF_PATH_SET switch (type)
: type == render::WEBM ? Dialog::WEBM_PATH_SET {
: Dialog::NONE; 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())) if (ImGui::ImageButton("##FFmpeg Path Set", resources.icons[icon::FOLDER].id, icon_size_get()))
dialog.file_open(Dialog::FFMPEG_PATH_SET); dialog.file_open(Dialog::FFMPEG_PATH_SET);
@@ -96,6 +114,7 @@ namespace anm2ed::imgui::wizard
else else
dialog.file_save(dialogType); dialog.file_save(dialogType);
} }
ImGui::SameLine(); ImGui::SameLine();
auto pathLabel = type == render::PNGS ? LABEL_OUTPUT_DIRECTORY : LABEL_OUTPUT_PATH; auto pathLabel = type == render::PNGS ? LABEL_OUTPUT_DIRECTORY : LABEL_OUTPUT_PATH;
input_text_path(localize.get(pathLabel), &path); input_text_path(localize.get(pathLabel), &path);