From b4fddb771499ec38dc64aa9cd09b0872c9685acd Mon Sep 17 00:00:00 2001 From: shweet Date: Wed, 3 Dec 2025 02:11:25 -0500 Subject: [PATCH] minor bug fixes --- src/imgui/documents.cpp | 3 +++ src/imgui/imgui_.cpp | 10 ++++++++-- src/imgui/imgui_.h | 1 + src/imgui/window/animations.cpp | 1 + src/imgui/window/events.cpp | 4 +++- src/imgui/window/welcome.cpp | 8 ++++++-- src/resource/strings.h | 2 ++ src/settings.h | 2 +- workshop/metadata.xml | 2 +- 9 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/imgui/documents.cpp b/src/imgui/documents.cpp index fc06c26..925c2db 100644 --- a/src/imgui/documents.cpp +++ b/src/imgui/documents.cpp @@ -119,6 +119,7 @@ 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()) @@ -168,6 +169,8 @@ namespace anm2ed::imgui ImGui::EndPopup(); } + + if ((isClosePopupOpenPrevious != closePopup.isOpen) && isQuitting) isQuitting = false; } ImGui::End(); diff --git a/src/imgui/imgui_.cpp b/src/imgui/imgui_.cpp index 5c0fcb5..48b7e9e 100644 --- a/src/imgui/imgui_.cpp +++ b/src/imgui/imgui_.cpp @@ -3,8 +3,8 @@ #include -#include #include +#include #include #include @@ -116,10 +116,16 @@ namespace anm2ed::imgui return isActivated; } + std::string& selectable_input_text_id() + { + static std::string editID{}; + return editID; + } + bool selectable_input_text(const std::string& label, const std::string& id, std::string& text, bool isSelected, ImGuiSelectableFlags flags, RenameState& state) { - static std::string editID{}; + auto& editID = selectable_input_text_id(); auto isRename = editID == id; bool isActivated{}; diff --git a/src/imgui/imgui_.h b/src/imgui/imgui_.h index 4c1816f..8c19181 100644 --- a/src/imgui/imgui_.h +++ b/src/imgui/imgui_.h @@ -180,6 +180,7 @@ namespace anm2ed::imgui bool input_float_range(const char*, float&, float, float, float = STEP, float = STEP_FAST, const char* = "%.3f", ImGuiInputTextFlags = 0); bool combo_negative_one_indexed(const std::string&, int*, std::vector&); + std::string& selectable_input_text_id(); bool selectable_input_text(const std::string& label, const std::string& id, std::string& text, bool isSelected, ImGuiSelectableFlags flags, RenameState& state); void set_item_tooltip_shortcut(const char*, const std::string& = {}); diff --git a/src/imgui/window/animations.cpp b/src/imgui/window/animations.cpp index d6e6dd2..1f6e4df 100644 --- a/src/imgui/window/animations.cpp +++ b/src/imgui/window/animations.cpp @@ -220,6 +220,7 @@ namespace anm2ed::imgui auto add = [&]() { anm2::Animation animation; + animation.name = localize.get(TEXT_NEW_ANIMATION); if (anm2::Animation* referenceAnimation = document.animation_get()) { for (auto [id, layerAnimation] : referenceAnimation->layerAnimations) diff --git a/src/imgui/window/events.cpp b/src/imgui/window/events.cpp index 656ad33..6be0206 100644 --- a/src/imgui/window/events.cpp +++ b/src/imgui/window/events.cpp @@ -127,7 +127,9 @@ namespace anm2ed::imgui auto add = [&]() { auto id = map::next_id_get(anm2.content.events); - anm2.content.events[id] = anm2::Event(); + anm2::Event event{}; + event.name = localize.get(TEXT_NEW_EVENT); + anm2.content.events[id] = event; selection = {id}; reference = {id}; newEventId = id; diff --git a/src/imgui/window/welcome.cpp b/src/imgui/window/welcome.cpp index 0d44806..0f9441e 100644 --- a/src/imgui/window/welcome.cpp +++ b/src/imgui/window/welcome.cpp @@ -31,9 +31,11 @@ namespace anm2ed::imgui auto widgetSize = widget_size_with_row_get(2); - if (ImGui::Button(localize.get(BASIC_NEW), widgetSize)) dialog.file_save(dialog::ANM2_NEW); // handled in taskbar.cpp + if (ImGui::Button(localize.get(BASIC_NEW), widgetSize)) + dialog.file_save(dialog::ANM2_NEW); // handled in taskbar.cpp ImGui::SameLine(); - if (ImGui::Button(localize.get(BASIC_OPEN), widgetSize)) dialog.file_open(dialog::ANM2_OPEN); // handled in taskbar.cpp + if (ImGui::Button(localize.get(BASIC_OPEN), widgetSize)) + dialog.file_open(dialog::ANM2_OPEN); // handled in taskbar.cpp if (ImGui::BeginChild("##Recent Files Child", {}, ImGuiChildFlags_Borders)) { @@ -97,6 +99,8 @@ namespace anm2ed::imgui ImGui::EndPopup(); } + + selectable_input_text_id() = {}; } } diff --git a/src/resource/strings.h b/src/resource/strings.h index dfa481f..9108d06 100644 --- a/src/resource/strings.h +++ b/src/resource/strings.h @@ -370,6 +370,8 @@ namespace anm2ed X(SHORTCUT_STRING_ZOOM_IN, "Zoom In", "Увеличить", "视图放大", "확대") \ X(SHORTCUT_STRING_ZOOM_OUT, "Zoom Out", "Уменьшить", "视图缩小", "축소") \ X(SNAPSHOT_RENAME_ANIMATION, "Rename Animation", "Переименовать анимацию", "重命名动画", "애니메이션 이름 바꾸기") \ + X(TEXT_NEW_ANIMATION, "New Animation", "Новая анимация", "新动画", "새 애니메이션") \ + X(TEXT_NEW_EVENT, "New Event", "Новое событие", "新事件", "새 이벤트") \ X(TEXT_RECORDING_PROGRESS, "Once recording is complete, rendering may take some time.\nPlease be patient...", "Когда запись завершена, рендеринг может занять некоторое время.\nПожалуйста потерпите...", "录制完成时,渲染可能会花一些时间.\n请耐心等待...", "녹화가 완료되면 렌더링에 시간이 걸릴 수 있습니다.\n잠시만 기다려 주세요...") \ X(TEXT_OPEN_DIRECTORY, "Double-click to open directory in file explorer.", "Дважды нажмите, чтобы открыть директорию в проводнике.", "双击以在文件管理器中打开目录。", "더블 클릭하여 파일 탐색기로 디렉터리를 엽니다.") \ X(TOAST_AUTOSAVE_FAILED, "Could not autosave document to: {0} ({1})", "Не получилось автосохранить документ в: {0} ({1})", "自动保存到 {0} ({1}) 失败", "{0}에 파일을 자동저장할 수 없습니다. ({1})") \ diff --git a/src/settings.h b/src/settings.h index 9322ccc..11c5b0d 100644 --- a/src/settings.h +++ b/src/settings.h @@ -169,7 +169,7 @@ namespace anm2ed X(SHORTCUT_EXIT, shortcutExit, SHORTCUT_STRING_EXIT, STRING, "Alt+F4") \ /* Edit */ \ X(SHORTCUT_UNDO, shortcutUndo, SHORTCUT_STRING_UNDO, STRING, "Ctrl+Z") \ - X(SHORTCUT_REDO, shortcutRedo, SHORTCUT_STRING_REDO, STRING, "Ctrl+Shift+Z") \ + X(SHORTCUT_REDO, shortcutRedo, SHORTCUT_STRING_REDO, STRING, "Ctrl+Y") \ X(SHORTCUT_CUT, shortcutCut, SHORTCUT_STRING_CUT, STRING, "Ctrl+X") \ X(SHORTCUT_COPY, shortcutCopy, SHORTCUT_STRING_COPY, STRING, "Ctrl+C") \ X(SHORTCUT_PASTE, shortcutPaste, SHORTCUT_STRING_PASTE, STRING, "Ctrl+V") \ diff --git a/workshop/metadata.xml b/workshop/metadata.xml index c74d345..af960db 100644 --- a/workshop/metadata.xml +++ b/workshop/metadata.xml @@ -40,6 +40,6 @@ Alternatively, if you have subscribed to the mod, you can find the latest releas [h3]Happy animating![/h3] [img]https://files.catbox.moe/4auc1c.gif[/img] - 2.5 + 2.6 Public