private void AnimationFrameEditor(Dictionary <string, SpriteAnimationData> anims) { AnimatedSprite currentFileContext = _currentAsset !.Content !; SpriteAnimationData selAnim = anims[_selectedAnimation]; ImGui.BeginChild("Animation", new Vector2(-1, -1), true); ImGui.Text("Frames: (Drag and Drop to rearrange)"); SpriteAnimationFrameSource frameSource = currentFileContext.FrameSource; _draggedFrame = EditorHelpers.DragAndDropList(selAnim.FrameIndices, _draggedFrame, true); if (selAnim.FrameIndices.Length == 0) { EditorHelpers.ButtonSizedHole(""); } ImGui.PushItemWidth(150); if (ImGui.InputInt("", ref _addFrameInput)) { _addFrameInput = Maths.Clamp(_addFrameInput, 0, frameSource.GetFrameCount() - 1); } ImGui.SameLine(); if (ImGui.Button("Add Frame")) { selAnim.FrameIndices = selAnim.FrameIndices.AddToArray(_addFrameInput); if (_addFrameInput < frameSource.GetFrameCount() - 2) { _addFrameInput++; } _controller.Reset(); UnsavedChanges(); } ImGui.SameLine(); ImGui.Button("Remove (Drop Here)"); if (ImGui.BeginDragDropTarget()) { ImGuiPayloadPtr dataPtr = ImGui.AcceptDragDropPayload("UNUSED"); unsafe { if ((IntPtr)dataPtr.NativePtr != IntPtr.Zero && dataPtr.IsDelivery()) { int[] indices = selAnim.FrameIndices; for (int i = _draggedFrame; i < indices.Length - 1; i++) { indices[i] = indices[i + 1]; } Array.Resize(ref selAnim.FrameIndices, selAnim.FrameIndices.Length - 1); _controller.Reset(); _draggedFrame = -1; UnsavedChanges(); } } ImGui.EndDragDropTarget(); } ImGui.PushItemWidth(150); ImGui.Text("Duration"); ImGui.SameLine(); if (ImGui.InputInt("###DurInput", ref selAnim.TimeBetweenFrames)) { _controller.Reset(); UnsavedChanges(); } ImGui.SameLine(); if (selAnim.FrameIndices.Length > 0) { ImGui.Text($"Total Duration: {selAnim.TimeBetweenFrames * selAnim.FrameIndices.Length}"); } var loopType = (int)selAnim.LoopType; if (ImGui.Combo("Loop Type", ref loopType, string.Join('\0', Enum.GetNames(typeof(AnimationLoopType))))) { selAnim.LoopType = (AnimationLoopType)loopType; _controller.Reset(); UnsavedChanges(); } }