From 3da8928d13409b00b354969d64d890dd336bcfdf Mon Sep 17 00:00:00 2001 From: shweet Date: Fri, 12 Sep 2025 18:39:09 -0400 Subject: [PATCH] fix triggers not serializing correctly --- src/anm2.cpp | 3 ++- src/imgui.cpp | 9 ++++++--- src/imgui.h | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/anm2.cpp b/src/anm2.cpp index fa280f2..84cc47f 100644 --- a/src/anm2.cpp +++ b/src/anm2.cpp @@ -16,7 +16,8 @@ void anm2_frame_serialize(Anm2Frame* frame, Anm2Type type, XMLDocument* document XMLDocument localDocument; XMLDocument* useDocument = document ? document : &localDocument; - XMLElement* element = useDocument->NewElement(ANM2_ELEMENT_STRINGS[ANM2_ELEMENT_FRAME]); + XMLElement* element = type == ANM2_TRIGGERS ? useDocument->NewElement(ANM2_ELEMENT_STRINGS[ANM2_ELEMENT_TRIGGERS]) : + useDocument->NewElement(ANM2_ELEMENT_STRINGS[ANM2_ELEMENT_FRAME]); if (type == ANM2_TRIGGERS) { diff --git a/src/imgui.cpp b/src/imgui.cpp index a4e5ce7..1ce0ece 100644 --- a/src/imgui.cpp +++ b/src/imgui.cpp @@ -1093,10 +1093,13 @@ static void _imgui_timeline(Imgui* self) if (ImGui::BeginDragDropTarget()) { - if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload(frameButton.drag_drop_get())) + Anm2Reference swapReference; + if (const ImGuiPayload* payload = ImGui::GetDragDropPayload()) + swapReference = *(Anm2Reference*)payload->Data; + + if (swapReference != reference && reference.itemType == swapReference.itemType) { - Anm2Reference swapReference = *(Anm2Reference*)payload->Data; - if (swapReference != reference) + if (ImGui::AcceptDragDropPayload(frameButton.drag_drop_get())) { imgui_snapshot(self, IMGUI_ACTION_FRAME_SWAP); diff --git a/src/imgui.h b/src/imgui.h index d169a7d..42693b7 100644 --- a/src/imgui.h +++ b/src/imgui.h @@ -1319,6 +1319,8 @@ IMGUI_ITEM(IMGUI_LAYER_REMOVE, self.label = "Remove", self.tooltip = "Removes the selected layer.\nThis will remove all layer animations that use this layer from all animations.", self.snapshotAction = "Remove Layer", + self.chord = ImGuiKey_Delete, + self.focusWindow = IMGUI_LAYERS.label, self.rowCount = IMGUI_LAYERS_OPTIONS_ROW_COUNT ); @@ -1349,6 +1351,8 @@ IMGUI_ITEM(IMGUI_NULL_REMOVE, self.label = "Remove", self.tooltip = "Removes the selected null.\nThis will remove all null animations that use this null from all animations.", self.snapshotAction = "Remove Null", + self.chord = ImGuiKey_Delete, + self.focusWindow = IMGUI_NULLS.label, self.rowCount = IMGUI_NULLS_OPTIONS_ROW_COUNT );