minor bug fixes

This commit is contained in:
2025-12-03 02:11:25 -05:00
parent 24f98fe0a0
commit b4fddb7714
9 changed files with 26 additions and 7 deletions

View File

@@ -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();

View File

@@ -3,8 +3,8 @@
#include <imgui/imgui_internal.h>
#include <format>
#include <cmath>
#include <format>
#include <sstream>
#include <unordered_map>
@@ -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{};

View File

@@ -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<const char*>&);
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& = {});

View File

@@ -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)

View File

@@ -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;

View File

@@ -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() = {};
}
}

View File

@@ -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})") \

View File

@@ -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") \

View File

@@ -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]
</description>
<version>2.5</version>
<version>2.6</version>
<visibility>Public</visibility>
</metadata>