le readme

This commit is contained in:
2025-06-29 00:49:58 -04:00
parent 0e8d1ae6b4
commit 9083a25a2b
8 changed files with 87 additions and 8 deletions

View File

@@ -1,21 +1,42 @@
# Anm2ed # Anm2ed
Reimplementation of *The Binding of Isaac: Rebirth*'s proprietary animation editor; dealing with manipulating the XML-based ".anm2" format. ![Preview](https://shweetz.net/https://shweetz.net/files/projects/anm2ed/preview.png)
A reimplementation of *The Binding of Isaac: Rebirth*'s proprietary animation editor. Manipulates the XML-based ".anm2" format, used for in-game tweened animations.
## Features
- Most things present in the original IsaacAnimationEditor.exe, except some stuff like drawing (why not use an art program!)
- Smooth [Dear ImGui](https://github.com/ocornut/imgui) interface; docking, dragging and dropping, etc.
- Keybinds/keyboard control for common actions(see [src/input.h](https://github.com/ShweetsStuff/anm2ed/blob/master/src/input.h))
### To do
- Windows release
- Undo queue
- GIF export
- Some other things I can't think of
### Known Issues
- Root Transform doesn't work for scale/rotation (matrix math is hard; if you can help me fix it I will give you $100.)
- Some .anm2 files used in Rebirth might not render correctly due to the ordering of layers; just drag and drop to fix the ordering and save, they will work fine afterwards.
- On startup, you will have to configure the windows yourself.
- Probably several bugs that elude me
## Dependencies
Download these from your package manager:
# Dependencies
- SDL3 - SDL3
- GLEW - GLEW
# Build ## Build
After cloning, make sure to initialize the submodules: After cloning and enter the repository's directory, make sure to initialize the submodules:
```git submodules update --init``` ```git submodules update --init```
Then: Then:
``` ```
mkdir build mkdir build
cd build cd build

View File

@@ -1842,6 +1842,7 @@ imgui_init
Preview* preview, Preview* preview,
Settings* settings, Settings* settings,
Tool* tool, Tool* tool,
UndoStack* undoStack,
SDL_Window* window, SDL_Window* window,
SDL_GLContext* glContext SDL_GLContext* glContext
) )
@@ -1859,6 +1860,7 @@ imgui_init
self->preview = preview; self->preview = preview;
self->settings = settings; self->settings = settings;
self->tool = tool; self->tool = tool;
self->undoStack = undoStack;
self->window = window; self->window = window;
self->glContext = glContext; self->glContext = glContext;
@@ -1923,6 +1925,9 @@ imgui_tick(Imgui* self)
_imgui_taskbar(self); _imgui_taskbar(self);
_imgui_dock(self); _imgui_dock(self);
if (key_press(&self->input->keyboard, INPUT_KEYS[INPUT_UNDO]))
undo_stack_pop(self->undoStack, self->anm2);
} }
void void

View File

@@ -8,6 +8,7 @@
#include "input.h" #include "input.h"
#include "settings.h" #include "settings.h"
#include "tool.h" #include "tool.h"
#include "undo_stack.h"
#define IMGUI_IMPL_OPENGL_LOADER_CUSTOM #define IMGUI_IMPL_OPENGL_LOADER_CUSTOM
#define IMGUI_ENABLE_DOCKING #define IMGUI_ENABLE_DOCKING
@@ -100,6 +101,7 @@ struct Imgui
Preview* preview = NULL; Preview* preview = NULL;
Settings* settings = NULL; Settings* settings = NULL;
Tool* tool = NULL; Tool* tool = NULL;
UndoStack* undoStack = NULL;
SDL_Window* window = NULL; SDL_Window* window = NULL;
SDL_GLContext* glContext = NULL; SDL_GLContext* glContext = NULL;
bool isSwap = false; bool isSwap = false;
@@ -121,6 +123,7 @@ imgui_init
Preview* preview, Preview* preview,
Settings* settings, Settings* settings,
Tool* tool, Tool* tool,
UndoStack* undoStack,
SDL_Window* window, SDL_Window* window,
SDL_GLContext* glContext SDL_GLContext* glContext
); );

View File

@@ -233,7 +233,7 @@ enum KeyType
KEY_RGUI = 231 KEY_RGUI = 231
}; };
#define INPUT_COUNT (INPUT_ZOOM_OUT + 1) #define INPUT_COUNT (INPUT_UNDO + 1)
enum InputType enum InputType
{ {
INPUT_PAN, INPUT_PAN,
@@ -247,7 +247,8 @@ enum InputType
INPUT_ROTATE_LEFT, INPUT_ROTATE_LEFT,
INPUT_ROTATE_RIGHT, INPUT_ROTATE_RIGHT,
INPUT_ZOOM_IN, INPUT_ZOOM_IN,
INPUT_ZOOM_OUT INPUT_ZOOM_OUT,
INPUT_UNDO
}; };
static const KeyType INPUT_KEYS[INPUT_COUNT] static const KeyType INPUT_KEYS[INPUT_COUNT]
@@ -263,7 +264,8 @@ static const KeyType INPUT_KEYS[INPUT_COUNT]
KEY_Q, KEY_Q,
KEY_W, KEY_W,
KEY_1, KEY_1,
KEY_2 KEY_2,
KEY_Z
}; };
struct Keyboard struct Keyboard

24
src/snapshots.cpp Normal file
View File

@@ -0,0 +1,24 @@
#include "undo_stack.h"
void
undo_stack_push(Snapshots* self, Anm2* anm2)
{
if (self->top >= UNDO_STACK_MAX)
{
memmove(&self->snapshots[0], &self->snapshots[1], sizeof(Anm2) * (UNDO_STACK_MAX - 1));
self->top = UNDO_STACK_MAX - 1;
}
self->snapshots[self->top++] = *anm2;
}
bool
undo_stack_pop(Snapshots* self, Anm2* anm2)
{
if (self->top == 0)
return false;
*anm2 = self->snapshots[--self->top];
return true;
}

22
src/snapshots.h Normal file
View File

@@ -0,0 +1,22 @@
#pragma once
#include "anm2.h"
#define SNAPSHOT_STACK_MAX 100
struct SnapshotStack
{
Anm2 snapshots[SNAPSHOT_STACK_MAX];
s32 top = 0;
};
struct Snapshots
{
SnapshotStack undoStack;
SnapshotStack redoStack;
}
void undo_stack_push(UndoStack* self, Anm2* anm2);
bool undo_stack_pop(UndoStack* self, Anm2* anm2);

View File

@@ -143,6 +143,7 @@ init(State* state)
&state->preview, &state->preview,
&state->settings, &state->settings,
&state->tool, &state->tool,
&state->undoStack,
state->window, state->window,
&state->glContext &state->glContext
); );

View File

@@ -22,6 +22,7 @@ struct State
Resources resources; Resources resources;
Settings settings; Settings settings;
Tool tool; Tool tool;
UndoStack undoStack;
bool isArgument = false; bool isArgument = false;
bool isRunning = true; bool isRunning = true;
char argument[PATH_MAX] = STRING_EMPTY; char argument[PATH_MAX] = STRING_EMPTY;