Compare commits

..
177 Commits
Author SHA1 Message Date
shweet 9aba726e85 Bundle a texture draw's placement, color, vertices and blur into TextureDraw
Most callers set only a transform and tint, by name now, in place of a
nine-parameter call with positional defaults.
2026-11-22 19:58:03 -05:00
shweet ae7dafaef6 Bundle long parameter lists into option structs
FrameRender carries a render's canvas, shader, document, animation, bounds,
background, scale and root transform. Dash and DashedShape replace three
dash floats and a GL mode and count. ViewCamera carries the view menu's
zoom, pan, center, fit and whether fitting is possible. ItemAdd and
ItemsMove carry what item_add and items_move took as seven or eight
positional arguments.
2026-11-22 19:57:11 -05:00
shweet 9e193a3d5c Let playback ticks catch up, and let go of decoded audio nothing holds
While busy only one tick ran a pass, so drawing slower than the tick rate
played animations in slow motion with a growing backlog. Recording takes its
time from the recorder, so every pass now runs the ticks owed (still at most
TICK_DELTA_MAX_MS of them).

Decoded sounds were kept for the session. Every few seconds, those no open
document or library holds are released once they stop playing.
2026-11-22 19:53:49 -05:00
shweet e963bc50d3 Load an out-of-range enum setting as its default
A hand-edited tool=99 or renderType=99 indexed past the end of an array.
2026-11-22 19:52:33 -05:00
shweet 068d189e6a Save files whole or not at all, and keep a render's sounds alive
file_text_save writes a temporary file beside its target, checks every write
and the close, then renames it over the target. A full disk or quota error
no longer leaves a truncated save reported as a success (which then deleted
the autosave). Documents, autosaves, settings and PNGs all save through it.

A recording copies each trigger sound once, so a library reloaded mid-render
leaves its audio mix nothing freed to read. A recording's finish reports
whether its output was made, which animation_record now returns in place of
whether the path existed. A PNG sequence format without a placeholder
numbers each frame after its name instead of writing one file over and over,
and pixel buffers are sized in integers (a float count could run short).
2026-11-22 19:46:22 -05:00
shweet 71b0ef683b Queue handed-over paths for the main loop, and stop listening on any exit
A path handed over before SDL started its event queue was lost (its event
failed to push). Paths now wait in a queue the main loop takes from, and an
event only wakes it. A peer that connects and stays silent times out instead
of holding the listener (and quitting) forever. Forwarded paths are made
absolute first, a forwarded launch no longer opens (and prunes) session logs,
and an exception no longer leaves the listening thread joinable at exit.

Also: a failed audio device open is tried again on the next play, a voice
without a stream isn't kept, subprocess checks _WIN32, and a Process can't be
copied (closing its pipe twice).
2026-11-22 19:43:33 -05:00
shweet 48a6a386e3 Name the current language instead of casting -1 into Language
-1 is outside the enum's range, which the undefined behaviour sanitizer
reports on every localized string.
2026-11-22 19:40:31 -05:00
shweet becd6430ed Find a removed library's layers before the model moves into the flatten
Argument order is unspecified: built with clang, the model moved first, no
layers were found, and every animation layer was flattened.
2026-11-22 19:37:39 -05:00
shweet f35f9cb4b8 Build cleanly under clang, and name the remaining booleans with is
Exported XML templates lose the static clang rejects. Unused this captures,
a dead null check, an undefined declaration, an unused constant and stray
semicolons go, and single statements lose their braces.
2026-11-22 19:35:33 -05:00
shweet c5a2bddfa1 Describe each XML element once, for reading and writing
Each element's attributes, extras and child lists are one *_io function run
by an XmlReader or XmlWriter, as the JSON module does. What the writer leaves
out is an isWritten argument the reader ignores, so reading still takes every
attribute. Unknown children of items, frames and tracks are now kept rather
than dropped.
2026-11-22 19:29:00 -05:00
shweet 7bacfe0cd6 Name markers, icon overlays, list layouts and tooltip anchors instead of passing bools
Autosaves are only ever cleared along with their files, so that flag goes.
2026-11-22 19:16:25 -05:00
shweet c891e1a873 Share the icon card of sounds and libraries, and merge repeated checks in frame dragging 2026-11-22 19:15:12 -05:00
shweet 67b2296fc0 List the change-all wizard's optional fields once 2026-11-22 19:14:28 -05:00
shweet 7a0ef5dd9f Get the selected keyframes, without triggers, from one Document method 2026-11-22 19:13:54 -05:00
shweet b29e208a20 Rename list rows from their label, which is their name where rows rename 2026-11-22 19:13:26 -05:00
shweet c467c39baa Decide a timeline row's visibility in one place 2026-11-22 19:12:59 -05:00
shweet f78d35b12b Save a spritesheet's image from one Document method
The spritesheets window and the close-document prompt both use it.
2026-11-22 19:12:32 -05:00
shweet f6325a794b Share the Add action of events and shaders 2026-11-22 19:11:47 -05:00
shweet 69cb240a8d Pass content lists to the item templates as member pointers
The six one-line accessors go.
2026-11-22 19:11:12 -05:00
shweet 48661b4c2c Edit single frame fields through one helper in Frame Properties 2026-11-22 19:10:32 -05:00
shweet 13bbd8f9c5 Name the id-and-path label for what it is, and drop a duplicate declaration and an unused parameter 2026-11-22 19:09:55 -05:00
shweet 05de859879 Draw the timeline's icon toggles with one method 2026-11-22 19:09:23 -05:00
shweet bbfdafb006 Draw localized checkboxes and radio buttons with their tooltips in one call 2026-11-22 19:08:30 -05:00
shweet f39ea8cdfc Share the persistent-edit state between widgets, and simplify render validation
The three persistent widgets follow their edit through one template. Render checks fail through one helper, and a table picks each render type's dialog.
2026-11-22 19:07:44 -05:00
shweet 045acb181f Hash asset contents eight bytes at a time
A 4096x4096 spritesheet hashes in 8 ms instead of 51 ms on each change.
2026-11-22 19:05:44 -05:00
shweet 0fd0bc4cf2 Drop the framebuffer's unused depth-stencil buffer and resize bookkeeping
Nothing draws with depth or stencil. The renderbuffer calls leave the OpenGL table.
2026-11-22 19:05:12 -05:00
shweet 4b17e9b328 Read the settings file once, keeping Dear ImGui's section as it parses 2026-11-22 19:04:09 -05:00
shweet 91cc11aa3b Test mouse hover and draw bold headings with shared helpers 2026-11-22 19:02:20 -05:00
shweet 69b6acb9e8 Draw frame property changes with a function instead of a one-flag class
ChangeAllFrameProperties becomes frame_properties_change_draw, told where it is drawn by ChangeHost and returning whether it applied.
2026-11-22 19:01:26 -05:00
shweet d2c50b5548 Lay out the welcome window and dockspace with one helper 2026-11-22 19:00:42 -05:00
shweet ada48aefdd Name row drops, merge sources, playback looping and spritesheet merge options
items_move takes a DropZone, animations_merge MergeSources, Playback::tick PlaybackLoop, and spritesheets_merge SpritesheetMergeOptions.
2026-11-22 18:58:37 -05:00
shweet 228a15b5b3 Open documents in one of three ways instead of two bools, and let dialogs know when they take many files
DocumentOpen (open, new, or restored from an autosave) replaces isNew and isRecent and Manager::new_.
The *_OPEN dialogs pick several files without being told.
2026-11-22 18:56:16 -05:00
shweet 1fc6b064ae Pass BakeOptions to every bake instead of rounding bools
RootBakeOptions moves into the model as BakeOptions, used by frame and track bakes and root transforms.
2026-11-22 18:55:16 -05:00
shweet f9dcfb8d79 Describe timeline item types in one style table 2026-11-22 18:53:11 -05:00
shweet a5ffa916d8 Share row drag-and-drop in the timeline, and drop zones with the animations list
One row_drag_drop serves group and track rows, and drop_zone_get splits a row in thirds for both windows.
2026-11-22 18:52:44 -05:00
shweet f7c90945a7 Give the generate-regions popup the shared confirm/cancel row 2026-11-22 18:51:06 -05:00
shweet 14e9668bab Name shortcut keys from ImGui, keeping only the names saved differently
The two key tables become 21 aliases (Num0 to NumEqual, and the arrows). Every key the old tables knew converts to and from text exactly as before.
2026-11-22 18:50:42 -05:00
shweet a9177b13d0 Draw popup confirm/cancel rows with one helper
popup_buttons_draw takes its labels, tooltips and enabled state as a struct. Three hand-written rows use it.
2026-11-22 18:48:58 -05:00
shweet 8d3ebf2329 Add tooltip_set and PopupHelper::begin, and use localize_format
149 localized tooltips, 38 localized formats and 27 modal popups lose their boilerplate.
2026-11-22 18:47:33 -05:00
shweet 99e06b72ea Remove dead UI code and 39 unused strings
Sound pastes use the Paste Sound(s) edit label instead of a toast string.
The popup size table is defined once, and the shaders window reuses asset_path_get.
2026-11-22 18:45:36 -05:00
shweet 15e94192bd Describe frame properties in one table
FRAME_PROPERTIES gives each property's tracks and what copying it takes, for the enum, the check and the copy.
2026-11-22 18:42:11 -05:00
shweet 250adcb6e9 Make Document a Snapshot instead of aliasing one
The state undo restores is Document's own members, and Snapshots takes it by reference.
The DocumentData base, the reference members and the placement-new move assignment are gone.
2026-11-22 18:41:04 -05:00
shweet 544ab3cac9 Drop dead model code, and let edits that select nothing return nothing
Model::uid_get, the UidIndex element types, Playback's accumulator, ID_NONE and track_frames_count_get were unused.
Fourteen edit functions only ever returned an empty selection, so they return void.
2026-11-22 18:39:08 -05:00
shweet c44c7fe8df Share the region and unique-name helpers
Matching a frame to a region, giving a frame its region's rectangle, a region's origin pivot, and naming something Name 2 each live in one place.
2026-11-22 18:36:14 -05:00
shweet 0f5a224e7a Write documents in one of three modes instead of ten flags
SAVE_GAME, SAVE_EDITOR and SAVE_CLIPBOARD are the only combinations the editor used.
The dirty-state hash uses the editor's copy. The eased-frame baking only a test preset reached is gone.
Goldens: the old editor preset is now clipboard, game and editor replace isaac and anm2ed, and default is gone.
Every changed golden equals its old one without default tints and color offsets.
2026-11-22 18:33:49 -05:00
shweet 7e3c5cfeb5 Share one set of group operations between tracks and animations
model/group.h walks, finds, takes, wraps, unwraps and expands lists of items and groups.
Track and animation groups both keep their members in items, and the edits, bakes, merges and writers use it.
2026-11-22 18:31:13 -05:00
shweet 03bbb93ba6 Replace glm with vec.h
Vec2, IVec2, Vec3, Vec4, IVec4 and a column-major Mat4, with glm's formulas, in one header.
Free functions are vec_ and mat4_ prefixed. The leaked using namespace glm is gone.
Render goldens still match.
2026-11-22 18:15:02 -05:00
shweet c38a3a9890 Sleep while idle
With no input for a second and nothing playing, recording, fading or being typed, the window redraws 20 times a second instead of 120, and wakes on the next event.
Idle CPU with a document open went from 5.6% to 1.7% of a core.
2026-11-22 17:46:36 -05:00
shweet 20209e655e Read the system CJK font once, and hold fonts as ImFont pointers
Each of the four fonts merged the system CJK font from a fresh read of its file, twice, and never freed it.
It is now read once and shared. Startup memory with a document open went from 412 MB to 269 MB.
2026-11-22 17:44:07 -05:00
shweet 2f1e75da37 Keep the log file open, drop the stderr pipe thread
A session log is written line by line through one open file. The last ten sessions are kept.
FFmpeg's warnings and errors are appended to the log by the shell instead.
2026-11-22 17:42:54 -05:00
shweet d2c0e32ff5 Start the editor from main, and hand paths over with a small instance listener
Loader and State are folded into main.cpp. SDL_main gives Windows UTF-8 arguments.
instance.cpp replaces the Socket class. A later editor sends its paths and waits for the first to answer.
When something else holds the port, the editor now runs on its own instead of quietly exiting.
2026-11-22 17:40:24 -05:00
shweet 6f2fc8c196 Load OpenGL through SDL instead of glad
gl.h lists the 62 functions the editor calls, loaded with SDL_GL_GetProcAddress into gl, as in smack-a-brother.
The 25k lines of glad and KHR headers are gone.
2026-11-22 17:36:29 -05:00
shweet 7e81ea4259 Play sounds with SDL audio and stb_vorbis instead of SDL_mixer
Sounds decode once to 48 kHz stereo floats. Each play is a stream on one shared device, opened on the first play.
A render's audio is mixed offline at 48 kHz, so command line renders get their sounds too.
The About music is Ogg Vorbis now. Opus, libopus and libogg are gone.
2026-11-22 17:34:01 -05:00
shweet 7afdf709c3 Format like smack-a-brother, and write comments as sentences
Four-space indents, braces on their own lines, and one-statement bodies without braces.
Semicolons in comments became full stops.
Designated initializers may leave fields out without a warning.
2026-11-22 17:30:03 -05:00
shweet 40f6b554b5 Initialize with = instead of braces, and drop const from local autos
Scalars get = 0, = false or = nullptr. Standard containers and strings rely on their constructors.
Other types get = {} or = value, and lists keep = {...}.
glm types are left alone until they're replaced.
2026-11-22 17:27:24 -05:00
shweet 666f65bf3a Remove namespaces, and make file-local helpers static
Names that only a namespace told apart get prefixes: TOOL_PAN, FONT_BOLD, ICON_FOLDER, COLOR_WHITE, path_to_utf8 and so on.
The OpenGL shader class is ShaderProgram, and its uniform ShaderUniform, beside the document's Shader and Uniform.
Free functions a member of the same name would hide are called through :: for now.
Two unused shader window helpers are gone.
2026-11-22 17:25:09 -05:00
shweet 7fb2c607c2 Flatten src into model, edit and ui, with .h headers
Resources and utilities sit directly in src. The ImGui windows, wizards, popups and helpers are in ui.
Headers that would shadow system ones are renamed: math_util, timestamp, subprocess, localization.
Includes are written from src.
2026-11-22 17:12:05 -05:00
shweet a515267e26 Build: libraries optimized, resources compiled from files, stb and doctest as submodules
CMAKE_BUILD_TYPE is now set before the libraries are added, so SDL, SDL_mixer and lunasvg build optimized.
Release on Linux is -O2 with unused sections dropped and the binary stripped.
SDL builds only what the editor uses. simdjson builds without exceptions and with two parsers.
Fonts, icons, the About music and friends live under resources/ and compile in through one generated C file.
The string tables are shared between files instead of copied into each.
nanosvg and imconfig.h were unused and are gone.
2026-11-22 17:07:36 -05:00
shweet 4e35f9d450 Stop tracking CLAUDE.md 2026-11-22 16:57:26 -05:00
shweet 9072ac5745 JSON: shorter keys, a child object, a markers pair, and no version key 2026-11-22 16:57:26 -05:00
shweetandClaude Opus 5.5 8ef089d306 Isaac compatibility: Convert and Save bridges what the game can't show
The Isaac prompt offers Convert and Save, Ignore and Save, or Cancel; the
document remembers the choice (IsaacIgnored / "isaacIgnored", editor-only)
for saves that don't ask (the warning off, or `convert`). Converting:
- depth: a copy of the layer per depth ("body (depth +1)"), standing where
  the editor draws it and showing only that depth's frames
- alpha offsets join the alpha tint (the same on opaque pixels)
- skew, blur and shaders: each layer frame using one is drawn alone at 1x
  into <name>.baked.png beside the save (each image once), on a copy of its
  layer ("body (baked)") right after it, one frame per step; a skewed root
  or group root goes into its layers' images. `convert` makes a headless
  OpenGL context for it; without one (or if the sheet can't be written)
  these are dropped with a warning. Autosaves don't bake.
Tests check the bridged copy draws as the editor does, frame by frame.

Purge Default Color Values is gone: XML saves always leave out tints of 255
and color offsets of 0, in both copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 22:59:35 -04:00
shweetandClaude Opus 5.5 065dd522f3 Remove items in use; drop Remove Unused
Every content window's Remove (the Delete key) takes the selection out with
what refers to it: a layer's or null's tracks in every animation, a
spritesheet's plain layers (and regions), an event or sound from its triggers
(dropping triggers left with neither), a shader or region from its frames
(which keep the region's rectangle), and a library's layers, flattened into
plain ones. When anything is in use it asks first, listing what goes ("This
will remove:" ... "Are you sure?"). Remove Unused is gone; Remove takes its
place in each footer.

One reference walk (model.cpp) counts uses and finds unused items, so
shaders on null and root frames count, and an animation layer's unused
spritesheet doesn't. Flattening can be limited to some layers, merging only
their children's triggers, which now record the layer they fired through.
edit::content_remove does the removal; Document::spritesheet_path_resolver_get
is shared with saving.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 22:33:25 -04:00
shweetandClaude Opus 5.5 c9d68781d0 Add a convert command; JSON libraries come before layers
`anm2ed convert <file> [--format json|xml] [--out PATH]` saves a document as
the editor does: XML (the default) is the game's copy with the editor's
embedded, animation layers flattened through their libraries; JSON is the
editor's own. Without --out the file is rewritten in place. JSON problems go
to stderr; a file that can't load or write exits 1, a bad --format 2. A
document loads without an OpenGL context now: its custom shaders just aren't
compiled. The file and --out are made absolute, so a bare file name has a
folder (render and frame crashed on one too).

JSON writes and reads "libraries" before "layers", so a layer's library index
is checked against the libraries rather than reported missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 22:33:15 -04:00
shweetandClaude Opus 5.5 201a7c7cfc Replace tinyxml2 with pugixml
Parsing a 60 MB save drops from about 350 ms to 30 ms (a whole load from about
620 ms to 200). The reader keeps tinyxml2's rules for numbers and booleans
("%d"/"%f" on the leading text; a number or true/false), so every golden is
unchanged, and parse errors now give a line. SVG composing (pack and merge)
builds, clones and prints through pugixml. Tests check escaping by reading a
save back instead of comparing against tinyxml2's printer, and cut
SourceDocument from saves as text. pugixml is a submodule at v1.16; the About
window lists it, and simdjson, instead of tinyxml2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 21:57:39 -04:00
shweetandClaude Opus 5.5 b69b0eaa1b JSON documents; remove the extended format
Documents can be saved as the editor's own JSON (Save as JSON, in Configure's
Serialization row, off by default) and any .anm2 starting with '{' opens as
one. The schema is new, not an XML mirror: content items in arrays (an item's
index is its id), animations keyed by unique name (a repeat saves as "Name 2"),
groups nested, paired values as arrays, a frame on a region storing only the
region, ISO 8601 dates, every default left out, and one line per frame and
content item, with anything else that fits in 100 columns on one line. Unknown
XML isn't kept. Each part is described once (frame_io, track_io, model_io...)
and run by a JsonWriter or a JsonReader; simdjson parses (new submodule). A
JSON file that opens but has unknown keys, wrong types, unknown values or bad
indices lists them by location in a warning toast; libraries toast their load
problems too. With Save as JSON on, saving always shows the Isaac warning.

The extended format is gone: no setting, File menu toggle, ExtendedVersion or
isExtendedFormat. XML saves are always the game's copy with SourceDocument;
old extended files still open. Document saves take Options instead of loose
bools, and model_load reads through model_load_string. docs/json_format.md
replaces docs/extended_format.md; goldens lose ExtendedVersion and the
.extended variants.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 21:48:25 -04:00
shweetandClaude Opus 5.5 d77b2bae71 Open Directory selects the file in the file manager
Showing a spritesheet, sound, library (or Explore XML Location's document)
opens its folder with the file selected: explorer /select on Windows, the
freedesktop FileManager1 ShowItems call on Linux (Nautilus, Dolphin, Nemo,
Caja, Thunar...), falling back to opening the folder. Paths go to the shell
single-quoted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 01:18:05 -04:00
shweetandClaude Opus 5.5 a6f9b425e8 Close seams where an SVG's shapes meet
Anti-aliasing leaves a partly transparent hairline where two shapes share an
edge (each covers about half of those pixels), and the background shows
through. After drawing an SVG, a partly covered pixel with opaque pixels on
both sides of it, along any axis within two pixels, takes their color over
its own and becomes opaque; outer edges keep their anti-aliasing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 00:25:45 -04:00
shweetandClaude Opus 5.5 4141c53681 Remove built-in stop and done events
Events are plain again: no built-in names offered, locked or listed in the
Events window, and the game's copy of a trigger keeps its first event. The
list rows' rename lock and event_id_resolve go with them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 00:20:11 -04:00
shweetandClaude Opus 5.5 5f01e8065d SVG spritesheets: pack, merge, rasterize
Packing an SVG sheet makes a new SVG holding its drawing once (as a symbol),
each region a clipped view of it at its new place; merging makes an SVG
whenever any sheet is one, with PNG sheets embedded as images (the merged
sheet's file name takes the matching extension). Both go through
Image::compose, which also does the pixel versions, so merge_append is gone.
Vector sheets save as their SVG (autosaves too, and images load as PNG or
SVG by content), and their asset key includes the SVG. Rasterize in the
Spritesheets menu turns selected SVG sheets into PNGs beside them, with a
toast for each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 00:15:56 -04:00
shweetandClaude Opus 5.5 bec89bf48f Purge Default Color Values (on by default)
Saves leave out tint channels of 255 and color offsets of 0, which Isaac and
the editor read as those defaults, in both the game's copy and the editor's.
The option sits beside Extended Format in Configure's Serialization row; the
manager takes it with the other settings (chords_set is now settings_apply).
Also drops layer_child_transform_get's unused model parameter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 18:22:26 -04:00
shweet 0857e62419 metadata 2026-10-08 18:47:39 -04:00
shweetandClaude Opus 5.5 d4b88289ac README and extended format spec for libraries, animation layers and the rest
docs/extended_format.md describes ExtendedVersion 2 for converters and game
loaders: libraries, animation layers and how children are placed, timed and
fire triggers, multiple events, SVG spritesheets, the frame attributes and
the transform, and what a Rebirth copy keeps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 18:44:41 -04:00
shweetandClaude Opus 5.5 4a13c345ef Rebirth saves keep children's trigger events; ExtendedVersion 2
Flattening adds the events animation layers' children fire to the
animation's triggers on those frames (events matched by name, added when
missing). Extended documents now write ExtendedVersion="2", for files that
may hold libraries, animation layers, child playback, several events per
trigger, alpha offsets and blur.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 18:43:15 -04:00
shweetandClaude Opus 5.5 38ce53f870 Animation layer tooltips name their animation and library
The Layers window and the timeline share one tooltip line set: a layer's
spritesheet, or its animation and library (Self for this file), noting when
the animation is missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 18:39:25 -04:00
shweetandClaude Opus 5.5 0e705e43fa Animation layers in the timeline: child tracks, stepping in, breadcrumb
An animation layer's row shows a folder; opening it lists its child's tracks
underneath, greyed and read only, with each keyframe drawn where the parent
reaches it. Double-clicking the row (or a child row) steps into the child:
its animation in this tab, or its library's tab (opened if need be), at the
time the parent plays it. A breadcrumb above the timeline leads back out, and
the preview draws the parent around the child, dimmed and frozen where it was
stepped in from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 18:35:29 -04:00
shweetandClaude Opus 5.5 8807096170 Rebirth saves flatten animation layers; missing animations show red; pivot paths follow libraries
A Rebirth document's game copy turns each animation layer into plain layers,
one per layer its child draws, baked a frame at a time (runs of identical
frames merged; skew dropped), adding library spritesheets at paths relative to
the document; the editor's copy is unchanged and the Isaac warning says so.
Layers whose animation isn't in its file are drawn red in the Layers window
(nothing is said while a library hasn't loaded). Onionskin pivot paths are
redrawn when a library loads or reloads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 18:16:35 -04:00
shweetandClaude Opus 5.5 76c2186c81 Child triggers fire; Auto Resource Reload; animation layer labels
Playback, renders and the preview's event label include the triggers of
child animations (from this file or a library) as each child reaches them;
libraries' sounds load with them, and a frame can mix several sounds. The
reload setting is now Auto Resource Reload and covers libraries too.
Animation layers are labeled by their animation (not a spritesheet) in the
timeline and Item Properties as well as the Layers window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 18:06:47 -04:00
shweetandClaude Opus 5.5 280adaa189 SVG sheets: draw tool hint, convert to PNG for Rebirth; game copy skips built-in events
Drawing or erasing on an SVG spritesheet shows why it can't be edited (and
no longer leaves an empty undo step). Saving a Rebirth document whose layers
show SVG spritesheets first offers to convert them into PNGs beside them
(one undoable edit); keeping them counts them in the Isaac warning. The
game's copy of a trigger keeps its first event that isn't stop or done, and
only further custom events count as dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:56:06 -04:00
shweetandClaude Opus 5.5 5d274e547a Spritesheet Editor draws SVG sheets sharp when zoomed
vector_image_get takes an image and a scale, so the editor shares the
preview's per-zoom-level cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:48:41 -04:00
shweetandClaude Opus 5.5 54f62529e0 SVG spritesheets from the file dialog and drag and drop
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:42:22 -04:00
shweetandClaude Opus 5.5 a917d8ae97 SVG spritesheets
An .svg spritesheet loads through lunasvg (now part of the core library) at
one pixel per SVG unit, so regions, crops and picking work as for PNGs. The
preview, renders and CLI draw it again, cached per power-of-two zoom level up
to 8x, so it stays sharp when zoomed or scaled. Its pixels aren't edited
(pencil, eraser, pack and merge leave it alone, and Save skips it), and the
Isaac warning counts SVG sheets since the game can't load them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:41:57 -04:00
shweetandClaude Opus 5.5 b31a28ebe9 Several events per trigger, built-in stop and done events
A trigger holds a list of events (Frame Properties lists them like sounds);
the first stays its EventId, the rest are <Event Id> children in the
editor's copy, and the Isaac warning counts the dropped ones. In extended
documents, stop and done are offered as built-in events: listed in italics
at the top of Events, locked from renaming, and added to the file when a
trigger first uses one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:35:11 -04:00
shweetandClaude Opus 5.5 4375844c84 Alpha color offset
Color Offset gains an alpha channel (Frame Properties, Change All, property
copy, interpolation and root folding), drawn by adding it to the texel's
alpha. Saved as AlphaOffset in the editor's copy only and counted by the
Isaac warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:22:15 -04:00
shweetandClaude Opus 5.5 0adb0f89bc Frame Blur (Flash's blur filter), child properties in Change All Frame Properties, flips under Visible
Blur is a layer frame's box blur, as Flash's low-quality BlurFilter: a box that many canvas pixels wide, averaged
over the frame's crop (premultiplied) by the texture shader, the quad grown by its reach. An animation layer blurs
its child's draws at least as much. It interpolates, copies, batches (clamped to 0-255), saves as an editor-only
Blur attribute and counts as an Isaac issue.

Change All Frame Properties gains the Child section (animation, mode, start frame, random, restart), applied only
to animation layers and disabled when no animation layer is targeted. Frame Properties' Flip X/Y sit below Visible
instead of inside Child.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:16:49 -04:00
shweetandClaude Opus 5.5 6b6cd671f7 Item Properties shares Layer Properties' source fields
New layers added from the timeline can play an animation too: both popups
draw the source with layer_source_draw and build the item from the same
ItemEdit, and edit::item_add takes the new layer or null whole.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:02:28 -04:00
shweetandClaude Opus 5.5 af60cdc11c Item Properties fits its content
The popup is small and as tall as its options instead of half the screen;
the existing-items list keeps a fixed height.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 16:59:35 -04:00
shweetandClaude Opus 5.5 e8372ca149 Layer Properties source layout, Add as Library on drop, library animations in tooltips
Layer Properties puts Source under its own separator with the radio buttons
on one line (scoped so they no longer clash with the combos' ids), and the
library combo calls this file "Self". Dropping an .anm2 offers Add as
Library. A library's animations are listed in its tooltip instead of a
dropdown under its card.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 16:56:26 -04:00
shweetandClaude Opus 5.5 d1a6d89d14 Libraries window, animation layers and child playback
A Libraries window (docked with Spritesheets and Sounds) links other .anm2
files: cards list each one's animations, open it as a tab, and reload when
it changes on disk. A layer's Source is a spritesheet or an animation, from
this file or a library; the preview, renders and CLI draw the child in the
layer's frame. Animation-layer keyframes set the child's animation, mode
(loop, once, hold), start frame (or random) and restart; Child is also a
copyable frame property. All of it is editor-only and counted by the Isaac
warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 16:51:48 -04:00
shweetandClaude Opus 5.5 6edf5f0e5b Per-document target: Extended or Rebirth
A document remembers whether it saves as the editor's document alone (marked
with ExtendedVersion on Info) or as Rebirth's document with the editor's copy
embedded. Detected on open; File > Extended Format toggles it (undoable). The
setting is now the default for new files, and the Isaac compatibility warning
only applies to Rebirth documents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 16:14:25 -04:00
shweetandClaude Opus 5.5 1381824fb7 Rename Shear to Skew
The property, tool, settings, strings and saved attribute are now Skew
(SkewX/SkewY in the editor's copy). Files with ShearX/ShearY still load,
and settings saved under the old names carry over. Goldens differ only in
the attribute name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 15:42:36 -04:00
shweetandClaude Opus 5.5 2ce8795b4a Trigger sounds: overlap instead of cutting off, and play once per frame
- A sound can play over itself: each play uses a track that isn't busy
  (reusing finished ones), so close triggers no longer restart each other.
  Rendered audio mixes them the same way.
- The preview plays each frame's trigger sound once as playback reaches the
  frame, instead of on every tick spent in it, and no longer skips the
  sound of a frame passed over between ticks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 22:26:00 -04:00
shweetandClaude Opus 5.5 ef5796d667 Merging animations places triggers after the animation merged before them
Appending moves the appended animation's triggers by the length merged so
far; prepending moves the target's triggers by the prepended length.
Replace and ignore keep trigger times. Goldens for prepend merges updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 02:03:20 -04:00
shweetandClaude Opus 5.5 a440af3c95 Change All Frame Properties: Depth
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 01:24:05 -04:00
shweetandClaude Opus 5.5 f3fb7d5101 Layer frame depth: change a layer's draw order for part of an animation
Layer frames get an editor-only Depth (Frame Properties, property
copy/paste): +N draws that layer N layers above its place in the timeline
for that frame, -N below; stepped, not interpolated. The draw list orders
layers by it (preview, renders, CLI). Saved as Depth in the editor's copy
only; the Isaac Compatibility Warning and anm2ed info count frames using it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 01:21:50 -04:00
shweetandClaude Opus 5.5 94d0bbf206 Split works on every selected frame
Split (menu and shortcut) splits each selected frame that spans the time
under the cursor or playhead; triggers are skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 00:51:48 -04:00
shweetandClaude Opus 5.5 f4fd255a02 CLI GIF/video rendering uses the editor's FFmpeg setting unless --ffmpeg is given
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 13:36:15 -04:00
shweetandClaude Opus 5.5 abb9f965d6 The CLI is a mode of anm2ed (anm2ed info|frame|render ...), not a separate binary
On Windows it attaches to the console it was started from, and gets UTF-8
arguments like the editor does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 13:34:36 -04:00
shweetandClaude Opus 5.5 2dbbfa5e86 anm2ed-cli and render tests: look at animations without the editor
- anm2ed-cli info|frame|render: a text summary, one frame as a PNG, or the
  whole animation as a contact sheet, PNG sequence, GIF or video, drawn by
  the editor's OpenGL renderer in a hidden window (render::HeadlessGL).
- render::animation_frame_render / animation_record draw an animation's
  layers over its bounds (Canvas::layers_render, also used by About) and
  record them through the existing Recorder.
- The editor's code builds as anm2ed_app, shared by the editor, the CLI and
  anm2ed_render_tests, which checks a fixture's pixels and golden PNGs
  (with tolerance; skipped without OpenGL) and leaves its renders in
  build/renders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 13:32:42 -04:00
shweetandClaude Opus 5.5 356d74ebb6 Workshop description matches the README's features; README mentions detachable windows
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:31:39 -04:00
shweetandClaude Opus 5.5 4d949827c8 Toasts: drop leftover blank line
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:13:43 -04:00
shweetandClaude Opus 5.5 4856d9ba27 Detachable windows (Dear ImGui multi-viewports)
Settings > Display > Detachable Windows (on by default): any window can be
dragged outside the main window into its own OS window; the backend leaves
it off on Wayland. Detached windows are rendered after the main one, the
main window's close button still quits, window backgrounds are opaque, and
toasts anchor to the main window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:13:33 -04:00
shweetandClaude Opus 5.5 d53d176125 Define NOMINMAX on Windows so windows.h doesn't break std::max
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:02:26 -04:00
shweetandClaude Opus 5.5 dd898c2a0c Same-line Pivot Path/Only Selected Item and the save warning options
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:48:46 -04:00
shweet 9ff05e389d agents... 2026-10-03 21:37:02 -04:00
shweetandClaude Opus 5.5 c09e8ca64e README: current features, build and tests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:34:40 -04:00
shweetandClaude Opus 5.5 ce3b544392 Autosave edited spritesheets beside their files
With document autosave, spritesheets with unsaved pixel edits are written
to a hidden .<name>.png.autosave beside their PNG (only when changed since
their last autosave; a spritesheet edit alone also triggers the document
autosave). Restoring a document's autosave brings them back as unsaved
edits without touching the PNGs. The copies are removed when the
spritesheet is saved or reloaded, or the document's autosave is discarded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:28:02 -04:00
shweetandClaude Opus 5.5 ded95f436a Paste Property is one item; spritesheet reload every 3 s; Snapshots reads Undo/Redo
- Paste > Property pastes the property that was copied, enabled only when
  the clipboard holds one the selected frames can take.
- Auto spritesheet reload checks every 3 seconds (no interval setting); its
  Enabled checkbox no longer shares an ID with Autosave's.
- The Snapshots section in Configure is now Undo/Redo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:21:44 -04:00
shweetandClaude Opus 5.5 97be81b5c1 Timeline: cut, copy and paste one frame property
In the frames context menu, Cut/Copy/Paste each open onto Frame (the whole
frame, as Ctrl+X/C/V) or Property, which lists the properties the frame
type has. Copying a property copies the focused (or first selected) frame;
pasting sets just that property on the selected frames, and is disabled
when a target lacks it or what it refers to (region on the target's
spritesheet, shader, event, sounds). Cutting resets it to the default.
Actions gained submenus; edit::frames_property_set does the work (tested).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:11:09 -04:00
shweetandClaude Opus 5.5 8fb28ef30a Isaac compatibility warning on save
Settings > File > Isaac Compatibility Warning (on by default): saving in
the Isaac format first lists what the game's copy can't keep as it is -
eased frames (baked into one-frame steps), group transforms (baked into
their items), shear and shaders (dropped), trigger sounds (dropped) - with
Save Anyway / Cancel. model::isaac_issues_get counts them (tested on the
fixtures).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:05:57 -04:00
shweetandClaude Opus 5.5 251d04848a Timeline start/end markers
Right-clicking the numbered row offers Add Start/End Marker Here and
Remove Markers; Shift+Comma / Shift+Period (configurable) set them at the
playhead. Markers are faded playheads, with the numbers outside their
range darkened, and playback loops within them. They are saved as
StartMarker/EndMarker on the editor's copy (SourceDocument) only, as one
undoable edit each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 21:03:00 -04:00
shweetandClaude Opus 5.5 24af98a68e Onionskin: Pivot Path and Only Selected Item
Pivot Path draws, on the preview, the path each item's pivot travels:
a red point per frame joined by a red dashed line (Canvas::line_render,
on the dashed shader). Only Selected Item limits the onionskin samples
and pivot paths to the selected root, group root, layer or null. Paths
are cached until the document, animation or root-transform view changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:58:39 -04:00
shweetandClaude Opus 5.5 993957decf Auto spritesheet reload; operator symbols on Change All Frame Properties buttons
- Settings > File > Auto Spritesheet Reload (on by default, every 2 s):
  spritesheets whose files change on disk are reloaded as one undoable
  edit; ones with unsaved pixel edits are left alone, and the editor's own
  saves don't trigger a reload. Document::spritesheets_reload is shared
  with the Reload action.
- Change buttons read "= Adjust", "+ Add", "- Subtract", "× Multiply",
  "÷ Divide".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:55:05 -04:00
shweetandClaude Opus 5.5 d8ab5ff018 About: dancing characters rendered 1:1 and scaled up with nearest filtering
Framebuffer gains a filter setting (linear by default); the characters'
canvases use nearest so they stay pixelated at their larger size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:35:42 -04:00
shweet e713c15030 Revert "About: dancing characters at 1:1 size"
This reverts commit 3653295c8f.
2026-10-03 20:34:55 -04:00
shweetandClaude Opus 5.5 3653295c8f About: dancing characters at 1:1 size
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:33:00 -04:00
shweetandClaude Opus 5.5 5f40a789fe About: wider bars that reach the top, characters in the credits box, larger title
Bars are 3x wider and scaled to the loudest recent level, so loud parts
reach the top. The dancing characters stand in the box's bottom corners
inside the bars (sized as the original's robots were); the title row now
holds only the title, twice as large and shrunk to fit its width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:31:33 -04:00
shweetandClaude Opus 5.5 99a3744a31 About: credits roll after the original editor's About box
Recovered from IsaacAnimationEditor.exe (its About form and GDI+ paint
code): the credits scroll up a black box at 30 Hz, one effect per pass
(none, sway with trails, stretch to the music with trails while the title
flashes random colors, per-line sine wave), between left/right volume bars
that leave fading trails and shade from red into a color cycling with time.
The bars follow the music's loudness through a new audio::levels_get.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:25:44 -04:00
shweetandClaude Opus 5.5 2c4bee6330 Convert scales saved as multipliers to percents on load
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:09:03 -04:00
shweetandClaude Opus 5.5 70abe366a0 Scales are saved as percents, clamped on load
UI Scale (50-200%) and render Scale (25-1000%) both step by 25%. Settings
saved as multipliers read as tiny percents and clamp to the minimum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:07:53 -04:00
shweetandClaude Opus 5.5 e6a374f571 UI Scale and render Scale are entered as percents
input_percent_range edits a multiplier setting as a percent, so saved
settings keep their meaning. UI Scale: 50-200% in 25% steps; render Scale:
10-1000%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:05:27 -04:00
shweetandClaude Opus 5.5 640bf0abeb Write XML, hashes and clipboard text straight from the model
The writer emits to a Sink instead of building an XmlNode tree: TEXT prints
as tinyxml2's XMLPrinter would, HASH folds the same elements into the FNV
hash, and TREE still builds nodes (for the FrameRestore backup). Unknown
children are interleaved at their read positions as elements stream out;
numbers skip escaping.

Corpus (1,251 files, Release): save 0.73 s -> 0.50 s, extended save
0.12 s -> 0.06 s, hash 0.13 s -> 0.05 s. Saves, hashes and clipboard text
are byte-identical to before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:00:51 -04:00
shweetandClaude Opus 5.5 210232eb83 Faster saving and hashing
- XML text is printed straight from the node tree by a Printer that matches
  tinyxml2's XMLPrinter byte for byte; no tinyxml2 document is built to save.
- Numbers format with std::to_chars (whole numbers as integers) instead of
  snprintf, with the same text as "%.8g".
- Frame attribute and track child vectors are reserved up front.
- Repeated attributes in a read file collapse as tinyxml2 wrote them.

Corpus (1,251 files, Release): save 4.2 s -> 0.77 s, extended save 0.61 s ->
0.12 s, hash 0.28 s -> 0.13 s; every output is byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 19:43:56 -04:00
shweetandClaude Opus 5.5 c4b21fd90c Spritesheet pixel edits live in src/edit/spritesheets.cpp
regions_trim, spritesheet_pack and spritesheets_merge are model functions that
take the source image(s) and return the new image; Document keeps thin
wrappers that store the result as an asset. The edits are now tested
headless (trim, pack, merge with layer remap).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 19:06:20 -04:00
shweetandClaude Opus 5.5 4b6e186f57 Canvases handle input before rendering
Hover is tested against the canvas rectangle (is_canvas_hovered) before the
image is drawn, so pan, zoom, the region hover highlight and the checker
background follow the mouse in the same frame instead of one frame late.
The spritesheet editor's second hover/mouse computation is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 19:03:12 -04:00
shweetandClaude Opus 5.5 69e78ff77a Timeline: per-frame work runs once, not once per row
Escape, the context menu (and its shortcuts), frame resize drags and the
frame-move drop now run once from frames_child instead of inside every
row's child. draw() hands popups and global shortcuts to popups_update()
and shortcuts_update(). Drops a dead style push/pop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 19:01:40 -04:00
shweetandClaude Opus 5.5 146e5d4ff1 Fix close-popup ImGui stack imbalance, stale region hover, shared resize chord state, window properties leak
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:58:30 -04:00
shweetandClaude Opus 5.5 c04a685f18 Theme and ImGui helpers live in the imgui namespace, matching their files
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:47:42 -04:00
shweetandClaude Opus 5.5 901c11691b types.hpp is UI-free: theme moves to util/imgui/theme.hpp, ImGui conversions and dummy values to layout.hpp
The model and edit layers no longer include ImGui or localization headers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:45:44 -04:00
shweetandClaude Opus 5.5 ab276f6f08 Move INTERPOLATION_LABELS out of the model into the frame properties wizard
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:42:50 -04:00
shweetandClaude Opus 5.5 36869918e5 Stage 10b: drop stale header includes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:38:30 -04:00
shweetandClaude Opus 5.5 4c569cb1e5 Stage 10a: delete dead code, merge tiny files, unify duplicated concepts
- Dead code: util/map, util/unordered_map, unused vector/math/string/input
  helpers, Document getters, special-interpolation bake leftovers,
  triggers_sort, SnapshotStack::max_size_get, AudioStream capture API.
- Merges: util/xml, util/string, resource/strings.cpp inlined; constants
  into input.hpp; tooltip into layout; Recorder into render; onionskin,
  tools, welcome and frame properties are panel functions; timeline
  popups.cpp folded into timeline.cpp.
- util/origin.hpp replaced by model Origin (the merge setting stays a
  combo index, so saved preferences keep their meaning).
- Item type names/icons/colors moved from model/common.hpp to the
  timeline header; the model no longer includes icon/strings headers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:35:22 -04:00
shweetandClaude Opus 5.5 4d16f21541 Stage 9c: Recorder for renders; no settings override; spritesheet follows selection
- Recorder (imgui/window/recorder.*) owns a render: frame times, captured
  frames on disk, per-frame trigger sounds, and assembling PNGs, spritesheets
  (Image::paste) or ffmpeg output. Start, finish, cancel and failure share one
  stop path.
- Isolated and bounded renders no longer overwrite and restore Settings, pan,
  zoom and overlay: the preview draws with view values derived for the render.
- Image::region_get replaces the region export's own pixel copy.
- Selecting layer frames focuses their spritesheet (Document::frame_references_set)
  instead of the spritesheet editor forcing it every frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:15:06 -04:00
shweetandClaude Opus 5.5 39ccfb723a Stage 9b: animations draw from a model draw list
- model::animation_draws_get returns what an animation draws at a time (root,
  group roots, layers, nulls; onion-skin samples first), with root and group
  root transforms as each item's parent and their tint/offset folded into
  layer frames.
- The preview, the About friends and animation_rect all use it; the
  preview's render lambda shrinks to drawing the list.
- Tests for draw order and root folding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:11:19 -04:00
shweetandClaude Opus 5.5 595658581f Stage 9a: shared canvas input, edit helpers and tool requirements
- CanvasInput gathers mouse, arrow keys (as a step vector), zoom and modifier
  state once; arrow nudges are one change per tool instead of four.
- frames_change_push/edit_begin_push/document_change_push replace each
  editor's own grouped frame-change command; rect_snap replaces three copies
  of grid-snap code.
- tool::INFO carries whether a tool needs a frame or a spritesheet;
  tool_cursor_update sets the cursor and the "why not" hint for both canvases.
- localize_format for localized format strings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:08:57 -04:00
shweetandClaude Opus 5.5 c6c8e3598b Fix card lists: zero window padding for the list child, tooltips keep the window style
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:00:15 -04:00
shweetandClaude Opus 5.5 dc32483c45 Stage 8c: timeline cleanup
- One TimelineRow type for rows, row selection and drag payloads (replaces
  TimelineItemRow + TimelineRowReference).
- Frame/track selection helpers live on Document (frames_select, frame_select,
  frame_toggle, frames_range_select, frame_focus_select, focus_clear,
  track_select) instead of TimelineContext *_for(Document&) wrappers.
- Drop target and frame-move drag carry References; selection anchors are
  optionals; single-use helpers and write-only fields are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:55:14 -04:00
shweetandClaude Opus 5.5 6f7a457f8f Stage 8b: inline single-use timeline selection wrappers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:48:38 -04:00
shweetandClaude Opus 5.5 d08f59d7ba Stage 8a: panels as plain functions; content selection on the uid Selection
- New panel kit (imgui/window/panel.*): list/card drawing with multi-select,
  rename, arrow keys, drag hooks and tooltips; a list panel helper for the
  context menu, shortcuts and footer; panels build their Actions inline.
- Layers, nulls, events, sounds, spritesheets, regions, shaders and
  animations are plain functions over a small persistent state struct.
- Content items are selected by uid in the shared Selection (one kind per
  content type, plus a focus per kind); regions are those of the focused
  spritesheet. Selection survives undo, paste and removal like the timeline's.
- Combo labels are computed when drawn (Document::choices_get).
- Deletes the Window callback framework, WINDOW_FLAGS, Storage and the
  per-window selection snapshot fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:47:21 -04:00
shweetandClaude Opus 5.5 e50d76c784 Stage 7b: model/xml.cpp reads and writes tinyxml2 directly; Element tree removed
- Reading goes from tinyxml2 straight into the typed model, including legacy
  layouts (flat GroupId groups, *AnimationGroups with Index, FrameRestore
  backups, baked frames, SoundId, Overlay) and load-time id/region repair.
- Writing builds an XmlNode tree from the typed model for a set of flags:
  id renumbering, region sync, group-root and interpolation baking happen on
  typed data; groups are nested or extracted the way the old pipeline did.
- Unknown XML is kept verbatim (XmlNode) instead of being re-emitted through
  the Element writer.
- model_hash is an FNV hash of the editor-format node tree (what a save would
  write); the per-fixture hash goldens are gone.
- Deletes src/anm2 (Element, normalize, groups, hash, xml) and the unused
  util/xml attribute helpers and ElementType/ItemType table columns.
- All goldens, invariants and the local corpus are byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:20:45 -04:00
shweetandClaude Opus 5.5 0b6f67d9bd Stage 7: typed model; Element tree is internal to model/xml.cpp
- src/model: typed Model (Info, Content, nested TrackGroup/AnimationGroup,
  copy-on-write shared animations, Extras/XmlNode passthrough for unknown XML,
  layout vectors so saves stay byte-identical).
- src/edit, Document, Selection, Snapshots, every window, the timeline, wizards
  and popups now read and edit model::Model; no UI code touches Element.
- anm2/ is reduced to the XML reader/writer/normalizer behind model/xml.cpp;
  dead Element operations (merge, regions, item_add, rect, frame helpers,
  element_get/unused, deserialize) are deleted.
- Goldens, invariants, undo walk and the local corpus (1,251 files) match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 16:53:17 -04:00
shweetandClaude Opus 5.5 2d0f70b1e5 Stage 6: Document::change() always refreshes derived data; ChangeType removed
change() now flushes drafts, re-syncs assets and shaders, rebuilds every label
list and the uid index, and commits. Document::ChangeType, the switch in
change(), the type parameter of edit_apply/edit_run/edit_push/assets_sync,
Window::changeType and every per-call change type (about 40 sites) are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 15:59:44 -04:00
shweetandClaude Opus 5.5 9f43a210c5 Stage 5: content-hash AssetStore; undo records asset keys, not pixels
- resource::AssetStore (core) keeps immutable images and sounds keyed by content
  hash for the life of the document; nothing is purged until it closes.
- Undo state holds spritesheet/sound id -> asset key maps (always tracked), so
  every edit can undo texture changes; the textures-only snapshot flag
  (edit_begin(label, true) / push(message, isTextures)) and the pixel/audio
  equality helpers are gone.
- Document::texture_get/sound_get read through the store; texture_set/sound_set
  add assets; texture_edit gives the pencil a private draft that becomes a new
  asset on the next change().
- Spritesheet dirty state compares path + asset key instead of hashing pixels.
- Preview audio reads sounds through the store.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 15:53:34 -04:00
shweetandClaude Opus 5.5 65a3546c3b Stage 4: one uid-based Selection for the timeline and animations list
- Selection { map<kind, set<uid>> uids; Handle focus; } (src/selection.*, core)
  replaces Document::reference, the frames/items/animation Storages,
  groupReferences, and the timeline's selection snapshot/lock/focus state.
- Because selection is by uid it follows elements through edits by itself;
  after an edit or undo, selection_follow only drops removed uids and moves a
  removed focus to its nearest survivor. The Stage 2 handle capture/re-resolve,
  frames_reference_normalize_for, frames_selection_sync_for and the index-based
  frame validity repair are gone.
- Document keeps a UidIndex (rebuilt on every change) and exposes
  reference_get/reference_set, selected_get/selected_set(kind),
  frame_references_get/set and animations_selected_get/set.
- UidIndex records each uid's element type.
- The animations list keeps its ImGui multi-select Storage as a per-frame mirror
  of the Selection; content windows are unchanged until Stage 8.
- tests/selection.cpp and tests/undo.cpp cover selection through inserts,
  reverses, deletes, item and animation removal, regrouping and undo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 15:46:47 -04:00
shweetandClaude Opus 5.5 700b613c62 Stage 3: operations layer (src/edit) and one undo entry point
- src/edit/ (in anm2ed_core): frame, track, animation, region, grid and
  change-all edits as plain functions of the model. Each returns the uids of what
  it created for the UI to select; copies get fresh uids.
- Document::edit_apply snapshots, runs an operation and commits; edit_begin
  starts drag edits. window_edit, edit_command_push, snapshot_command_push,
  SnapshotKind and the tracks/frames/regions/textures snapshot kinds are gone;
  Snapshots has a single push(message, isTextures).
- Timeline, animations, regions, shaders, items, wizards, taskbar and file merge
  call the edit layer; they keep only selection, scrolling and toasts.
- Snapshots, Storage, Playback and ImGui core build into anm2ed_core, so undo is
  testable: tests/undo.cpp runs a seeded random walk of edits per fixture and
  checks every undo/redo state by hash, plus selection follow through undo.
- types::edit renamed types::edit_state (clashed with the edit namespace).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 15:26:53 -04:00
shweetandClaude Opus 5.5 20bfbace7a Stage 2: stable element uids and selection that follows edits
- Element::uid: runtime-only, unique per document (uids_repair on load and after
  every edit gives copies and new elements fresh uids; never serialized or hashed)
- Handle {animation, item, frame} uids and UidIndex (one walk: uid -> Reference)
- Snapshots capture the selection's handles when an edit starts and re-resolve the
  fields the edit left untouched on commit, undo and redo; replaces
  restored_snapshot_sanitize. Covers the main reference, frame/item/group
  references, timeline frame selection and the animation list selection.
- tests/selection.cpp: references survive inserts, copies, deletes, animation
  removal/reordering and regrouping

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 15:04:16 -04:00
shweetandClaude Opus 5.5 26ab394fe4 Stage 1: headless Image and AudioData; GPU and playback caches in the UI
- resource::Image (pixels, size, uid) replaces Texture in documents, undo and
  wizards; it lives in anm2ed_core with no GL. uid changes with the pixels.
- resource::texture::id_get uploads lazily and evicts textures not drawn in a frame
- resource::AudioData (bytes, uid) replaces Audio; resource::audio::play/stop/
  track_detach/is_playing cache decoded audio and tracks per uid
- Resources::icon_id_get shortens the icon call sites
- tests/assets.cpp covers Image png round trip, uid tracking, merge_append

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 14:52:34 -04:00
shweetandClaude Opus 5.5 5311c2835f Repair duplicate content ids on load; pass unknown attributes and text through
- Duplicate ids in any content list (spritesheets, shaders, layers, nulls, events,
  sounds, regions) are repaired at load: the first holder keeps the id, so tracks
  stay bound to the item they referenced (previously remapped to the wrong layer)
- Unknown attributes and element text survive save; retired BakeCount/OriginalDelay
  are still dropped. Private corpus (1,251 files) output unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 14:40:20 -04:00
shweetandClaude Opus 5.5 8953101245 Stage 0: continuity test suite
- anm2ed_core static library (anm2 + non-UI util + log) shared by app and tests
- Logger is inert until session_open, so the core has no SDL dependency
- doctest suite: golden round-trips of 12 synthetic fixtures across every
  serialization preset, format and merge type; save/reload invariants
  (fixed point, hash stability, game view equals re-baked game view);
  operation goldens; env-gated private corpus run (ANM2ED_CORPUS)
- ANM2ED_UPDATE_GOLDEN=1 regenerates goldens; tests/MANUAL.md UI checklist

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 14:34:31 -04:00
shweet 8e37b5df3b Claude Code Has Entered 2026-10-03 14:22:12 -04:00
shweetandClaude Opus 5.5 ec72a30ce0 Canvas windows, settings and manager: share view code and list I/O
- CanvasView base holds checker pan sync, zoom step, grid panel, view buttons and view context menu
- frame_parent_model_get replaces five root/group transform compositions
- Canvas builds VAOs through one helper, unifies uniform setters and frees the texture VAO/VBO/EBO (leak fix)
- Settings load/save loop over component suffix tables; unused settings Type enum removed
- Manager shares one path-list load/save for recent and autosave files
- Anonymous namespaces removed per project style

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 13:50:13 -04:00
shweetandClaude Opus 5.5 a4638a422d Frame properties: one field table for change-all, shared widgets
- FRAME_CHANGE_SCALARS generates FrameChange fields, the frames_change apply step and change-all population
- Change-all draws component rows from tables instead of five widget lambdas and 46 aliases
- Frame properties uses one edit path (edit::COMPLETE), a vec2 field table and an X/Y flip loop
- Shared INTERPOLATION_LABELS and Document::layer_regions_get

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 13:44:14 -04:00
shweetandClaude Opus 5.5 30ea363c39 Timeline: drop per-frame callback rebinding and duplicated helpers
- TimelineState base carries persistent state; TimelineContext no longer copies 50 references
- 111 per-frame std::function lambdas become member functions
- Delete wrappers that re-implemented anm2 helpers
- One snapshot/edit push path, one theme color lookup, shared frame grouping/refocus/trigger filters
- Row building and bake targets loop over TRACK_CONTAINERS
- Split commands.cpp into selection.cpp, edit.cpp and menus.cpp

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 13:38:17 -04:00
shweetandClaude Opus 5.5 d926fc6677 Split window.cpp per window and drive menus from one flag table
- WINDOW_FLAGS table builds every context menu, footer and shortcut set
- Shared list-row and card-row renderers replace per-window copies
- Layers/nulls/events share one properties popup; Manager keeps one item popup API
- Regions, spritesheets and sounds drop hand-built menus, footers and shortcut blocks
- Animation remove and cut share one erase path that also clears group ids
- Index-mapped multi-select fixes shift-range over non-contiguous ids
- Fix Remove Unused tooltip showing the Add shortcut and the missing break in item properties

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 13:27:34 -04:00
shweetandClaude Opus 5.5 3f31cedeed Slim Document: move data-model code out, unify edit plumbing
- Region generate/scan move to anm2/regions.cpp; both generators number from 1
- file_merge moves to anm2/merge.cpp and is table-driven
- MaxRects packer moves to util/pack
- Uniform config apply/trim/save move to resource/shader
- Snapshots push from their owned state; Document snapshot wrappers removed
- DocumentData base replaces the hand-written move constructor
- toast_log replaces 55 duplicated toast + English log pairs
- Apply repo .clang-format to touched files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 13:08:00 -04:00
shweetandClaude Opus 5.5 a9f48bc3a0 De-bloat anm2 core: templates, tables, unified emitter
- Collapse const/non-const pairs into templates; Anm2::element_get uses deducing this
- Drive container/track/item mappings from ANM2_ELEMENT_TYPES, ANM2_ITEM_TYPES and TRACK_CONTAINERS
- One sink-based emitter feeds both XML writing and hashing
- frame_mix and frame_bake_split replace five copies of the bake/lerp loop
- item_add replaces layer_animation_add/null_animation_add
- Fix timeline split ignoring shear

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 12:54:24 -04:00
shweetandClaude Opus 5.5 41ed347925 Split anm2 and timeline into modules; merge groups by name
Baseline before de-bloat refactor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 12:41:23 -04:00
shweet 9e9dd8bd8a fix issue with animation length change acting on new reference 2026-08-27 16:09:10 -04:00
shweet b7c24fad99 shading and shearing 2026-08-20 20:03:12 -04:00
shweet 5e27111b21 address log accumulation issue and non-ascii files load on program init 2026-08-13 21:40:28 -04:00
shweet 46690d6975 fixed group reference issue 2026-08-07 14:48:33 -04:00
shweet a4b34cc0be remove overlay window, add document overlay + over/under 2026-08-07 14:42:16 -04:00
shweet e32e781b46 remove compile commands 2026-08-06 11:47:20 -04:00
shweet ff76932555 fix merge window, fix hash slowness (again), touch up overlays (still not sure about them) 2026-07-19 22:35:48 -04:00
shweet 98f87c9d46 fix sound serialization + extended format 2026-07-15 12:47:44 -04:00
shweet c7abe29106 reintroduce region remapping 2026-07-12 17:43:57 -04:00
shweet d3996a218e format fix 2026-07-12 17:39:21 -04:00
shweet 6786bff07c copying items, remove region remapping 2026-07-12 16:37:35 -04:00
shweet c28ea8eb6f tick/fps difference in render animation; touched up 2026-07-10 21:21:25 -04:00
shweet c5a9ab8119 fix spritesheet overwrite warning 2026-07-09 21:37:41 -04:00
shweet 2b662d24d6 slopped up readme too why not 2026-07-09 19:59:15 -04:00
shweet 5792dd25a2 Overlays, Shaders, Group Roots, Serialization Changes. Legalize Nuclear Bombs 2026-07-09 19:49:33 -04:00
shweet 555caf9f4f more slop with regions 2026-07-01 20:49:39 -04:00
shweet 80ef3f8597 buncha slop 2026-07-01 20:04:12 -04:00
shweet f00396bdfe fixed issue with ctrl+click 2026-06-25 00:07:01 -04:00
shweet b5528bc118 fix to document order and bake into other frames works with colors 2026-06-23 19:08:00 -04:00
shweet 6d206045c7 spritesheet editor fix, zoom levels 2026-06-20 22:27:11 -04:00
shweet d079295803 spritesheet editor fix 2026-06-20 20:38:05 -04:00
525 changed files with 40783 additions and 199422 deletions

No files matched your search

+30 -9
View File
@@ -1,11 +1,32 @@
BasedOnStyle: LLVM
IndentWidth: 4
ColumnLimit: 120
PointerAlignment: Left
ReferenceAlignment: Left
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
CommentPragmas: '^'
BreakBeforeBraces: Allman
NamespaceIndentation: All
FixNamespaceComments: false
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: true
SplitEmptyFunction: false
SplitEmptyRecord: false
RemoveBracesLLVM: true
InsertBraces: false
SortIncludes: Never
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
AccessModifierOffset: -4
IndentCaseLabels: true
IndentPPDirectives: BeforeHash
NamespaceIndentation: None
PointerAlignment: Left
View File
Whitespace-only changes.
+3 -1
View File
@@ -9,4 +9,6 @@ cmake-build-debug/
.vs/
.idea/
.codex
AGENTS.md
compile_commands.json
AGENTS.md
CLAUDE.md
+12 -9
View File
@@ -1,19 +1,22 @@
[submodule "external/glm"]
path = external/glm
url = https://github.com/g-truc/glm
[submodule "external/imgui"]
path = external/imgui
url = https://github.com/ocornut/imgui
branch = docking
[submodule "external/tinyxml2"]
path = external/tinyxml2
url = https://github.com/leethomason/tinyxml2
[submodule "external/SDL"]
path = external/SDL
url = https://github.com/libsdl-org/SDL.git
[submodule "external/lunasvg"]
path = external/lunasvg
url = https://github.com/sammycage/lunasvg
[submodule "external/SDL_mixer"]
path = external/SDL_mixer
url = https://github.com/libsdl-org/SDL_mixer
[submodule "external/simdjson"]
path = external/simdjson
url = https://github.com/simdjson/simdjson
[submodule "external/pugixml"]
path = external/pugixml
url = https://github.com/zeux/pugixml
[submodule "external/doctest"]
path = external/doctest
url = https://github.com/doctest/doctest
[submodule "external/stb"]
path = external/stb
url = https://github.com/nothings/stb
-28
View File
@@ -1,28 +0,0 @@
You are a senior level professional software developer, etc.
Use X Macros liberally and lookup tables (maps, etc.) for querying data, etc. Avoid functions for this purpose (i.e., don't map enums to strings with a function). Define X Macros in .cpp files if possible, headers if not.
Try to use structs/defines for data in general.
Prefer enums instead of bools for functions in cases where it makes sense (i.e., instead of true/false, have descriptive enums).
If user asks for "how to", or "why", that's an indicator to generate no code and simply answer their prompt.
Avoid hardcoding specific solutions and always see if there's ways to optimize/crunch down existing code to support whatever solution user is asking for. Your goal is the least lines/files for the same functionality, while maintaing most clarity/simplicy. Do not use comments.
Avoid use of anonymous namespaces. For namepsaces, try to have them match files; don't create superfluous namespaces within documents.
If an if statement has a single line inside, omit the braces.
Functions should use snake case and should typically be written like "[noun]_[verb]". Try and use a limited amount of verbs to describe functionality; "save", "load", etc.
For functions that check if true/false, write them like a question, starting with "is", i.e., "is_[noun]_[verb]".
ImGui hidden labels, etc. that aren't user-facing should be typically like "##Name Here".
If a change is ordered that would impede past API, make it happen regardless without consideration of backwards compatibility.
With bools, ALWAYS name them "is[VariableName]", even if the variable would be gramatically incorrect.
When compiling/building, use as many threads as possible.
+96 -213
View File
@@ -1,235 +1,118 @@
cmake_minimum_required(VERSION 3.27)
project(anm2ed LANGUAGES C CXX)
if(WIN32 AND DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE
"$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "Vcpkg toolchain file")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(CMAKE_EXPORT_COMPILE_COMMANDS AND NOT WIN32)
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/compile_commands.json
${CMAKE_SOURCE_DIR}/compile_commands.json)
endif()
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(MSVC)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug>:ProgramDatabase>")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
macro(anm2ed_set_cache_bool name value)
set(${name} ${value} CACHE BOOL "" FORCE)
endmacro()
anm2ed_set_cache_bool(SDL_STATIC ON)
anm2ed_set_cache_bool(SDL_SHARED OFF)
if(NOT WIN32)
anm2ed_set_cache_bool(SDL_ALSA ON)
anm2ed_set_cache_bool(SDL_ALSA_SHARED ON)
anm2ed_set_cache_bool(SDL_JACK ON)
anm2ed_set_cache_bool(SDL_JACK_SHARED ON)
anm2ed_set_cache_bool(SDL_PIPEWIRE ON)
anm2ed_set_cache_bool(SDL_PIPEWIRE_SHARED ON)
anm2ed_set_cache_bool(SDL_SNDIO ON)
anm2ed_set_cache_bool(SDL_SNDIO_SHARED ON)
endif()
anm2ed_set_cache_bool(SDL_HAPTIC OFF)
anm2ed_set_cache_bool(SDL_JOYSTICK OFF)
anm2ed_set_cache_bool(SDL_SENSOR OFF)
anm2ed_set_cache_bool(SDL_HIDAPI OFF)
anm2ed_set_cache_bool(SDL_CAMERA OFF)
anm2ed_set_cache_bool(SDL_TRAY OFF)
anm2ed_set_cache_bool(SDL_VULKAN OFF)
add_subdirectory(external/SDL EXCLUDE_FROM_ALL)
anm2ed_set_cache_bool(SDLMIXER_DEPS_SHARED OFF)
anm2ed_set_cache_bool(SDLMIXER_AIFF OFF)
anm2ed_set_cache_bool(SDLMIXER_AU OFF)
anm2ed_set_cache_bool(SDLMIXER_FLAC_LIBFLAC OFF)
anm2ed_set_cache_bool(SDLMIXER_FLAC_DRFLAC OFF)
anm2ed_set_cache_bool(SDLMIXER_GME OFF)
anm2ed_set_cache_bool(SDLMIXER_MOD_XMP OFF)
anm2ed_set_cache_bool(SDLMIXER_MP3_DRMP3 OFF)
anm2ed_set_cache_bool(SDLMIXER_MP3_MPG123 OFF)
anm2ed_set_cache_bool(SDLMIXER_MIDI_FLUIDSYNTH OFF)
anm2ed_set_cache_bool(SDLMIXER_MIDI_TIMIDITY OFF)
anm2ed_set_cache_bool(SDLMIXER_OPUS ON)
anm2ed_set_cache_bool(SDLMIXER_VOC OFF)
anm2ed_set_cache_bool(SDLMIXER_VORBIS_STB ON)
anm2ed_set_cache_bool(SDLMIXER_VORBIS_VORBISFILE OFF)
anm2ed_set_cache_bool(SDLMIXER_VORBIS_TREMOR OFF)
anm2ed_set_cache_bool(SDLMIXER_WAVE ON)
anm2ed_set_cache_bool(SDLMIXER_WAVPACK OFF)
anm2ed_set_cache_bool(SDLMIXER_TEST OFF)
anm2ed_set_cache_bool(SDLMIXER_INSTALL OFF)
add_subdirectory(external/SDL_mixer EXCLUDE_FROM_ALL)
add_subdirectory(external/lunasvg)
set(GLAD_SRC ${CMAKE_CURRENT_SOURCE_DIR}/include/glad/glad.cpp)
set(IMGUI_SRC
external/imgui/imgui.cpp
external/imgui/imgui_draw.cpp
external/imgui/imgui_widgets.cpp
external/imgui/imgui_tables.cpp
external/imgui/backends/imgui_impl_sdl3.cpp
external/imgui/backends/imgui_impl_opengl3.cpp)
set(TINYXML2_SRC external/tinyxml2/tinyxml2.cpp)
file(GLOB PROJECT_SRC CONFIGURE_DEPENDS
src/anm2/*.cpp
src/anm2/*.hpp
src/resource/*.cpp
src/resource/*.hpp
src/imgui/*.cpp
src/imgui/*.hpp
src/imgui/window/*.cpp
src/imgui/window/*.hpp
src/imgui/popup/*.cpp
src/imgui/popup/*.hpp
src/imgui/wizard/*.cpp
src/imgui/wizard/*.hpp
src/util/imgui/*.cpp
src/util/imgui/*.hpp
src/util/*.cpp
src/util/*.hpp
src/window/*.cpp
src/window/*.hpp
src/*.cpp
src/*.hpp)
add_executable(${PROJECT_NAME} ${GLAD_SRC} ${IMGUI_SRC} ${TINYXML2_SRC} ${PROJECT_SRC})
set_target_properties(
${PROJECT_NAME}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}/bin")
target_compile_definitions(${PROJECT_NAME} PRIVATE IMGUI_DISABLE_OBSOLETE_FUNCTIONS IMGUI_DEBUG_PARANOID
IMGUI_ENABLE_DOCKING)
target_include_directories(
${PROJECT_NAME}
PRIVATE include
include/glad
external
external/imgui
external/glm
external/tinyxml2
external/lunasvg
external/SDL
external/SDL_mixer
external/SDL_mixer/include
src
src/imgui
src/resource
src/util)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
# Two builds: Release (the default) and Debug. Set before the libraries are added, so they're optimized too.
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_BUILD_TYPE Release)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_definitions(${PROJECT_NAME} PRIVATE DEBUG)
endif()
if(WIN32)
# Keep Release as a GUI app (no console window).
if(CMAKE_BUILD_TYPE STREQUAL "Release")
if(MSVC)
target_link_options(${PROJECT_NAME} PRIVATE /SUBSYSTEM:WINDOWS)
else()
target_link_options(${PROJECT_NAME} PRIVATE -mwindows)
endif()
endif()
else()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -O0 -pg)
else()
set(CMAKE_BUILD_TYPE "Release")
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -O3)
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE m)
endif()
if(WIN32)
enable_language(RC)
target_sources(${PROJECT_NAME} PRIVATE anm2ed.rc)
# Linux release builds: -O2, unused code and data dropped, and the symbols stripped.
# Link-time optimization is left off: it made the binary bigger and every relink take seconds longer.
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
add_compile_options("$<$<CONFIG:Release>:-O2;-ffunction-sections;-fdata-sections>")
add_link_options("$<$<CONFIG:Release>:-Wl,--gc-sections;-s>")
endif()
if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:/std:c++latest>")
target_compile_options(${PROJECT_NAME} PRIVATE /EHsc)
target_link_options(${PROJECT_NAME} PRIVATE /STACK:0xffffff)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(${PROJECT_NAME} PRIVATE /Zi)
target_link_options(${PROJECT_NAME} PRIVATE /DEBUG)
endif()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/std:c++latest>" /EHsc)
endif()
# SDL: static, with only video (OpenGL), audio, events, clipboard and file dialogs.
# Its audio plays WAV and, through stb_vorbis, Ogg Vorbis.
set(SDL_SHARED OFF CACHE BOOL "" FORCE)
set(SDL_STATIC ON CACHE BOOL "" FORCE)
foreach(OPTION TEST_LIBRARY EXAMPLES RENDER GPU VULKAN OPENGLES CAMERA HAPTIC JOYSTICK HIDAPI SENSOR POWER TRAY
OFFSCREEN KMSDRM DUMMYVIDEO DISKAUDIO DUMMYAUDIO OSS JACK SNDIO LIBURING)
set(SDL_${OPTION} OFF CACHE BOOL "" FORCE)
endforeach()
add_subdirectory(external/SDL EXCLUDE_FROM_ALL)
set(LUNASVG_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(external/lunasvg EXCLUDE_FROM_ALL)
# simdjson: its single-file build, without exceptions, with only the AVX2 parser and the portable one.
add_library(simdjson STATIC external/simdjson/singleheader/simdjson.cpp)
target_compile_definitions(simdjson PUBLIC SIMDJSON_EXCEPTIONS=0 SIMDJSON_IMPLEMENTATION_ICELAKE=0
SIMDJSON_IMPLEMENTATION_WESTMERE=0)
# Everything under resources/ is compiled in, through one generated C file (see embed.cmake).
file(GLOB_RECURSE RESOURCES CONFIGURE_DEPENDS resources/*)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/embed/embed.c ${CMAKE_BINARY_DIR}/embed/embed.h
COMMAND ${CMAKE_COMMAND} -DRESOURCES=${CMAKE_SOURCE_DIR}/resources -DOUTPUT=${CMAKE_BINARY_DIR}/embed
-P ${CMAKE_SOURCE_DIR}/embed.cmake
DEPENDS ${RESOURCES} ${CMAKE_SOURCE_DIR}/embed.cmake)
# The core: the model, edits, undo and file formats, with no window or OpenGL. The tests link it alone.
file(GLOB CORE_SOURCES CONFIGURE_DEPENDS src/edit/*.cpp src/model/*.cpp)
foreach(FILE log image audio_data asset_store file path math_util timestamp working_directory pack ui/multiselect
snapshots playback selection)
list(APPEND CORE_SOURCES src/${FILE}.cpp)
endforeach()
add_library(anm2ed_core STATIC ${CORE_SOURCES} external/pugixml/src/pugixml.cpp external/imgui/imgui.cpp
external/imgui/imgui_draw.cpp external/imgui/imgui_widgets.cpp external/imgui/imgui_tables.cpp
${CMAKE_BINARY_DIR}/embed/embed.c)
target_include_directories(anm2ed_core PUBLIC external external/imgui external/stb src
${CMAKE_BINARY_DIR}/embed)
target_link_libraries(anm2ed_core PUBLIC lunasvg simdjson SDL3::Headers)
target_compile_definitions(anm2ed_core PUBLIC IMGUI_DISABLE_OBSOLETE_FUNCTIONS
$<$<CONFIG:Debug>:IMGUI_DEBUG_PARANOID> $<$<BOOL:${WIN32}>:NOMINMAX>)
# The editor: the core with its window, OpenGL and interface. The render tests link it too.
file(GLOB_RECURSE APP_SOURCES CONFIGURE_DEPENDS src/*.cpp)
list(REMOVE_ITEM APP_SOURCES ${CORE_SOURCES} ${CMAKE_SOURCE_DIR}/src/main.cpp)
set_source_files_properties(external/stb/stb_vorbis.c PROPERTIES COMPILE_OPTIONS -w)
add_library(anm2ed_app STATIC ${APP_SOURCES} external/stb/stb_vorbis.c external/imgui/backends/imgui_impl_sdl3.cpp
external/imgui/backends/imgui_impl_opengl3.cpp)
if(WIN32)
set(OPENGL_LIB opengl32)
set(PLATFORM_LIBS
ws2_32
bcrypt
imm32
version
winmm
shell32
ole32
advapi32
gdi32
user32
setupapi
legacy_stdio_definitions)
if(TARGET SDL3::SDL3main)
set(SDL_MAIN_TARGET SDL3::SDL3main)
else()
set(SDL_MAIN_TARGET)
endif()
set(PLATFORM_LIBRARIES opengl32 ws2_32 bcrypt imm32 version winmm shell32 ole32 advapi32 gdi32 user32 setupapi
$<$<BOOL:${MSVC}>:legacy_stdio_definitions>)
else()
set(OPENGL_LIB GL)
set(PLATFORM_LIBS)
set(SDL_MAIN_TARGET)
set(PLATFORM_LIBRARIES GL)
endif()
target_link_libraries(anm2ed_app PUBLIC anm2ed_core SDL3::SDL3-static ${PLATFORM_LIBRARIES})
add_executable(anm2ed src/main.cpp $<$<BOOL:${WIN32}>:anm2ed.rc>)
target_link_libraries(anm2ed PRIVATE anm2ed_app)
set_target_properties(anm2ed PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(MSVC)
target_link_options(anm2ed PRIVATE /STACK:0xffffff $<$<CONFIG:Release>:/SUBSYSTEM:WINDOWS>)
elseif(WIN32)
target_link_options(anm2ed PRIVATE $<$<CONFIG:Release>:-mwindows>)
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE ${OPENGL_LIB} SDL3-static ${SDL_MAIN_TARGET}
SDL3_mixer::SDL3_mixer lunasvg ${PLATFORM_LIBS})
message(STATUS "System: ${CMAKE_SYSTEM_NAME}")
message(STATUS "Project: ${PROJECT_NAME}")
message(STATUS "Compiler: ${CMAKE_CXX_COMPILER}")
get_target_property(PROJECT_COMPILE_OPTIONS ${PROJECT_NAME} COMPILE_OPTIONS)
if(NOT PROJECT_COMPILE_OPTIONS)
set(PROJECT_COMPILE_OPTIONS "<none>")
if(NOT MSVC)
foreach(TARGET anm2ed_core anm2ed_app anm2ed)
target_compile_options(${TARGET} PRIVATE -Wall -Wextra -Wpedantic -Wno-missing-field-initializers)
endforeach()
endif()
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_UPPER)
set(EFFECTIVE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
if(BUILD_TYPE_UPPER)
set(CONFIG_FLAGS_VAR "CMAKE_CXX_FLAGS_${BUILD_TYPE_UPPER}")
if(DEFINED ${CONFIG_FLAGS_VAR})
string(APPEND EFFECTIVE_CXX_FLAGS " ${${CONFIG_FLAGS_VAR}}")
endif()
endif()
string(STRIP "${EFFECTIVE_CXX_FLAGS}" EFFECTIVE_CXX_FLAGS)
if(EFFECTIVE_CXX_FLAGS STREQUAL "")
set(EFFECTIVE_CXX_FLAGS "<none>")
endif()
option(ANM2ED_TESTS "Build the tests" ON)
if(ANM2ED_TESTS)
enable_testing()
set(TEST_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
message(STATUS "Compiler Flags: ${EFFECTIVE_CXX_FLAGS}")
message(STATUS "Target Compile Options: ${PROJECT_COMPILE_OPTIONS}")
message(STATUS "Build: ${CMAKE_BUILD_TYPE}")
file(GLOB TEST_SOURCES CONFIGURE_DEPENDS tests/*.cpp)
add_executable(anm2ed_tests ${TEST_SOURCES})
target_link_libraries(anm2ed_tests PRIVATE anm2ed_core)
target_include_directories(anm2ed_tests PRIVATE external/doctest/doctest)
target_compile_definitions(anm2ed_tests PRIVATE ANM2ED_TEST_DIR="${TEST_DIRECTORY}")
add_test(NAME anm2ed_tests COMMAND anm2ed_tests WORKING_DIRECTORY ${TEST_DIRECTORY})
# Drawing needs OpenGL (skipped without a display). Renders land in build/renders for a look.
file(GLOB RENDER_TEST_SOURCES CONFIGURE_DEPENDS tests/render/*.cpp)
add_executable(anm2ed_render_tests tests/main.cpp ${RENDER_TEST_SOURCES})
target_link_libraries(anm2ed_render_tests PRIVATE anm2ed_app)
target_include_directories(anm2ed_render_tests PRIVATE external/doctest/doctest tests)
target_compile_definitions(anm2ed_render_tests PRIVATE ANM2ED_TEST_DIR="${TEST_DIRECTORY}"
ANM2ED_RENDER_DIR="${CMAKE_BINARY_DIR}/renders")
add_test(NAME anm2ed_render_tests COMMAND anm2ed_render_tests WORKING_DIRECTORY ${TEST_DIRECTORY})
add_test(NAME anm2ed_cli_info COMMAND anm2ed info ${TEST_DIRECTORY}/render/spin.anm2)
endif()
+38 -29
View File
@@ -2,27 +2,24 @@
![Preview](https://shweetz.net/files/projects/anm2ed/preview2.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.
Anm2Ed is a modern editor for *The Binding of Isaac: Rebirth*'s XML-based `.anm2` animation format. It is built as an extended, more comfortable replacement for the original proprietary animation editor, with a dockable Dear ImGui interface and tools aimed at both quick edits and larger animation workflows.
### Clarification
This application was developed with the assistance of a large language model.
## Features
- Extended version of the original proprietary Nicalis animation editor
- Smooth [Dear ImGui](https://github.com/ocornut/imgui) interface; docking, dragging and dropping, etc. You might be familiar with it from [Repentogon](https://repentogon.com/).
- Greatly polished in many areas, to assist with all your animating needs
- New features
- Additional hotkeys/shortcuts (rebindable!)
- Additional wizard options
- Broadened sound support
- Can output .webm, .mp4 or *.png sequence (wih FFmpeg)
- Cutting, copying and pasting
- Onionskinning
- Spritesheet "regions"; pre-set areas to be reused
- Robust snapshot (undo/redo) system
- Selecting multiple frames at a time
- Settings that will preserve on exit (stored in %APPDATA% on Windows or ~/.local/share on Linux)
- Texture packing
- Full `.anm2` editing: spritesheets (PNG or SVG), regions, layers, nulls, events, sounds, shaders, animations, frames and triggers (several events each).
- Animation layers: a layer can play another animation, from the same file or a linked library (`.anm2`), with per-keyframe loop/once/hold, start frame and restart. The timeline shows the child's tracks under the layer; double-click to edit the child in place, with a breadcrumb back out.
- Dockable [Dear ImGui](https://github.com/ocornut/imgui) interface (windows can be detached into their own) with persistent layout, drag and drop, context menus and rebindable shortcuts.
- Timeline: multi-select, cut/copy/paste (whole frames or single properties), duplicate, split, bake, drag to move/resize, and start/end markers to loop a range.
- Groups for animations, layers and nulls, with group transforms baked for the game on save.
- Frame properties for crop, size, position, pivot, scale, skew, rotation, depth, tint, color offset (with alpha), blur (Flash's blur filter), region, shader, visibility, interpolation (including easing) and flips; batch changes across selections.
- Spritesheet editor with pan, move, crop, draw, erase and color picker tools; regions; packing, merging, trimming; spritesheets and libraries reload when their files change on disk.
- Animation preview with grid, axes, pivots, borders, onionskin (with pivot paths), and another document's animation as an overlay.
- Wizards: generate animations from a grid, generate regions, change all frame properties, merge animations and files.
- Render to video, GIF, spritesheet or PNG sequence (FFmpeg), with trigger sounds.
- Saves write the game's format with the editor's own copy embedded (`SourceDocument`), so nothing is lost; animation layers are flattened for the game, and anything else the game doesn't support is warned about first. Documents can instead be saved as the editor's own, human-readable JSON ([format](docs/json_format.md)), which opens like any `.anm2`.
- Undo/redo, autosave (spritesheet edits included) with crash restore, and overwrite warnings.
### Supported Languages
- English
@@ -31,28 +28,40 @@ This application was developed with the assistance of a large language model.
- 中文 (Chinese)
- 한국어 (Korean)
**If you want to help localize for your language, feel free to get in touch to contribute!**
**If you want to help localize for your language, feel free to get in touch to contribute.**
### Note: Rendering Animations
You will need FFmpeg installed to output GIF/video! Get it from [here](https://ffmpeg.org/download.html), and point to the downloaded ffmpeg executable within the program!
### Rendering Animations
FFmpeg is required for video/GIF-style export. Download it from [ffmpeg.org](https://ffmpeg.org/download.html), then point Anm2Ed to the `ffmpeg` executable in the render window.
## Build
After cloning and enter the repository's directory, make sure to initialize the submodules:
After cloning and entering the repository directory, initialize the submodules:
```git submodule update --init --recursive```
```sh
git submodule update --init --recursive
```
### Windows
Visual Studio is recommended for build.
Visual Studio is recommended.
### Linux
```
mkdir build
cd build
cmake ..
make
```sh
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
```
## Happy animating!
![Isaac](https://private-user-images.githubusercontent.com/129694724/482938896-b7f4c7c4-ce38-4062-81e9-bea119c66d1a.gif?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTc4MDY3NTIsIm5iZiI6MTc1NzgwNjQ1MiwicGF0aCI6Ii8xMjk2OTQ3MjQvNDgyOTM4ODk2LWI3ZjRjN2M0LWNlMzgtNDA2Mi04MWU5LWJlYTExOWM2NmQxYS5naWY_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwOTEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDkxM1QyMzM0MTJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xZmU3YmExYWJhZjg1NGZiNTNjODM0NGYyZGI5MjM2MzIxNGM1YTEyOWM2MjAxNDQwZWJhODRhMzUxYjcyZjQ5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.ZROJVPS4oIyhl3kt-FQc3DjI5mci32AHwStjG0Sk8TM)
### Tests
```sh
ctest --test-dir build
```
Render tests draw with OpenGL (skipped without a display) and leave their images in `build/renders`.
## Command Line
`anm2ed <command>` looks at a file without opening the editor, drawing with the editor's renderer:
```sh
anm2ed info file.anm2 # animations, items, spritesheets, Isaac issues
anm2ed frame file.anm2 --out frame.png --time 4 # one frame
anm2ed render file.anm2 --out sheet.png --scale 3 # every frame in a grid (--type pngs|gif|webm|mp4|ogv)
```
Common options: `--animation NAME|INDEX`, `--scale`, `--fps`, `--start`/`--end`, `--background RRGGBB`, `--ffmpeg PATH` (defaults to the editor's FFmpeg setting). `anm2ed render` alone lists them all.
-1
View File
@@ -1 +0,0 @@
/home/anon/sda/Personal/Repos/anm2ed/out/build/linux-release/compile_commands.json
+200
View File
@@ -0,0 +1,200 @@
# Anm2Ed JSON format
The JSON format is the editor's own document, saved alone when **Save as JSON** is on (Configure → Serialization). It holds everything the editor knows about a document; the game can't read it. This page lists its shape and how the editor plays it, so that a converter or a game's loader can match the editor exactly.
A regular save is different: it writes the game's `.anm2` XML, with the editor's copy embedded as `<SourceDocument>`. See [XML saves](#xml-saves).
## Recognizing one
```json
{
"info": {"createdBy": "…", "createdOn": "2026-01-01T12:00:00", "fps": 30, "version": 2},
…
}
```
- **A file is JSON** when its first character, after whitespace, is `{`. There is no format version.
- **Defaults are left out.** Any key missing from an object has its default (listed below).
- **Ids are indices.** An item is referred to by its position in its array, starting at 0.
- **Unknown keys, wrong types, unknown values and out-of-range indices** are reported by where they are (e.g. `animations.Idle.layers[0].frames[2].pos: expected an array of 2 numbers`); the document still opens, with the default in their place.
- **`createdOn`** is ISO 8601 local time.
- **`info.isaacIgnored`** is `true` when the document was last saved with Ignore and Save; see [XML saves](#xml-saves).
## Content
```json
"sheets": [
{"path": "parts.png"},
{
"path": "body.svg",
"regions": [
{"name": "head", "crop": [48, 0], "size": [32, 32], "pivot": [16, 16], "origin": "center"}
]
}
],
"shaders": [
{"name": "glow", "vertex": "glow.vs", "fragment": "glow.fs", "uniforms": [{"name": "strength", "value": "0.5"}]}
],
"libraries": [
"shared/shadows.anm2"
],
"layers": [
{"name": "torso", "sheet": 1},
{"name": "hx", "animation": "Head"},
{"name": "shadow", "library": 0, "animation": "SmallShadow"}
],
"nulls": [
{"name": "hitbox", "showRect": true}
],
"events": [
"shoot",
"done"
],
"sounds": [
"sounds/step.ogg"
]
```
| Item | Key | Default | Meaning |
|---|---|---|---|
| Sheet | `path` | | The image, relative to the document. |
| Region | `name` | `""` | |
| | `crop`, `size`, `pivot` | `[0, 0]` | The rectangle in the spritesheet, and its pivot. |
| | `origin` | custom | `topLeft` or `center` sets the pivot from the size. |
| Shader | `name`, `vertex`, `fragment` | `""` | A custom shader and its source files. |
| | `uniforms` | none | `{ name, binding, value, components: [ { index, binding, value } ] }` |
| Layer | `name` | `""` | The name code should use for the layer (or its instance). |
| | `sheet` | `0` | Its spritesheet; `-1` for one that is missing. |
| | `animation` | none | Makes it an animation layer, playing this animation. |
| | `library` | none | Where `animation` comes from; none means this file. |
| Null | `name` | `""` | |
| | `showRect` | `false` | |
| Event, sound, library | | | A name, or a path relative to the document. |
**SVG spritesheets**
- A spritesheet whose path ends in `.svg` is an SVG.
- One SVG unit is one pixel. Crops, sizes and pivots are in SVG units.
- The editor draws an SVG at whatever resolution it is shown at.
**Libraries**
- A library is another `.anm2` (XML or JSON) whose animations layers can play.
- A path is relative to the file that names it, so a library's own libraries are relative to that library.
**Layers**
- A layer either shows its spritesheet, or plays an animation when `animation` is set.
- **No self-nesting:** an animation never plays inside itself, even through other animations. That draw is skipped.
## Animations
Animations are an object keyed by their name; names are unique (a repeated one is saved as `"Name 2"`, `"Name 3"`…). A key whose object has an `animations` object is a group of animations; a group may share a name with an animation inside it.
```json
"default": "Walk",
"animations": {
"Walk": {
"length": 24, "markers": [4, 19],
"root": […frames…],
"layers": [
{"layer": 0, "frames": […frames…]},
{"group": "arms", "root": […frames…], "layers": [{"layer": 3, "frames": […]}]}
],
"nulls": [{"null": 0, "frames": […]}],
"triggers": [
{"at": 12, "events": [0], "sounds": [0]},
{"at": 23, "events": [0, 1]}
]
},
"Combat": {"expanded": false, "animations": {"Attack": {…}}}
}
```
| Key | Default | Meaning |
|---|---|---|
| `length` | `1` | Frames in the animation. |
| `loop` | `true` | |
| `markers` | `[-1, -1]` | Start and end frames editor playback stays between, inclusive; `-1` for none. Editor-only. |
| `root`, `triggers` | none | Frame arrays. |
| `layers`, `nulls` | none | Tracks and groups, in order. |
| Track `layer` / `null` | | The item the track animates. |
| Track `visible` | `true` | |
| Group `group` | | The group's name; always present. |
| Group `expanded`, `visible` | `true` | Timeline state. |
| Group `root` | one default frame | A transform applied to its tracks after the animation's root. |
| Trigger `at` | | The frame it fires on. |
| Trigger `events` | none | Every event fires on `at`. |
| Trigger `sounds` | none | The editor picks one at random. |
**Layer order**
- Layers draw in `layers` order: the first one is drawn first, so it ends up at the bottom.
- `depth` on a layer frame moves it among the layers for that frame. The sort key is (position in the list + depth, depth).
## Frames
Keys on a frame of a layer, null or root track:
| Key | Default | Meaning |
|---|---|---|
| `pos` | `[0, 0]` | Position in pixels; y points down. |
| `region` | none | Layer frames: a region of the layer's spritesheet. The frame takes its crop, size and pivot, and has none of its own. |
| `crop`, `size` | `[0, 0]` | Layer frames without a region: the spritesheet rectangle. |
| `pivot` | `[0, 0]` | Layer frames without a region: the pivot in the frame's pixels. |
| `scale` | `[100, 100]` | Percent. A negative value flips. |
| `rotation` | `0` | Degrees, clockwise on screen. |
| `skew` | `[0, 0]` | Percent: `x' = x + skew.x/100·y`, `y' = y + skew.y/100·x`. |
| `tint` | `[255, 255, 255, 255]` | RGBA, multiplied. |
| `offset` | `[0, 0, 0, 0]` | RGBA, added after the tint. Alpha may be negative; the result is clamped to 0–1. |
| `blur` | `0` | Layer frames: Flash's low-quality BlurFilter, a box this many canvas pixels wide, averaged over the frame's crop. |
| `depth` | `0` | Layer frames; see Layer order. |
| `shader` | none | A custom shader from `shaders`. |
| `delay` | `1` | Duration in frames. |
| `visible` | `true` | Hidden frames draw nothing. |
| `ease` | none | `lerp`, `in` (t²), `out` (1−(1−t)²) or `inOut`. It blends position, scale, skew, rotation, tint, color offset and blur toward the next frame. |
**A layer frame's transform.** A point `p` of the spritesheet crop, in pixels, lands at:
```
world = Root · GroupRoot · ( pos + Flip · Rotate · Skew · |scale| · (p − pivot) )
```
- `Flip` holds the signs of the scale. When exactly one axis is flipped, the rotation turns the other way.
- A root's transform is `pos + Flip · Rotate · Skew · |scale| · p`. A root has no pivot.
### Animation layer frames
On a layer that plays an animation, a frame places the child, and its `child` object plays it. The object is left out when all its keys are defaults:
```json
{"pos": [8, 0], "child": {"name": "Spin", "mode": "once", "start": 3}}
```
| Key | Default | Meaning |
|---|---|---|
| `name` | the layer's | The animation this keyframe plays, from the same file or library. |
| `mode` | `loop` | `loop`, `once` (stops on its last frame) or `hold` (stays on the start frame). |
| `start` | `0` | The child's frame when its clock starts. |
| `random` | `false` | Start on a random frame instead. |
| `restart` | `false` | Restarts the child's clock at this keyframe. |
**Placement.** The child's whole drawing goes through the frame's transform, with the frame's pivot as the child's origin:
```
world = Root · GroupRoot · ( pos + Flip · Rotate · Skew · |scale| · (q − pivot) )
```
- `q` is a point in the child's space, after the child's own root and groups.
- **Colour:** the frame's tint multiplies the child's colour, and its offset adds to it.
- **Unused keys:** crop, size, region and shader are not used.
**Timing.** The child's time when the parent is at time `t`:
1. **Clock start.** The child's clock starts at the first keyframe. It restarts at any keyframe with `restart`, or whose `name` differs from the previous keyframe's. Each start begins at that keyframe's `start`.
2. **Child time.** Take the start keyframe that most recently began (call its frame `S` and its `start` `C`). The child time is `C + (t − S)`.
3. **Mode.** The keyframe playing at `t` decides the mode:
- `loop` wraps the time over the child's `length`.
- `once` stops at `length − 1`.
- `hold` uses that keyframe's own `start`.
4. **Random start.** A random start is `(layerIndex·73856093 xor keyframeIndex·19349663) mod length`, using unsigned 32-bit arithmetic.
**Child triggers.** A child fires its trigger on each frame it reaches. That is the frames where its whole-number time, or its animation, differs from the previous parent frame's, and always on parent frame 0. A held child fires once.
## XML saves
A regular save writes the game's `.anm2` XML, keeping only what the game reads, followed by the editor's full copy as `<SourceDocument>` (the same data as the JSON, in XML):
- **Default colors** (tints of 255, color offsets of 0) are left out of both copies, since readers assume them.
- **Animation layers** are flattened into plain layers, one per layer the child draws, named `layer/childLayer`. Their frames are baked one per frame and skew is dropped. A library's spritesheets are added with paths relative to the document.
- **Children's trigger events** join the animation's triggers, matched by name.
- **Triggers** keep one event each: the first.
- **Depth** is stood in for by copies of the layer, named for the depth (`body (depth +1)`), placed where the editor draws it, and each showing only the frames at its depth. Groups in such an animation have their roots baked into their tracks.
- **Alpha offsets** join the alpha tint (clamped), which matches on opaque pixels.
- **Skew, blur and shaders** are baked: each layer frame using one is drawn alone at 1x into `<name>.baked.png` beside the save (identical images once), and stands on a copy of its layer (`body (baked)`, on that spritesheet) right after it, one frame per step, while the layer hides those frames. A shaded frame's tint and color offset go into its image; others keep theirs. A skewed root (or group root) goes into its layers' images, and becomes plain; nulls take its transform without the skew. Children of animation layers are flattened first, without their skew. Baking needs OpenGL (`convert` makes a context); without it, these are dropped. Autosaves don't bake.
- These are what **Convert and Save** does; **Ignore and Save**, in the save's Isaac compatibility warning, leaves them out. The document remembers which (`info.isaacIgnored`) for saves that don't ask (the warning turned off, or `convert`).
- **Dropped attributes:** markers, extra events, trigger sounds and libraries.
- **SVG spritesheets** are offered for conversion to PNGs before saving.
Older editor files saved without a game copy (the former extended format) still open, and are written as above when saved again.
+25
View File
@@ -0,0 +1,25 @@
# Writes every file under RESOURCES into one C source as a byte array, with a header naming each as an Embed.
# resources/icon/folder_open.svg becomes ICON_FOLDER_OPEN_SVG.
# Each array ends in a zero not counted in its size, so text can be read as a C string.
# Run as a script: cmake -DRESOURCES=<directory> -DOUTPUT=<directory> -P embed.cmake
file(GLOB_RECURSE FILES RELATIVE ${RESOURCES} ${RESOURCES}/*)
list(FILTER FILES EXCLUDE REGEX "LICENSE")
list(SORT FILES)
set(HEADER "#pragma once\n\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif\n\nstruct Embed\n{\n const unsigned char* data;\n unsigned int size;\n};\n\n")
set(SOURCE "#include \"embed.h\"\n\n")
foreach(FILE ${FILES})
string(MAKE_C_IDENTIFIER ${FILE} NAME)
string(TOUPPER ${NAME} NAME)
file(READ ${RESOURCES}/${FILE} BYTES HEX)
string(REGEX REPLACE "(..)" "0x\\1," BYTES "${BYTES}")
string(APPEND HEADER "extern const struct Embed ${NAME};\n")
string(APPEND SOURCE "static const unsigned char ${NAME}_DATA[] = {${BYTES}0};\n")
string(APPEND SOURCE "const struct Embed ${NAME} = {${NAME}_DATA, sizeof(${NAME}_DATA) - 1};\n")
endforeach()
string(APPEND HEADER "\n#ifdef __cplusplus\n}\n#endif\n")
# The header is only replaced when it changes, so editing a resource doesn't rebuild what includes it.
file(WRITE ${OUTPUT}/embed.h.new "${HEADER}")
file(COPY_FILE ${OUTPUT}/embed.h.new ${OUTPUT}/embed.h ONLY_IF_DIFFERENT)
file(WRITE ${OUTPUT}/embed.c "${SOURCE}")
Submodule external/SDL_mixer deleted from 4182794ea4.
Vendored Submodule
+1
Submodule external/doctest added at 2d0a9359a6.
-1
Submodule external/glm deleted from a583c59e16.
Vendored Submodule
+1
Submodule external/pugixml added at c8033ce9d0.
Vendored Submodule
+1
Submodule external/simdjson added at cfcbfa3311.
Vendored Submodule
+1
Submodule external/stb added at 6b5799bae8.
Submodule external/tinyxml2 deleted from 36ff404c34.
-311
View File
@@ -1,311 +0,0 @@
#ifndef __khrplatform_h_
#define __khrplatform_h_
/*
** Copyright (c) 2008-2018 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/* Khronos platform-specific types and definitions.
*
* The master copy of khrplatform.h is maintained in the Khronos EGL
* Registry repository at https://github.com/KhronosGroup/EGL-Registry
* The last semantic modification to khrplatform.h was at commit ID:
* 67a3e0864c2d75ea5287b9f3d2eb74a745936692
*
* Adopters may modify this file to suit their platform. Adopters are
* encouraged to submit platform specific modifications to the Khronos
* group so that they can be included in future versions of this file.
* Please submit changes by filing pull requests or issues on
* the EGL Registry repository linked above.
*
*
* See the Implementer's Guidelines for information about where this file
* should be located on your system and for more details of its use:
* http://www.khronos.org/registry/implementers_guide.pdf
*
* This file should be included as
* #include <KHR/khrplatform.h>
* by Khronos client API header files that use its types and defines.
*
* The types in khrplatform.h should only be used to define API-specific types.
*
* Types defined in khrplatform.h:
* khronos_int8_t signed 8 bit
* khronos_uint8_t unsigned 8 bit
* khronos_int16_t signed 16 bit
* khronos_uint16_t unsigned 16 bit
* khronos_int32_t signed 32 bit
* khronos_uint32_t unsigned 32 bit
* khronos_int64_t signed 64 bit
* khronos_uint64_t unsigned 64 bit
* khronos_intptr_t signed same number of bits as a pointer
* khronos_uintptr_t unsigned same number of bits as a pointer
* khronos_ssize_t signed size
* khronos_usize_t unsigned size
* khronos_float_t signed 32 bit floating point
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
* nanoseconds
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
* khronos_boolean_enum_t enumerated boolean type. This should
* only be used as a base type when a client API's boolean type is
* an enum. Client APIs which use an integer or other type for
* booleans cannot use this as the base type for their boolean.
*
* Tokens defined in khrplatform.h:
*
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
*
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
*
* Calling convention macros defined in this file:
* KHRONOS_APICALL
* KHRONOS_APIENTRY
* KHRONOS_APIATTRIBUTES
*
* These may be used in function prototypes as:
*
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
* int arg1,
* int arg2) KHRONOS_APIATTRIBUTES;
*/
#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
# define KHRONOS_STATIC 1
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APICALL
*-------------------------------------------------------------------------
* This precedes the return type of the function in the function prototype.
*/
#if defined(KHRONOS_STATIC)
/* If the preprocessor constant KHRONOS_STATIC is defined, make the
* header compatible with static linking. */
# define KHRONOS_APICALL
#elif defined(_WIN32)
# define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
#elif defined(__ANDROID__)
# define KHRONOS_APICALL __attribute__((visibility("default")))
#else
# define KHRONOS_APICALL
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIENTRY
*-------------------------------------------------------------------------
* This follows the return type of the function and precedes the function
* name in the function prototype.
*/
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
/* Win32 but not WinCE */
# define KHRONOS_APIENTRY __stdcall
#else
# define KHRONOS_APIENTRY
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIATTRIBUTES
*-------------------------------------------------------------------------
* This follows the closing parenthesis of the function prototype arguments.
*/
#if defined (__ARMCC_2__)
#define KHRONOS_APIATTRIBUTES __softfp
#else
#define KHRONOS_APIATTRIBUTES
#endif
/*-------------------------------------------------------------------------
* basic type definitions
*-----------------------------------------------------------------------*/
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
/*
* Using <stdint.h>
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
/*
* To support platform where unsigned long cannot be used interchangeably with
* inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t.
* Ideally, we could just use (u)intptr_t everywhere, but this could result in
* ABI breakage if khronos_uintptr_t is changed from unsigned long to
* unsigned long long or similar (this results in different C++ name mangling).
* To avoid changes for existing platforms, we restrict usage of intptr_t to
* platforms where the size of a pointer is larger than the size of long.
*/
#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__)
#if __SIZEOF_POINTER__ > __SIZEOF_LONG__
#define KHRONOS_USE_INTPTR_T
#endif
#endif
#elif defined(__VMS ) || defined(__sgi)
/*
* Using <inttypes.h>
*/
#include <inttypes.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
/*
* Win32
*/
typedef __int32 khronos_int32_t;
typedef unsigned __int32 khronos_uint32_t;
typedef __int64 khronos_int64_t;
typedef unsigned __int64 khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__sun__) || defined(__digital__)
/*
* Sun or Digital
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#if defined(__arch64__) || defined(_LP64)
typedef long int khronos_int64_t;
typedef unsigned long int khronos_uint64_t;
#else
typedef long long int khronos_int64_t;
typedef unsigned long long int khronos_uint64_t;
#endif /* __arch64__ */
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif 0
/*
* Hypothetical platform with no float or int64 support
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#define KHRONOS_SUPPORT_INT64 0
#define KHRONOS_SUPPORT_FLOAT 0
#else
/*
* Generic fallback
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#endif
/*
* Types that are (so far) the same on all platforms
*/
typedef signed char khronos_int8_t;
typedef unsigned char khronos_uint8_t;
typedef signed short int khronos_int16_t;
typedef unsigned short int khronos_uint16_t;
/*
* Types that differ between LLP64 and LP64 architectures - in LLP64,
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
* to be the only LLP64 architecture in current use.
*/
#ifdef KHRONOS_USE_INTPTR_T
typedef intptr_t khronos_intptr_t;
typedef uintptr_t khronos_uintptr_t;
#elif defined(_WIN64)
typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t;
#else
typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t;
#endif
#if defined(_WIN64)
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else
typedef signed long int khronos_ssize_t;
typedef unsigned long int khronos_usize_t;
#endif
#if KHRONOS_SUPPORT_FLOAT
/*
* Float type
*/
typedef float khronos_float_t;
#endif
#if KHRONOS_SUPPORT_INT64
/* Time types
*
* These types can be used to represent a time interval in nanoseconds or
* an absolute Unadjusted System Time. Unadjusted System Time is the number
* of nanoseconds since some arbitrary system event (e.g. since the last
* time the system booted). The Unadjusted System Time is an unsigned
* 64 bit value that wraps back to 0 every 584 years. Time intervals
* may be either signed or unsigned.
*/
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
typedef khronos_int64_t khronos_stime_nanoseconds_t;
#endif
/*
* Dummy value used to pad enum types to 32 bits.
*/
#ifndef KHRONOS_MAX_ENUM
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
#endif
/*
* Enumerated boolean type
*
* Values other than zero should be considered to be true. Therefore
* comparisons should not be made against KHRONOS_TRUE.
*/
typedef enum {
KHRONOS_FALSE = 0,
KHRONOS_TRUE = 1,
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
} khronos_boolean_enum_t;
#endif /* __khrplatform_h_ */
File diff suppressed because it is too large. Load diff
-15776
View File
File diff suppressed because it is too large. Load diff
-147
View File
@@ -1,147 +0,0 @@
//-----------------------------------------------------------------------------
// DEAR IMGUI COMPILE-TIME OPTIONS
// Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure.
// You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions.
//-----------------------------------------------------------------------------
// A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/rebased branch with your modifications to it)
// B) or '#define IMGUI_USER_CONFIG "my_imgui_config.h"' in your project and then add directives in your own file without touching this template.
//-----------------------------------------------------------------------------
// You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp
// files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures.
// Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts.
// Call IMGUI_CHECKVERSION() from your .cpp file to verify that the data structures your files are using are matching the ones imgui.cpp is using.
//-----------------------------------------------------------------------------
#pragma once
//---- Define assertion handler. Defaults to calling assert().
// - If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
// - Compiling with NDEBUG will usually strip out assert() to nothing, which is NOT recommended because we use asserts to notify of programmer mistakes.
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
//#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts
//---- Define attributes of all API symbols declarations, e.g. for DLL under Windows
// Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility.
// - Windows DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions()
// for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details.
//#define IMGUI_API __declspec(dllexport) // MSVC Windows: DLL export
//#define IMGUI_API __declspec(dllimport) // MSVC Windows: DLL import
//#define IMGUI_API __attribute__((visibility("default"))) // GCC/Clang: override visibility when set is hidden
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to clean your code of obsolete function/names.
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
//---- Disable all of Dear ImGui or don't implement standard windows/tools.
// It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp.
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty.
//#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowIDStackToolWindow() will be empty.
//---- Don't implement some functions to reduce linkage requirements.
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a)
//#define IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with Visual Studio] Implement default IME handler (require imm32.lib/.a, auto-link for Visual Studio, -limm32 on command-line for MinGW)
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with non-Visual Studio compilers] Don't implement default IME handler (won't require imm32.lib/.a)
//#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, IME).
//#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default).
//#define IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS // Don't implement default platform_io.Platform_OpenInShellFn() handler (Win32: ShellExecute(), require shell32.lib/.a, Mac/Linux: use system("")).
//#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf)
//#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself.
//#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies)
//#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function.
//#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions().
//#define IMGUI_DISABLE_DEFAULT_FONT // Disable default embedded font (ProggyClean.ttf), remove ~9.5 KB from output binary. AddFontDefault() will assert.
//#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available
//---- Enable Test Engine / Automation features.
//#define IMGUI_ENABLE_TEST_ENGINE // Enable imgui_test_engine hooks. Generally set automatically by include "imgui_te_config.h", see Test Engine for details.
//---- Include imgui_user.h at the end of imgui.h as a convenience
// May be convenient for some users to only explicitly include vanilla imgui.h and have extra stuff included.
//#define IMGUI_INCLUDE_IMGUI_USER_H
//#define IMGUI_USER_H_FILENAME "my_folder/my_imgui_user.h"
//---- Pack vertex colors as BGRA8 instead of RGBA8 (to avoid converting from one to another). Need dedicated backend support.
//#define IMGUI_USE_BGRA_PACKED_COLOR
//---- Use legacy CRC32-adler tables (used before 1.91.6), in order to preserve old .ini data that you cannot afford to invalidate.
//#define IMGUI_USE_LEGACY_CRC32_ADLER
//---- Use 32-bit for ImWchar (default is 16-bit) to support Unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...)
//#define IMGUI_USE_WCHAR32
//---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version
// By default the embedded implementations are declared static and not available outside of Dear ImGui sources files.
//#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h"
//#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h"
//#define IMGUI_STB_SPRINTF_FILENAME "my_folder/stb_sprintf.h" // only used if IMGUI_USE_STB_SPRINTF is defined.
//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
//#define IMGUI_DISABLE_STB_SPRINTF_IMPLEMENTATION // only disabled if IMGUI_USE_STB_SPRINTF is defined.
//---- Use stb_sprintf.h for a faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined)
// Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by stb_sprintf.h.
//#define IMGUI_USE_STB_SPRINTF
//---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui)
// Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided).
// Note that imgui_freetype.cpp may be used _without_ this define, if you manually call ImFontAtlas::SetFontLoader(). The define is simply a convenience.
// On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'.
//#define IMGUI_ENABLE_FREETYPE
//---- Use FreeType + plutosvg or lunasvg to render OpenType SVG fonts (SVGinOT)
// Only works in combination with IMGUI_ENABLE_FREETYPE.
// - plutosvg is currently easier to install, as e.g. it is part of vcpkg. It will support more fonts and may load them faster. See misc/freetype/README for instructions.
// - Both require headers to be available in the include path + program to be linked with the library code (not provided).
// - (note: lunasvg implementation is based on Freetype's rsvg-port.c which is licensed under CeCILL-C Free Software License Agreement)
//#define IMGUI_ENABLE_FREETYPE_PLUTOSVG
//#define IMGUI_ENABLE_FREETYPE_LUNASVG
//---- Use stb_truetype to build and rasterize the font atlas (default)
// The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend.
//#define IMGUI_ENABLE_STB_TRUETYPE
//---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4.
// This will be inlined as part of ImVec2 and ImVec4 class declarations.
/*
#define IM_VEC2_CLASS_EXTRA \
constexpr ImVec2(const MyVec2& f) : x(f.x), y(f.y) {} \
operator MyVec2() const { return MyVec2(x,y); }
#define IM_VEC4_CLASS_EXTRA \
constexpr ImVec4(const MyVec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {} \
operator MyVec4() const { return MyVec4(x,y,z,w); }
*/
//---- ...Or use Dear ImGui's own very basic math operators.
//#define IMGUI_DEFINE_MATH_OPERATORS
//---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices.
// Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices).
// Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer.
// Read about ImGuiBackendFlags_RendererHasVtxOffset for details.
//#define ImDrawIdx unsigned int
//---- Override ImDrawCallback signature (will need to modify renderer backends accordingly)
//struct ImDrawList;
//struct ImDrawCmd;
//typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data);
//#define ImDrawCallback MyImDrawCallback
//---- Debug Tools: Macro to break in Debugger (we provide a default implementation of this in the codebase)
// (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.)
//#define IM_DEBUG_BREAK IM_ASSERT(0)
//#define IM_DEBUG_BREAK __debugbreak()
//---- Debug Tools: Enable highlight ID conflicts _before_ hovering items. When io.ConfigDebugHighlightIdConflicts is set.
// (THIS WILL SLOW DOWN DEAR IMGUI. Only use occasionally and disable after use)
//#define IMGUI_DEBUG_HIGHLIGHT_ALL_ID_CONFLICTS
//---- Debug Tools: Enable slower asserts
//#define IMGUI_DEBUG_PARANOID
//---- Tip: You can add extra functions within the ImGui:: namespace from anywhere (e.g. your own sources/header files)
/*
namespace ImGui
{
void MyFunction(const char* name, MyMatrix44* mtx);
}
*/
-3121
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
-7988
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+94
View File
@@ -0,0 +1,94 @@
Copyright 2018 The Noto Project Authors (github.com/noto-fonts/noto-fonts)
This Font Software is licensed under the SIL Open Font License,
Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to
provide a free and open framework in which fonts may be shared and
improved in partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software
components as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to,
deleting, or substituting -- in part or in whole -- any of the
components of the Original Version, by changing formats or by porting
the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed,
modify, redistribute, and sell modified and unmodified copies of the
Font Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components, in
Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created using
the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+34
View File
@@ -0,0 +1,34 @@
<AnimatedActor>
<Info CreatedBy="robot" CreatedOn="05/21/2026 09:25:40 PM" Fps="30" Version="0"/>
<Content>
<Spritesheets>
<Spritesheet Id="0" Path="ash.png">
<Region Id="0" Name="1" XCrop="1" YCrop="51" Width="52" Height="28" XPivot="25" YPivot="28"/>
<Region Id="1" Name="2" XCrop="1" YCrop="1" Width="48" Height="48" XPivot="24" YPivot="48"/>
</Spritesheet>
</Spritesheets>
<Layers>
<Layer Id="0" Name="Main" SpritesheetId="0"/>
</Layers>
<Nulls/>
<Events/>
</Content>
<Animations DefaultAnimation="Main">
<Animation Name="Main" FrameNum="9" Loop="true">
<RootAnimation>
<Frame XPosition="0" YPosition="0" Delay="9" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
</RootAnimation>
<LayerAnimations>
<LayerAnimation LayerId="0" Visible="true">
<Frame RegionId="1" XPivot="24" YPivot="48" XCrop="1" YCrop="1" Width="48" Height="48" XPosition="1" YPosition="-4" Delay="3" Visible="true" XScale="95" YScale="105" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
<Frame RegionId="0" XPivot="25" YPivot="28" XCrop="1" YCrop="51" Width="52" Height="28" XPosition="1" YPosition="-4" Delay="5" Visible="true" XScale="105" YScale="95" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
<Frame RegionId="1" XPivot="24" YPivot="48" XCrop="1" YCrop="1" Width="48" Height="48" XPosition="1" YPosition="-4" Delay="1" Visible="true" XScale="90" YScale="110" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
</LayerAnimation>
</LayerAnimations>
<NullAnimations/>
<Triggers/>
</Animation>
</Animations>
</AnimatedActor>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

+36
View File
@@ -0,0 +1,36 @@
<AnimatedActor>
<Info CreatedBy="robot" CreatedOn="05/21/2026 11:54:09 PM" Fps="30" Version="0"/>
<Content>
<Spritesheets>
<Spritesheet Id="0" Path="isaac.png">
<Region Id="0" Name="1" XCrop="1" YCrop="36" Width="28" Height="34" XPivot="14" YPivot="34"/>
<Region Id="1" Name="2" XCrop="1" YCrop="1" Width="30" Height="33" XPivot="15" YPivot="33"/>
<Region Id="2" Name="3" XCrop="31" YCrop="36" Width="28" Height="34" XPivot="15" YPivot="34"/>
</Spritesheet>
</Spritesheets>
<Layers>
<Layer Id="0" Name="Main" SpritesheetId="0"/>
</Layers>
<Nulls/>
<Events/>
</Content>
<Animations DefaultAnimation="Main">
<Animation Name="Main" FrameNum="14" Loop="true">
<RootAnimation>
<Frame XPosition="0" YPosition="0" Delay="14" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
</RootAnimation>
<LayerAnimations>
<LayerAnimation LayerId="0" Visible="true">
<Frame RegionId="0" XPivot="14" YPivot="34" XCrop="1" YCrop="36" Width="28" Height="34" XPosition="2" YPosition="0" Delay="5" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
<Frame RegionId="1" XPivot="15" YPivot="33" XCrop="1" YCrop="1" Width="30" Height="33" XPosition="2" YPosition="0" Delay="2" Visible="true" XScale="110" YScale="90" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
<Frame RegionId="2" XPivot="15" YPivot="34" XCrop="31" YCrop="36" Width="28" Height="34" XPosition="2" YPosition="0" Delay="5" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
<Frame RegionId="1" XPivot="15" YPivot="33" XCrop="1" YCrop="1" Width="30" Height="33" XPosition="2" YPosition="0" Delay="2" Visible="true" XScale="110" YScale="90" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
</LayerAnimation>
</LayerAnimations>
<NullAnimations/>
<Triggers/>
</Animation>
</Animations>
</AnimatedActor>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

+49
View File
@@ -0,0 +1,49 @@
<AnimatedActor>
<Info CreatedBy="robot" CreatedOn="05/21/2026 11:07:19 PM" Fps="30" Version="0"/>
<Content>
<Spritesheets>
<Spritesheet Id="0" Path="meatboy.png">
<Region Id="0" Name="Head" XCrop="1" YCrop="1" Width="41" Height="33" Origin="Center"/>
<Region Id="1" Name="Arms" XCrop="1" YCrop="36" Width="24" Height="12" Origin="Center"/>
<Region Id="2" Name="Legs" XCrop="27" YCrop="36" Width="31" Height="9" Origin="Center"/>
</Spritesheet>
</Spritesheets>
<Layers>
<Layer Id="0" Name="Head" SpritesheetId="0"/>
<Layer Id="1" Name="Arms" SpritesheetId="0"/>
<Layer Id="2" Name="Legs" SpritesheetId="0"/>
</Layers>
<Nulls/>
<Events/>
</Content>
<Animations DefaultAnimation="Main">
<Animation Name="Main" FrameNum="14" Loop="true">
<RootAnimation>
<Frame XPosition="0" YPosition="0" Delay="14" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
</RootAnimation>
<LayerAnimations>
<LayerAnimation LayerId="2" Visible="true">
<Frame RegionId="2" XPivot="15" YPivot="4" XCrop="27" YCrop="36" Width="31" Height="9" XPosition="1" YPosition="-5" Delay="7" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="-1" Interpolated="EaseInOut"/>
<Frame RegionId="2" XPivot="15" YPivot="4" XCrop="27" YCrop="36" Width="31" Height="9" XPosition="1" YPosition="-5" Delay="6" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="1" Interpolated="EaseInOut"/>
<Frame RegionId="2" XPivot="15" YPivot="4" XCrop="27" YCrop="36" Width="31" Height="9" XPosition="1" YPosition="-5" Delay="1" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
</LayerAnimation>
<LayerAnimation LayerId="0" Visible="true">
<Frame RegionId="0" XPivot="20" YPivot="16" XCrop="1" YCrop="1" Width="41" Height="33" XPosition="2" YPosition="-23" Delay="7" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
<Frame RegionId="0" XPivot="20" YPivot="16" XCrop="1" YCrop="1" Width="41" Height="33" XPosition="0" YPosition="-23" Delay="6" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
<Frame RegionId="0" XPivot="20" YPivot="16" XCrop="1" YCrop="1" Width="41" Height="33" XPosition="2" YPosition="-23" Delay="1" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
</LayerAnimation>
<LayerAnimation LayerId="1" Visible="true">
<Frame RegionId="1" XPivot="12" YPivot="6" XCrop="1" YCrop="36" Width="24" Height="12" XPosition="-12" YPosition="-14" Delay="3" Visible="true" XScale="95" YScale="95" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="8" Interpolated="EaseInOut"/>
<Frame RegionId="1" XPivot="12" YPivot="6" XCrop="1" YCrop="36" Width="24" Height="12" XPosition="0" YPosition="-16" Delay="4" Visible="true" XScale="125" YScale="125" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
<Frame RegionId="1" XPivot="12" YPivot="6" XCrop="1" YCrop="36" Width="24" Height="12" XPosition="12" YPosition="-14" Delay="3" Visible="true" XScale="95" YScale="95" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="-8" Interpolated="EaseInOut"/>
<Frame RegionId="1" XPivot="12" YPivot="6" XCrop="1" YCrop="36" Width="24" Height="12" XPosition="0" YPosition="-16" Delay="3" Visible="true" XScale="125" YScale="125" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
<Frame RegionId="1" XPivot="12" YPivot="6" XCrop="1" YCrop="36" Width="24" Height="12" XPosition="-12" YPosition="-14" Delay="1" Visible="true" XScale="95" YScale="95" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="8" Interpolated="EaseInOut"/>
</LayerAnimation>
</LayerAnimations>
<NullAnimations/>
<Triggers/>
</Animation>
</Animations>
</AnimatedActor>
Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

+48
View File
@@ -0,0 +1,48 @@
<AnimatedActor>
<Info CreatedBy="robot" CreatedOn="05/21/2026 10:34:48 PM" Fps="30" Version="0"/>
<Content>
<Spritesheets>
<Spritesheet Id="0" Path="stacy.png">
<Region Id="0" Name="Head" XCrop="1" YCrop="1" Width="32" Height="32" Origin="Center"/>
<Region Id="1" Name="HeadAlt" XCrop="1" YCrop="35" Width="32" Height="32" Origin="Center"/>
<Region Id="2" Name="Body" XCrop="35" YCrop="1" Width="30" Height="18" Origin="Center"/>
<Region Id="3" Name="Tail" XCrop="35" YCrop="21" Width="13" Height="12" Origin="Center"/>
</Spritesheet>
</Spritesheets>
<Layers>
<Layer Id="0" Name="Head" SpritesheetId="0"/>
<Layer Id="1" Name="Body" SpritesheetId="0"/>
<Layer Id="2" Name="Tail" SpritesheetId="0"/>
</Layers>
<Nulls/>
<Events/>
</Content>
<Animations DefaultAnimation="Main">
<Animation Name="Main" FrameNum="9" Loop="true">
<RootAnimation>
<Frame XPosition="0" YPosition="0" Delay="9" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
</RootAnimation>
<LayerAnimations>
<LayerAnimation LayerId="2" Visible="true">
<Frame RegionId="3" XPivot="6" YPivot="6" XCrop="35" YCrop="21" Width="13" Height="12" XPosition="-12" YPosition="-10" Delay="4" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
<Frame RegionId="3" XPivot="6" YPivot="6" XCrop="35" YCrop="21" Width="13" Height="12" XPosition="-12" YPosition="-11" Delay="4" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="4" Interpolated="EaseInOut"/>
<Frame RegionId="3" XPivot="6" YPivot="6" XCrop="35" YCrop="21" Width="13" Height="12" XPosition="-12" YPosition="-10" Delay="1" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
</LayerAnimation>
<LayerAnimation LayerId="1" Visible="true">
<Frame RegionId="2" XPivot="15" YPivot="9" XCrop="35" YCrop="1" Width="30" Height="18" XPosition="0" YPosition="-7" Delay="4" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
<Frame RegionId="2" XPivot="15" YPivot="9" XCrop="35" YCrop="1" Width="30" Height="18" XPosition="0" YPosition="-8" Delay="4" Visible="true" XScale="95" YScale="105" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
<Frame RegionId="2" XPivot="15" YPivot="9" XCrop="35" YCrop="1" Width="30" Height="18" XPosition="0" YPosition="-7" Delay="1" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
</LayerAnimation>
<LayerAnimation LayerId="0" Visible="true">
<Frame RegionId="0" XPivot="16" YPivot="16" XCrop="1" YCrop="1" Width="32" Height="32" XPosition="-1" YPosition="-24" Delay="4" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
<Frame RegionId="1" XPivot="16" YPivot="16" XCrop="1" YCrop="35" Width="32" Height="32" XPosition="-1" YPosition="-26" Delay="4" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
<Frame RegionId="0" XPivot="16" YPivot="16" XCrop="1" YCrop="1" Width="32" Height="32" XPosition="-1" YPosition="-24" Delay="1" Visible="true" XScale="100" YScale="100" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="EaseInOut"/>
</LayerAnimation>
</LayerAnimations>
<NullAnimations/>
<Triggers/>
</Animation>
</Animations>
</AnimatedActor>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M5.99807 7L8.30747 3H11.9981L9.68867 7H5.99807ZM11.9981 7L14.3075 3H17.9981L15.6887 7H11.9981ZM17.9981 7L20.3075 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934C2 3.44476 2.45531 3 2.9918 3H5.99807L4 6.46076V19H20V7H17.9981Z"/></svg>

After

Width:  |  Height:  |  Size: 393 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M11.9997 10.5865L16.9495 5.63672L18.3637 7.05093L13.4139 12.0007L18.3637 16.9504L16.9495 18.3646L11.9997 13.4149L7.04996 18.3646L5.63574 16.9504L10.5855 12.0007L5.63574 7.05093L7.04996 5.63672L11.9997 10.5865Z"/></svg>

After

Width:  |  Height:  |  Size: 300 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M15.5355 2.80744C17.0976 1.24534 19.6303 1.24534 21.1924 2.80744C22.7545 4.36953 22.7545 6.90219 21.1924 8.46429L18.3638 11.2929L18.7175 11.6466C19.108 12.0371 19.108 12.6703 18.7175 13.0608C18.327 13.4513 17.6938 13.4513 17.3033 13.0608L16.9498 12.7073L10.7351 18.922C10.1767 19.4804 9.46547 19.861 8.6911 20.0159L6.93694 20.3667C6.54976 20.4442 6.19416 20.6345 5.91496 20.9137L4.92894 21.8997C4.53841 22.2902 3.90525 22.2902 3.51472 21.8997L2.10051 20.4855C1.70999 20.095 1.70999 19.4618 2.10051 19.0713L3.08653 18.0852C3.36574 17.806 3.55605 17.4504 3.63348 17.0633L3.98431 15.3091C4.13919 14.5347 4.51981 13.8235 5.07821 13.2651L11.2929 7.05045L10.9393 6.69686C10.5488 6.30634 10.5488 5.67317 10.9393 5.28265C11.3299 4.89212 11.963 4.89212 12.3535 5.28265L12.7069 5.63604L15.5355 2.80744ZM12.7071 8.46466L6.49242 14.6794C6.21322 14.9586 6.02291 15.3142 5.94548 15.7013L5.59464 17.4555C5.43977 18.2299 5.05915 18.9411 4.50075 19.4995C5.05915 18.9411 5.77035 18.5604 6.54471 18.4056L8.29887 18.0547C8.68605 17.9773 9.04165 17.787 9.32085 17.5078L15.5355 11.2931L12.7071 8.46466Z"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M15 17V19H6C5.44772 19 5 18.5523 5 18V7H2V5H5V2H7V17H15ZM17 22V7H9V5H18C18.5523 5 19 5.44772 19 6V17H22V19H19V22H17Z"/></svg>

After

Width:  |  Height:  |  Size: 207 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M12.8995 6.85453L17.1421 11.0972L7.24264 20.9967H3V16.754L12.8995 6.85453ZM14.3137 5.44032L16.435 3.319C16.8256 2.92848 17.4587 2.92848 17.8492 3.319L20.6777 6.14743C21.0682 6.53795 21.0682 7.17112 20.6777 7.56164L18.5563 9.68296L14.3137 5.44032Z"/></svg>

After

Width:  |  Height:  |  Size: 337 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M9 8L16 12L9 16V8Z" stroke="#FFF" stroke-width="2" stroke-linejoin="round"/> </svg>

After

Width:  |  Height:  |  Size: 166 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M6.5 8L11.5 12L6.5 16V8Z" stroke="#FFF" stroke-width="2" stroke-linejoin="round"/> <path d="M17.5 8L12.5 12L17.5 16V8Z" stroke="#FFF" stroke-width="2" stroke-linejoin="round"/> </svg>

After

Width:  |  Height:  |  Size: 266 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M15 8L8 12L15 16V8Z" stroke="#FFF" stroke-width="2" stroke-linejoin="round"/> </svg>

After

Width:  |  Height:  |  Size: 167 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M13.9999 18.9966H20.9999V20.9966H11.9999L8.00229 20.9991L1.51457 14.5113C1.12405 14.1208 1.12405 13.4877 1.51457 13.0971L12.1212 2.49053C12.5117 2.1 13.1449 2.1 13.5354 2.49053L21.3136 10.2687C21.7041 10.6592 21.7041 11.2924 21.3136 11.6829L13.9999 18.9966ZM15.6567 14.5113L19.1922 10.9758L12.8283 4.61185L9.29275 8.14738L15.6567 14.5113Z"/></svg>

After

Width:  |  Height:  |  Size: 429 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M13 10H20L11 23V14H4L13 1V10Z"/></svg>

After

Width:  |  Height:  |  Size: 120 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M21 9V20.9925C21 21.5511 20.5552 22 20.0066 22H3.9934C3.44495 22 3 21.556 3 21.0082V2.9918C3 2.45531 3.44694 2 3.99826 2H14V8C14 8.55228 14.4477 9 15 9H21ZM21 7H16V2.00318L21 7Z"/></svg>

After

Width:  |  Height:  |  Size: 268 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M3 3C2.44772 3 2 3.44772 2 4V7H9.58579L12 4.58579L10.4142 3H3ZM14.4142 5L10.4142 9H2V20C2 20.5523 2.44772 21 3 21H21C21.5523 21 22 20.5523 22 20V6C22 5.44772 21.5523 5 21 5H14.4142Z"/></svg>

After

Width:  |  Height:  |  Size: 272 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#FFF"><path d="M3 21C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3H10.4142L12.4142 5H20C20.5523 5 21 5.44772 21 6V9H4V18.996L6 11H22.5L20.1894 20.2425C20.0781 20.6877 19.6781 21 19.2192 21H3Z"></path></svg>

After

Width:  |  Height:  |  Size: 279 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M20.0833 15.1999L21.2854 15.9212C21.5221 16.0633 21.5989 16.3704 21.4569 16.6072C21.4146 16.6776 21.3557 16.7365 21.2854 16.7787L12.5144 22.0412C12.1977 22.2313 11.8021 22.2313 11.4854 22.0412L2.71451 16.7787C2.47772 16.6366 2.40093 16.3295 2.54301 16.0927C2.58523 16.0223 2.64413 15.9634 2.71451 15.9212L3.9166 15.1999L11.9999 20.0499L20.0833 15.1999ZM20.0833 10.4999L21.2854 11.2212C21.5221 11.3633 21.5989 11.6704 21.4569 11.9072C21.4146 11.9776 21.3557 12.0365 21.2854 12.0787L11.9999 17.6499L2.71451 12.0787C2.47772 11.9366 2.40093 11.6295 2.54301 11.3927C2.58523 11.3223 2.64413 11.2634 2.71451 11.2212L3.9166 10.4999L11.9999 15.3499L20.0833 10.4999ZM12.5144 1.30864L21.2854 6.5712C21.5221 6.71327 21.5989 7.0204 21.4569 7.25719C21.4146 7.32757 21.3557 7.38647 21.2854 7.42869L11.9999 12.9999L2.71451 7.42869C2.47772 7.28662 2.40093 6.97949 2.54301 6.7427C2.58523 6.67232 2.64413 6.61343 2.71451 6.5712L11.4854 1.30864C11.8021 1.11864 12.1977 1.11864 12.5144 1.30864ZM11.9999 3.33233L5.88723 6.99995L11.9999 10.6676L18.1126 6.99995L11.9999 3.33233Z"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <rect x="4" y="4" width="16" height="16" rx="0.5" stroke="#FFF" stroke-width="2" stroke-linejoin="round"/> <circle cx="12" cy="12" r="1" fill="#FFF" stroke="none"/> <path d="M2 2L22 22" stroke="#FFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> </svg>

After

Width:  |  Height:  |  Size: 346 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M21 4V6H20L15 13.5V22H9V13.5L4 6H3V4H21ZM6.4037 6L11 12.8944V20H13V12.8944L17.5963 6H6.4037Z"/></svg>

After

Width:  |  Height:  |  Size: 183 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="12" r="2.5"/> </svg>

After

Width:  |  Height:  |  Size: 114 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M4.52047 5.93457L1.39366 2.80777L2.80788 1.39355L22.6069 21.1925L21.1927 22.6068L17.8827 19.2968C16.1814 20.3755 14.1638 21.0002 12.0003 21.0002C6.60812 21.0002 2.12215 17.1204 1.18164 12.0002C1.61832 9.62282 2.81932 7.5129 4.52047 5.93457ZM14.7577 16.1718L13.2937 14.7078C12.902 14.8952 12.4634 15.0002 12.0003 15.0002C10.3434 15.0002 9.00026 13.657 9.00026 12.0002C9.00026 11.537 9.10522 11.0984 9.29263 10.7067L7.82866 9.24277C7.30514 10.0332 7.00026 10.9811 7.00026 12.0002C7.00026 14.7616 9.23884 17.0002 12.0003 17.0002C13.0193 17.0002 13.9672 16.6953 14.7577 16.1718ZM7.97446 3.76015C9.22127 3.26959 10.5793 3.00016 12.0003 3.00016C17.3924 3.00016 21.8784 6.87992 22.8189 12.0002C22.5067 13.6998 21.8038 15.2628 20.8068 16.5925L16.947 12.7327C16.9821 12.4936 17.0003 12.249 17.0003 12.0002C17.0003 9.23873 14.7617 7.00016 12.0003 7.00016C11.7514 7.00016 11.5068 7.01833 11.2677 7.05343L7.97446 3.76015Z"/></svg>

After

Width:  |  Height:  |  Size: 1000 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M20.0833 10.4999L21.2854 11.2212C21.5221 11.3633 21.5989 11.6704 21.4569 11.9072C21.4146 11.9776 21.3557 12.0365 21.2854 12.0787L11.9999 17.6499L2.71451 12.0787C2.47772 11.9366 2.40093 11.6295 2.54301 11.3927C2.58523 11.3223 2.64413 11.2634 2.71451 11.2212L3.9166 10.4999L11.9999 15.3499L20.0833 10.4999ZM20.0833 15.1999L21.2854 15.9212C21.5221 16.0633 21.5989 16.3704 21.4569 16.6072C21.4146 16.6776 21.3557 16.7365 21.2854 16.7787L12.5144 22.0412C12.1977 22.2313 11.8021 22.2313 11.4854 22.0412L2.71451 16.7787C2.47772 16.6366 2.40093 16.3295 2.54301 16.0927C2.58523 16.0223 2.64413 15.9634 2.71451 15.9212L3.9166 15.1999L11.9999 20.0499L20.0833 15.1999ZM12.5144 1.30864L21.2854 6.5712C21.5221 6.71327 21.5989 7.0204 21.4569 7.25719C21.4146 7.32757 21.3557 7.38647 21.2854 7.42869L11.9999 12.9999L2.71451 7.42869C2.47772 7.28662 2.40093 6.97949 2.54301 6.7427C2.58523 6.67232 2.64413 6.61343 2.71451 6.5712L11.4854 1.30864C11.8021 1.11864 12.1977 1.11864 12.5144 1.30864Z"/></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M18 11V8L22 12L18 16V13H13V18H16L12 22L8 18H11V13H6V16L2 12L6 8V11H11V6H8L12 2L16 6H13V11H18Z"/></svg>

After

Width:  |  Height:  |  Size: 184 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#FFF"><path d="M10.5859 12L2.79297 4.20706L4.20718 2.79285L12.0001 10.5857L19.793 2.79285L21.2072 4.20706L13.4143 12L21.2072 19.7928L19.793 21.2071L12.0001 13.4142L4.20718 21.2071L2.79297 19.7928L10.5859 12Z"></path></svg>

After

Width:  |  Height:  |  Size: 289 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M6 5C5.44772 5 5 5.44772 5 6C5 6.55228 5.44772 7 6 7C6.55228 7 7 6.55228 7 6C7 5.44772 6.55228 5 6 5ZM3 6C3 4.34315 4.34315 3 6 3C7.65685 3 9 4.34315 9 6C9 7.30622 8.16519 8.41746 7 8.82929V9C7 10.1046 7.89543 11 9 11H15C16.1046 11 17 10.1046 17 9V8.82929C15.8348 8.41746 15 7.30622 15 6C15 4.34315 16.3431 3 18 3C19.6569 3 21 4.34315 21 6C21 7.30622 20.1652 8.41746 19 8.82929V9C19 11.2091 17.2091 13 15 13H13V15.1707C14.1652 15.5825 15 16.6938 15 18C15 19.6569 13.6569 21 12 21C10.3431 21 9 19.6569 9 18C9 16.6938 9.83481 15.5825 11 15.1707V13H9C6.79086 13 5 11.2091 5 9V8.82929C3.83481 8.41746 3 7.30622 3 6ZM18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5ZM12 17C11.4477 17 11 17.4477 11 18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18C13 17.4477 12.5523 17 12 17Z"/></svg>

After

Width:  |  Height:  |  Size: 931 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#FFF"><path d="M11 3C11.5523 3 12 3.44772 12 4V6H17C17.5523 6 18 6.44772 18 7V12H20C20.5523 12 21 12.4477 21 13V20C21 20.5523 20.5523 21 20 21H13C12.4477 21 12 20.5523 12 20V18H7C6.44772 18 6 17.5523 6 17V12H4C3.44772 12 3 11.5523 3 11V4C3 3.44772 3.44772 3 4 3H11ZM16 8H8V16H16V8Z"></path></svg>

After

Width:  |  Height:  |  Size: 363 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M12 22L8 18H16L12 22ZM12 2L16 6H8L12 2ZM12 14C10.8954 14 10 13.1046 10 12C10 10.8954 10.8954 10 12 10C13.1046 10 14 10.8954 14 12C14 13.1046 13.1046 14 12 14ZM2 12L6 8V16L2 12ZM22 12L18 16V8L22 12Z"/></svg>

After

Width:  |  Height:  |  Size: 288 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M11 11V5H13V11H19V13H13V19H11V13H5V11H11Z"/></svg>

After

Width:  |  Height:  |  Size: 132 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 48" fill="#FFF" xmlns="http://www.w3.org/2000/svg"> <path d="M4 0H20V38L12 48L4 38V0Z"/> </svg>

After

Width:  |  Height:  |  Size: 117 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M4.99989 13.9999L4.99976 5.00003L6.99976 5L6.99986 11.9999L14.5859 12V6.58581L21.0001 13L14.5859 19.4142L14.5859 14L4.99989 13.9999Z"/></svg>

After

Width:  |  Height:  |  Size: 223 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M15.382 4H22V6H16.618L9 21.2361L5.38197 14H2V12H6.61803L9 16.7639L15.382 4Z"/></svg>

After

Width:  |  Height:  |  Size: 166 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M16 7H11C7.68629 7 5 9.68629 5 13C5 16.3137 7.68629 19 11 19H20V21H11C6.58172 21 3 17.4183 3 13C3 8.58172 6.58172 5 11 5H16V1L22 6L16 11V7Z"/></svg>

After

Width:  |  Height:  |  Size: 230 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M21 3H13.5L16.5429 6.04289L13.2929 9.29289L14.7071 10.7071L17.9571 7.45711L21 10.5V3ZM3 21H10.5L7.45711 17.9571L10.7071 14.7071L9.29289 13.2929L6.04289 16.5429L3 13.5V21Z"/></svg>

After

Width:  |  Height:  |  Size: 261 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#FFF"><path d="M14 4.4375C15.3462 4.4375 16.4375 3.34619 16.4375 2H17.5625C17.5625 3.34619 18.6538 4.4375 20 4.4375V5.5625C18.6538 5.5625 17.5625 6.65381 17.5625 8H16.4375C16.4375 6.65381 15.3462 5.5625 14 5.5625V4.4375ZM1 11C4.31371 11 7 8.31371 7 5H9C9 8.31371 11.6863 11 15 11V13C11.6863 13 9 15.6863 9 19H7C7 15.6863 4.31371 13 1 13V11ZM4.87601 12C6.18717 12.7276 7.27243 13.8128 8 15.124C8.72757 13.8128 9.81283 12.7276 11.124 12C9.81283 11.2724 8.72757 10.1872 8 8.87601C7.27243 10.1872 6.18717 11.2724 4.87601 12ZM17.25 14C17.25 15.7949 15.7949 17.25 14 17.25V18.75C15.7949 18.75 17.25 20.2051 17.25 22H18.75C18.75 20.2051 20.2051 18.75 22 18.75V17.25C20.2051 17.25 18.75 15.7949 18.75 14H17.25Z"></path></svg>

After

Width:  |  Height:  |  Size: 784 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M20.0833 10.4999L21.2854 11.2212C21.5221 11.3633 21.5989 11.6704 21.4569 11.9072C21.4146 11.9776 21.3557 12.0365 21.2854 12.0787L11.9999 17.6499L2.71451 12.0787C2.47772 11.9366 2.40093 11.6295 2.54301 11.3927C2.58523 11.3223 2.64413 11.2634 2.71451 11.2212L3.9166 10.4999L11.9999 15.3499L20.0833 10.4999ZM20.0833 15.1999L21.2854 15.9212C21.5221 16.0633 21.5989 16.3704 21.4569 16.6072C21.4146 16.6776 21.3557 16.7365 21.2854 16.7787L12.5144 22.0412C12.1977 22.2313 11.8021 22.2313 11.4854 22.0412L2.71451 16.7787C2.47772 16.6366 2.40093 16.3295 2.54301 16.0927C2.58523 16.0223 2.64413 15.9634 2.71451 15.9212L3.9166 15.1999L11.9999 20.0499L20.0833 15.1999ZM12.5144 1.30864L21.2854 6.5712C21.5221 6.71327 21.5989 7.0204 21.4569 7.25719C21.4146 7.32757 21.3557 7.38647 21.2854 7.42869L11.9999 12.9999L2.71451 7.42869C2.47772 7.28662 2.40093 6.97949 2.54301 6.7427C2.58523 6.67232 2.64413 6.61343 2.71451 6.5712L11.4854 1.30864C11.8021 1.11864 12.1977 1.11864 12.5144 1.30864Z"/></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <rect x="4" y="4" width="16" height="16" rx="0.5" stroke="#FFF" stroke-width="2" stroke-linejoin="round"/> <circle cx="12" cy="12" r="1" fill="#FFF" stroke="none"/> </svg>

After

Width:  |  Height:  |  Size: 245 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M6.92893 0.514648L21.0711 14.6568L19.6569 16.071L15.834 12.2486L15 13.4999V21.9999H9V13.4999L4 5.99993H3V3.99993L7.585 3.99965L5.51472 1.92886L6.92893 0.514648ZM9.585 5.99965L6.4037 5.99993L11 12.8944V19.9999H13V12.8944L14.392 10.8066L9.585 5.99965ZM21 3.99993V5.99993H20L18.085 8.87193L16.643 7.42893L17.5963 5.99993H15.213L13.213 3.99993H21Z"/></svg>

After

Width:  |  Height:  |  Size: 434 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="none" stroke="#FFF" stroke-width="2" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><path d="M8 5H20L16 19H4Z"/></svg>

After

Width:  |  Height:  |  Size: 162 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#FFF"><path d="M6.60282 10.0001L10 7.22056V16.7796L6.60282 14.0001H3V10.0001H6.60282ZM2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>

After

Width:  |  Height:  |  Size: 854 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M12 2C17.5222 2 22 5.97778 22 10.8889C22 13.9556 19.5111 16.4444 16.4444 16.4444H14.4778C13.5556 16.4444 12.8111 17.1889 12.8111 18.1111C12.8111 18.5333 12.9778 18.9222 13.2333 19.2111C13.5 19.5111 13.6667 19.9 13.6667 20.3333C13.6667 21.2556 12.9 22 12 22C6.47778 22 2 17.5222 2 12C2 6.47778 6.47778 2 12 2ZM10.8111 18.1111C10.8111 16.0843 12.451 14.4444 14.4778 14.4444H16.4444C18.4065 14.4444 20 12.851 20 10.8889C20 7.1392 16.4677 4 12 4C7.58235 4 4 7.58235 4 12C4 16.19 7.2226 19.6285 11.324 19.9718C10.9948 19.4168 10.8111 18.7761 10.8111 18.1111ZM7.5 12C6.67157 12 6 11.3284 6 10.5C6 9.67157 6.67157 9 7.5 9C8.32843 9 9 9.67157 9 10.5C9 11.3284 8.32843 12 7.5 12ZM16.5 12C15.6716 12 15 11.3284 15 10.5C15 9.67157 15.6716 9 16.5 9C17.3284 9 18 9.67157 18 10.5C18 11.3284 17.3284 12 16.5 12ZM12 9C11.1716 9 10.5 8.32843 10.5 7.5C10.5 6.67157 11.1716 6 12 6C12.8284 6 13.5 6.67157 13.5 7.5C13.5 8.32843 12.8284 9 12 9Z"/></svg>

After

Width:  |  Height:  |  Size: 1013 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="none" stroke="#FFF" stroke-width="0.75" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="12" r="2.8"/> <line x1="12" y1="5" x2="12" y2="19"/> <line x1="5" y1="12" x2="19" y2="12"/> </svg>

After

Width:  |  Height:  |  Size: 226 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="none" stroke="#FFF" stroke-width="0.75" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="12" r="2.8"/> <circle cx="12" cy="12" r="0.3" fill="#FFF" stroke="none"/> </svg>

After

Width:  |  Height:  |  Size: 208 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"> <path d="M11 5h2v10h-2V5Zm0 14h2v2h-2v-2Z"/> </svg>

After

Width:  |  Height:  |  Size: 125 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M3 3H12.382C12.7607 3 13.107 3.214 13.2764 3.55279L14 5H20C20.5523 5 21 5.44772 21 6V17C21 17.5523 20.5523 18 20 18H13.618C13.2393 18 12.893 17.786 12.7236 17.4472L12 16H5V22H3V3Z"/></svg>

After

Width:  |  Height:  |  Size: 270 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#FFF"><path d="M11 3C11.5523 3 12 3.44772 12 4V6H17C17.5523 6 18 6.44772 18 7V12H20C20.5523 12 21 12.4477 21 13V20C21 20.5523 20.5523 21 20 21H13C12.4477 21 12 20.5523 12 20V18H7C6.44772 18 6 17.5523 6 17V12H4C3.44772 12 3 11.5523 3 11V4C3 3.44772 3.44772 3 4 3H11ZM16 8H12V11C12 11.5523 11.5523 12 11 12H8V16H12V13C12 12.4477 12.4477 12 13 12H16V8Z"></path></svg>

After

Width:  |  Height:  |  Size: 431 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M19.0001 13.9999L19.0002 5.00003L17.0002 5L17.0001 11.9999L9.41406 12V6.58581L2.99986 13L9.41406 19.4142L9.41406 14L19.0001 13.9999Z"/></svg>

After

Width:  |  Height:  |  Size: 223 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"> <rect x="9.5" y="9.5" width="5" height="5"/> </svg>

After

Width:  |  Height:  |  Size: 125 B

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M1.18164 12C2.12215 6.87976 6.60812 3 12.0003 3C17.3924 3 21.8784 6.87976 22.8189 12C21.8784 17.1202 17.3924 21 12.0003 21C6.60812 21 2.12215 17.1202 1.18164 12ZM12.0003 17C14.7617 17 17.0003 14.7614 17.0003 12C17.0003 9.23858 14.7617 7 12.0003 7C9.23884 7 7.00026 9.23858 7.00026 12C7.00026 14.7614 9.23884 17 12.0003 17ZM12.0003 15C10.3434 15 9.00026 13.6569 9.00026 12C9.00026 10.3431 10.3434 9 12.0003 9C13.6571 9 15.0003 10.3431 15.0003 12C15.0003 13.6569 13.6571 15 12.0003 15Z"/></svg>

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.
-2014
View File
File diff suppressed because it is too large. Load diff
-352
View File
@@ -1,352 +0,0 @@
#pragma once
#include <cstdint>
#include <filesystem>
#include <optional>
#include <set>
#include <string>
#include <string_view>
#include <vector>
#include <glm/glm.hpp>
#include <tinyxml2/tinyxml2.h>
#include "icon.hpp"
#include "strings.hpp"
#include "types.hpp"
#define ANM2_ELEMENT_TYPES \
X(UNKNOWN, "") \
X(ANIMATED_ACTOR, "AnimatedActor") \
X(INFO, "Info") \
X(CONTENT, "Content") \
X(SPRITESHEETS, "Spritesheets") \
X(SPRITESHEET, "Spritesheet") \
X(REGION, "Region") \
X(LAYERS, "Layers") \
X(LAYER_ELEMENT, "Layer") \
X(NULLS, "Nulls") \
X(NULL_ELEMENT, "Null") \
X(EVENTS, "Events") \
X(EVENT_ELEMENT, "Event") \
X(SOUNDS, "Sounds") \
X(SOUND_ELEMENT, "Sound") \
X(ANIMATIONS, "Animations") \
X(ANIMATION, "Animation") \
X(ROOT_ANIMATION, "RootAnimation") \
X(LAYER_ANIMATIONS, "LayerAnimations") \
X(LAYER_ANIMATION, "LayerAnimation") \
X(NULL_ANIMATIONS, "NullAnimations") \
X(NULL_ANIMATION, "NullAnimation") \
X(GROUP, "Group") \
X(TRIGGERS, "Triggers") \
X(FRAME, "Frame") \
X(TRIGGER, "Trigger")
namespace anm2ed
{
enum class ElementType
{
#define X(symbol, tag) symbol,
ANM2_ELEMENT_TYPES
#undef X
COUNT
};
enum class Interpolation
{
NONE,
LINEAR,
EASE_IN,
EASE_OUT,
EASE_IN_OUT,
COUNT
};
enum class Origin
{
CUSTOM,
TOP_LEFT,
CENTER,
COUNT
};
enum class ItemType
{
NONE,
ROOT,
LAYER,
NULL_,
TRIGGER,
COUNT
};
inline constexpr int NONE = (int)ItemType::NONE;
inline constexpr int ROOT = (int)ItemType::ROOT;
inline constexpr int LAYER = (int)ItemType::LAYER;
inline constexpr int NULL_ = (int)ItemType::NULL_;
inline constexpr int TRIGGER = (int)ItemType::TRIGGER;
inline constexpr int FRAME_DURATION_MIN = 1;
inline constexpr int FRAME_DURATION_MAX = 1000000;
inline constexpr int FRAME_NUM_MIN = 1;
inline constexpr int FRAME_NUM_MAX = FRAME_DURATION_MAX;
inline constexpr int FPS_MIN = 1;
inline constexpr int FPS_MAX = 120;
enum class SpritesheetMergeOrigin
{
APPEND_RIGHT,
APPEND_BOTTOM,
COUNT
};
inline constexpr int APPEND_RIGHT = (int)SpritesheetMergeOrigin::APPEND_RIGHT;
inline constexpr int APPEND_BOTTOM = (int)SpritesheetMergeOrigin::APPEND_BOTTOM;
inline const glm::vec4 ROOT_COLOR = glm::vec4(0.140f, 0.310f, 0.560f, 1.000f);
inline const glm::vec4 ROOT_COLOR_ACTIVE = glm::vec4(0.240f, 0.520f, 0.880f, 1.000f);
inline const glm::vec4 ROOT_COLOR_HOVERED = glm::vec4(0.320f, 0.640f, 1.000f, 1.000f);
inline const glm::vec4 LAYER_COLOR = glm::vec4(0.640f, 0.320f, 0.110f, 1.000f);
inline const glm::vec4 LAYER_COLOR_ACTIVE = glm::vec4(0.840f, 0.450f, 0.170f, 1.000f);
inline const glm::vec4 LAYER_COLOR_HOVERED = glm::vec4(0.960f, 0.560f, 0.240f, 1.000f);
inline const glm::vec4 NULL_COLOR = glm::vec4(0.140f, 0.430f, 0.200f, 1.000f);
inline const glm::vec4 NULL_COLOR_ACTIVE = glm::vec4(0.250f, 0.650f, 0.350f, 1.000f);
inline const glm::vec4 NULL_COLOR_HOVERED = glm::vec4(0.350f, 0.800f, 0.480f, 1.000f);
inline const glm::vec4 TRIGGER_COLOR = glm::vec4(0.620f, 0.150f, 0.260f, 1.000f);
inline const glm::vec4 TRIGGER_COLOR_ACTIVE = glm::vec4(0.820f, 0.250f, 0.380f, 1.000f);
inline const glm::vec4 TRIGGER_COLOR_HOVERED = glm::vec4(0.950f, 0.330f, 0.490f, 1.000f);
#define ANM2_ITEM_TYPES \
X(NONE, STRING_UNDEFINED, "", resource::icon::NONE, glm::vec4(), glm::vec4(), glm::vec4()) \
X(ROOT, BASIC_ROOT, "RootAnimation", resource::icon::ROOT, ROOT_COLOR, ROOT_COLOR_ACTIVE, ROOT_COLOR_HOVERED) \
X(LAYER, BASIC_LAYER_ANIMATION, "LayerAnimation", resource::icon::LAYER, LAYER_COLOR, LAYER_COLOR_ACTIVE, \
LAYER_COLOR_HOVERED) \
X(NULL_, BASIC_NULL_ANIMATION, "NullAnimation", resource::icon::NULL_, NULL_COLOR, NULL_COLOR_ACTIVE, \
NULL_COLOR_HOVERED) \
X(TRIGGER, BASIC_TRIGGERS, "Triggers", resource::icon::TRIGGERS, TRIGGER_COLOR, TRIGGER_COLOR_ACTIVE, \
TRIGGER_COLOR_HOVERED)
constexpr StringType TYPE_STRINGS[] = {
#define X(symbol, string, itemString, icon, color, colorActive, colorHovered) string,
ANM2_ITEM_TYPES
#undef X
};
constexpr const char* TYPE_ITEM_STRINGS[] = {
#define X(symbol, string, itemString, icon, color, colorActive, colorHovered) itemString,
ANM2_ITEM_TYPES
#undef X
};
constexpr resource::icon::Type TYPE_ICONS[] = {
#define X(symbol, string, itemString, icon, color, colorActive, colorHovered) icon,
ANM2_ITEM_TYPES
#undef X
};
inline const glm::vec4 TYPE_COLOR[] = {
#define X(symbol, string, itemString, icon, color, colorActive, colorHovered) color,
ANM2_ITEM_TYPES
#undef X
};
inline const glm::vec4 TYPE_COLOR_ACTIVE[] = {
#define X(symbol, string, itemString, icon, color, colorActive, colorHovered) colorActive,
ANM2_ITEM_TYPES
#undef X
};
inline const glm::vec4 TYPE_COLOR_HOVERED[] = {
#define X(symbol, string, itemString, icon, color, colorActive, colorHovered) colorHovered,
ANM2_ITEM_TYPES
#undef X
};
enum class ChangeType
{
ADJUST,
ADD,
SUBTRACT,
MULTIPLY,
DIVIDE
};
enum Flag
{
SERIALIZE_GROUPS = 1 << 0,
SERIALIZE_REGIONS = 1 << 1,
SERIALIZE_SOUNDS = 1 << 2,
SERIALIZE_REDUNDANT_FRAME_REGION_VALUES = 1 << 3,
SERIALIZE_BAKE_SPECIAL_INTERPOLATED_FRAMES = 1 << 4
};
using Flags = int;
constexpr bool has_flag(Flags flags, Flag flag) { return (flags & flag) != 0; }
constexpr Flags SERIALIZE_EDITOR_DEFAULT =
SERIALIZE_GROUPS | SERIALIZE_REGIONS | SERIALIZE_SOUNDS | SERIALIZE_REDUNDANT_FRAME_REGION_VALUES;
constexpr Flags SERIALIZE_DEFAULT = SERIALIZE_EDITOR_DEFAULT | SERIALIZE_BAKE_SPECIAL_INTERPOLATED_FRAMES;
struct Options
{
Flags flags{SERIALIZE_DEFAULT};
};
struct FrameChange
{
std::optional<bool> isVisible{};
std::optional<Interpolation> interpolation{};
std::optional<float> rotation{};
std::optional<int> duration{};
std::optional<int> regionId{};
std::optional<float> pivotX{};
std::optional<float> pivotY{};
std::optional<float> cropX{};
std::optional<float> cropY{};
std::optional<float> positionX{};
std::optional<float> positionY{};
std::optional<float> sizeX{};
std::optional<float> sizeY{};
std::optional<float> scaleX{};
std::optional<float> scaleY{};
std::optional<float> colorOffsetR{};
std::optional<float> colorOffsetG{};
std::optional<float> colorOffsetB{};
std::optional<float> tintR{};
std::optional<float> tintG{};
std::optional<float> tintB{};
std::optional<float> tintA{};
std::optional<bool> isFlipX{};
std::optional<bool> isFlipY{};
};
struct Element
{
ElementType type{ElementType::UNKNOWN};
std::string tag{};
std::vector<Element> children{};
std::string name{};
std::string createdBy{"robot"};
std::string createdOn{};
std::filesystem::path path{};
std::string defaultAnimation{};
int id{-1};
int layerId{-1};
int nullId{-1};
int spritesheetId{};
int fps{30};
int version{};
int frameNum{1};
int duration{1};
int atFrame{-1};
int eventId{-1};
int regionId{-1};
int soundId{-1};
int groupId{-1};
bool isLoop{true};
bool isVisible{true};
bool isShowRect{};
bool isExpanded{true};
Interpolation interpolation{Interpolation::NONE};
Origin origin{Origin::CUSTOM};
float rotation{};
std::vector<int> soundIds{};
glm::vec2 pivot{};
glm::vec2 crop{};
glm::vec2 position{};
glm::vec2 size{};
glm::vec2 scale{100.0f, 100.0f};
glm::vec3 colorOffset{};
glm::vec4 tint{types::color::WHITE};
};
struct Reference
{
int animationIndex{-1};
int itemType{(int)ItemType::NONE};
int itemID{-1};
int frameIndex{-1};
auto operator<=>(const Reference&) const = default;
};
Element element_make(ElementType);
Element element_read(const tinyxml2::XMLElement*);
std::string element_to_string(const Element&, Flags = SERIALIZE_EDITOR_DEFAULT);
std::string element_to_string(const Element&, ElementType, Flags = SERIALIZE_EDITOR_DEFAULT);
tinyxml2::XMLElement* element_to_xml(tinyxml2::XMLDocument&, const Element&, Flags = SERIALIZE_EDITOR_DEFAULT);
tinyxml2::XMLElement* element_to_xml(tinyxml2::XMLDocument&, const Element&, ElementType,
Flags = SERIALIZE_EDITOR_DEFAULT);
Element* element_child_first_get(Element&, ElementType);
const Element* element_child_first_get(const Element&, ElementType);
Element* element_child_id_get(Element&, ElementType, int);
const Element* element_child_id_get(const Element&, ElementType, int);
int element_child_next_id_get(const Element&, ElementType);
int element_child_max_id_get(const Element&, ElementType);
bool element_child_id_erase(Element&, ElementType, int);
Element* element_first_get(Element&, ElementType);
const Element* element_first_get(const Element&, ElementType);
Element* animation_item_get(Element&, ItemType, int = -1);
const Element* animation_item_get(const Element&, ItemType, int = -1);
ElementType item_type_to_track_type_get(ItemType);
Element* track_frame_get(Element&, int);
const Element* track_frame_get(const Element&, int);
Element frame_generate(const Element&, float);
int frame_index_from_at_frame_get(const Element&, int);
int frame_index_from_time_get(const Element&, float);
float frame_time_from_index_get(const Element&, int);
void frame_bake(Element&, int, int, bool, bool);
void frames_generate_from_grid(Element&, glm::ivec2, glm::ivec2, glm::vec2, int, int, int);
bool frames_deserialize(Element&, const std::string&, int, std::set<int>&, std::string* = nullptr);
void frames_sort_by_at_frame(Element&);
void frames_change(Element&, FrameChange, ItemType, ChangeType, const std::set<int>&);
int track_length_get(const Element&);
int animation_length_get(const Element&);
class Anm2
{
public:
bool isValid{true};
Element root{};
Anm2();
Anm2(const std::filesystem::path&, std::string* = nullptr);
bool load(const std::filesystem::path&, std::string* = nullptr);
bool load_string(std::string_view, std::string* = nullptr);
bool save(const std::filesystem::path&, std::string* = nullptr, Options = {}) const;
std::string to_string(Options = {}) const;
tinyxml2::XMLElement* to_element(tinyxml2::XMLDocument&, Options = {}) const;
std::uint64_t hash(Options = {}) const;
bool is_special_interpolated_frames() const;
void special_interpolated_frames_bake(int, bool, bool);
void region_frames_sync(bool);
Anm2 normalized_for_serialize() const;
Element* element_get(ElementType);
const Element* element_get(ElementType) const;
Element* element_get(ElementType, int);
const Element* element_get(ElementType, int) const;
Element* element_get(int, ItemType, int = -1);
const Element* element_get(int, ItemType, int = -1) const;
Element* element_get(int, ItemType, int, int);
const Element* element_get(int, ItemType, int, int) const;
std::set<int> element_unused(ElementType) const;
std::set<int> element_unused(ElementType, const Element&) const;
std::set<int> element_unused(ElementType, int) const;
bool deserialize(ElementType, const std::string&, bool, std::string* = nullptr, const std::filesystem::path& = {});
bool regions_deserialize(int, const std::string&, bool, std::string* = nullptr);
Element frame_effective(int, const Element&) const;
glm::vec4 animation_rect(const Element&, bool) const;
int layer_animation_add(int, int = -1, int = -1, std::string = {}, int = 0,
types::destination::Type = types::destination::ALL);
int null_animation_add(int, int = -1, std::string = {}, bool = false,
types::destination::Type = types::destination::ALL);
bool animations_deserialize(const std::string&, int, std::set<int>&, std::string* = nullptr);
int animations_merge(int, std::set<int>&, types::merge::Type = types::merge::APPEND, bool = true);
};
}
+72
View File
@@ -0,0 +1,72 @@
#include "asset_store.h"
#include <bit>
#include <cstring>
#include <span>
constexpr std::uint64_t HASH_SEED = 14695981039346656037ull;
constexpr std::uint64_t HASH_SPREAD = 0x9E3779B97F4A7C15ull;
constexpr std::uint64_t HASH_MIX = 0x94D049BB133111EBull;
constexpr int HASH_ROTATION = 27;
// Hashes eight bytes a step (the tail one at a time), each mixed by a multiply and a rotation. Hashes stay within a
// session, so they only have to tell contents apart.
static std::uint64_t bytes_hash(std::span<const std::uint8_t> bytes, std::uint64_t hash = HASH_SEED)
{
auto step = [&](std::uint64_t word) {
hash = std::rotl(hash ^ (word * HASH_SPREAD), HASH_ROTATION) * HASH_MIX;
};
std::size_t i = 0;
for (; i + sizeof(std::uint64_t) <= bytes.size(); i += sizeof(std::uint64_t))
{
std::uint64_t word = 0;
std::memcpy(&word, bytes.data() + i, sizeof(word));
step(word);
}
for (; i < bytes.size(); ++i)
step(bytes[i]);
step(bytes.size());
return hash;
}
template <class Value> static std::span<const std::uint8_t> value_bytes_get(const Value& value)
{
return {reinterpret_cast<const std::uint8_t*>(&value), sizeof(value)};
}
// Content hash. 0 stays free to mean "no asset".
static std::uint64_t hash_finish(std::uint64_t hash)
{
return hash ? hash : 1;
}
std::uint64_t AssetStore::image_add(Image image)
{
auto hash = bytes_hash(value_bytes_get(image.size));
hash = bytes_hash(value_bytes_get(image.isLinear), hash);
hash = bytes_hash(image.pixels, hash);
if (image.svg)
hash = bytes_hash({(const std::uint8_t*)image.svg->data(), image.svg->size()}, hash);
hash = hash_finish(hash);
images.try_emplace(hash, std::move(image));
return hash;
}
std::uint64_t AssetStore::audio_add(AudioData data)
{
auto hash = hash_finish(bytes_hash(data.bytes));
audio.try_emplace(hash, std::move(data));
return hash;
}
const Image* AssetStore::image_get(std::uint64_t hash) const
{
auto it = images.find(hash);
return it == images.end() ? nullptr : &it->second;
}
const AudioData* AssetStore::audio_get(std::uint64_t hash) const
{
auto it = audio.find(hash);
return it == audio.end() ? nullptr : &it->second;
}
+21
View File
@@ -0,0 +1,21 @@
#pragma once
#include <cstdint>
#include <unordered_map>
#include "audio_data.h"
#include "image.h"
// Immutable images and sounds keyed by content hash. Undo history records keys, never pixels or bytes, and
// entries live until the document closes so any step can be restored.
class AssetStore
{
std::unordered_map<std::uint64_t, Image> images;
std::unordered_map<std::uint64_t, AudioData> audio;
public:
std::uint64_t image_add(Image);
std::uint64_t audio_add(AudioData);
const Image* image_get(std::uint64_t) const;
const AudioData* audio_get(std::uint64_t) const;
};
+232
View File
@@ -0,0 +1,232 @@
#include "audio.h"
#include <SDL3/SDL.h>
#include <algorithm>
#include <atomic>
#include <cmath>
#include <cstring>
#include <memory>
#include <unordered_map>
#define STB_VORBIS_HEADER_ONLY
#include <stb_vorbis.c>
constexpr SDL_AudioSpec AUDIO_SPEC = {SDL_AUDIO_F32, AUDIO_CHANNELS, AUDIO_FREQUENCY};
constexpr int FRAME_SIZE = AUDIO_CHANNELS * sizeof(float);
// One play of a sound. The audio thread feeds its stream from `position`, wrapping around when it loops.
struct AudioVoice
{
struct AudioSound* sound = nullptr;
SDL_AudioStream* stream = nullptr;
std::atomic<std::size_t> position = 0;
std::atomic<bool> isLoop = false;
};
// A decoded sound, its voices (one per overlapping play, reused once finished) and the loudness they played.
struct AudioSound
{
std::vector<float> samples;
std::vector<std::unique_ptr<AudioVoice>> voices;
std::atomic<float> squares[AUDIO_CHANNELS] = {};
std::atomic<int> frameCount = 0;
};
static std::unordered_map<std::uint64_t, AudioSound> sounds;
// Converts audio in `spec` to AUDIO_SPEC.
static std::vector<float> samples_convert(const SDL_AudioSpec& spec, const void* data, int size)
{
Uint8* converted = nullptr;
int convertedSize = 0;
if (!SDL_ConvertAudioSamples(&spec, (const Uint8*)data, size, &AUDIO_SPEC, &converted, &convertedSize))
return {};
std::vector<float> samples(convertedSize / sizeof(float));
std::memcpy(samples.data(), converted, samples.size() * sizeof(float));
SDL_free(converted);
return samples;
}
static std::vector<float> samples_decode(const AudioData& data)
{
if (data.bytes.size() >= 4 && std::memcmp(data.bytes.data(), "OggS", 4) == 0)
{
int channels = 0;
int frequency = 0;
short* decoded = nullptr;
auto frames =
stb_vorbis_decode_memory(data.bytes.data(), (int)data.bytes.size(), &channels, &frequency, &decoded);
if (frames <= 0)
return {};
auto samples =
samples_convert({SDL_AUDIO_S16, channels, frequency}, decoded, frames * channels * sizeof(short));
free(decoded);
return samples;
}
SDL_AudioSpec spec = {};
Uint8* decoded = nullptr;
Uint32 size = 0;
if (!SDL_LoadWAV_IO(SDL_IOFromConstMem(data.bytes.data(), data.bytes.size()), true, &spec, &decoded, &size))
return {};
auto samples = samples_convert(spec, decoded, (int)size);
SDL_free(decoded);
return samples;
}
static AudioSound* sound_get(const AudioData& data)
{
if (!data.is_valid())
return nullptr;
auto [it, isNew] = sounds.try_emplace(data.uid);
if (isNew)
it->second.samples = samples_decode(data);
return it->second.samples.empty() ? nullptr : &it->second;
}
// Opened on the first play. A failed open is tried again on the next, for a device that shows up later.
static SDL_AudioDeviceID device_get()
{
static SDL_AudioDeviceID device = 0;
if (!device && SDL_InitSubSystem(SDL_INIT_AUDIO))
device = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &AUDIO_SPEC);
return device;
}
// Runs on the audio thread: gives the stream what it asks for, and adds it to the sound's loudness.
static void SDLCALL voice_feed(void* userdata, SDL_AudioStream* stream, int amount, int)
{
auto voice = (AudioVoice*)userdata;
auto& samples = voice->sound->samples;
auto frames = (std::size_t)amount / FRAME_SIZE;
auto position = voice->position.load();
float squares[AUDIO_CHANNELS] = {};
std::size_t fed = 0;
while (fed < frames)
{
if (position * AUDIO_CHANNELS >= samples.size())
{
if (!voice->isLoop)
break;
position = 0;
}
auto count = std::min(frames - fed, samples.size() / AUDIO_CHANNELS - position);
auto start = samples.data() + position * AUDIO_CHANNELS;
for (std::size_t i = 0; i < count * AUDIO_CHANNELS; ++i)
squares[i % AUDIO_CHANNELS] += start[i] * start[i];
SDL_PutAudioStreamData(stream, start, (int)(count * FRAME_SIZE));
position += count;
fed += count;
}
voice->position = position;
for (int channel = 0; channel < AUDIO_CHANNELS; ++channel)
voice->sound->squares[channel] += squares[channel];
voice->sound->frameCount += (int)fed;
}
static bool is_voice_playing(AudioVoice& voice)
{
return voice.isLoop || voice.position * AUDIO_CHANNELS < voice.sound->samples.size() ||
SDL_GetAudioStreamQueued(voice.stream) > 0;
}
// A sound can play over itself: while a voice is still playing it, another voice takes the new play.
void audio_play(const AudioData& data, AudioPlayMode mode)
{
auto sound = sound_get(data);
if (!sound || !device_get())
return;
auto free = std::ranges::find_if(sound->voices, [](auto& voice) { return !is_voice_playing(*voice); });
AudioVoice* voice = nullptr;
if (free != sound->voices.end())
voice = free->get();
else
{
auto stream = SDL_CreateAudioStream(&AUDIO_SPEC, &AUDIO_SPEC);
if (!stream)
return;
voice = sound->voices.emplace_back(std::make_unique<AudioVoice>()).get();
voice->sound = sound;
voice->stream = stream;
SDL_SetAudioStreamGetCallback(voice->stream, voice_feed, voice);
SDL_BindAudioStream(device_get(), voice->stream);
}
SDL_LockAudioStream(voice->stream);
SDL_ClearAudioStream(voice->stream);
voice->position = 0;
voice->isLoop = mode == AUDIO_LOOP;
SDL_UnlockAudioStream(voice->stream);
}
void audio_stop(const AudioData& data)
{
auto it = sounds.find(data.uid);
if (it == sounds.end())
return;
for (auto& voice : it->second.voices)
{
SDL_LockAudioStream(voice->stream);
voice->isLoop = false;
voice->position = it->second.samples.size() / AUDIO_CHANNELS;
SDL_ClearAudioStream(voice->stream);
SDL_UnlockAudioStream(voice->stream);
}
}
void audio_prune(const std::set<std::uint64_t>& uids)
{
std::erase_if(sounds, [&](auto& entry) {
auto& [uid, sound] = entry;
if (uids.contains(uid) ||
std::ranges::any_of(sound.voices, [](auto& voice) { return is_voice_playing(*voice); }))
return false;
for (auto& voice : sound.voices)
SDL_DestroyAudioStream(voice->stream);
return true;
});
}
bool is_audio_playing(const AudioData& data)
{
auto it = sounds.find(data.uid);
return it != sounds.end() &&
std::ranges::any_of(it->second.voices, [](auto& voice) { return is_voice_playing(*voice); });
}
// The left/right loudness (RMS, 0-1) of what the sound played since the last call.
Vec2 audio_levels_get(const AudioData& data)
{
auto it = sounds.find(data.uid);
if (it == sounds.end())
return {};
auto& sound = it->second;
auto count = (float)std::max(sound.frameCount.exchange(0), 1);
return {std::sqrt(sound.squares[0].exchange(0.0f) / count), std::sqrt(sound.squares[1].exchange(0.0f) / count)};
}
std::vector<float> audio_mix(const std::vector<std::vector<const AudioData*>>& frameSounds, int fps)
{
std::vector<float> mix;
if (fps <= 0)
return mix;
auto framesPerStep = (double)AUDIO_FREQUENCY / fps;
for (std::size_t step = 0; step < frameSounds.size(); ++step)
{
auto start = (std::size_t)std::floor(step * framesPerStep) * AUDIO_CHANNELS;
mix.resize(std::max(mix.size(), (std::size_t)std::floor((step + 1) * framesPerStep) * AUDIO_CHANNELS));
for (auto data : frameSounds[step])
{
auto sound = sound_get(*data);
if (!sound)
continue;
mix.resize(std::max(mix.size(), start + sound->samples.size()));
for (std::size_t i = 0; i < sound->samples.size(); ++i)
mix[start + i] += sound->samples[i];
}
}
for (auto& sample : mix)
sample = std::clamp(sample, -1.0f, 1.0f);
return mix;
}
+29
View File
@@ -0,0 +1,29 @@
#pragma once
#include "vec.h"
#include <cstdint>
#include <set>
#include <vector>
#include "audio_data.h"
constexpr int AUDIO_CHANNELS = 2;
constexpr int AUDIO_FREQUENCY = 48000;
enum AudioPlayMode
{
AUDIO_ONCE,
AUDIO_LOOP
};
// Sounds (WAV or Ogg Vorbis) are decoded on their first play to AUDIO_FREQUENCY stereo floats, cached by uid.
// Each play is a stream on one shared device, opened on the first play, which mixes them.
void audio_play(const AudioData&, AudioPlayMode = AUDIO_ONCE);
void audio_stop(const AudioData&);
// Lets go of decoded sounds whose uids aren't in this set, once they stop playing.
void audio_prune(const std::set<std::uint64_t>&);
bool is_audio_playing(const AudioData&);
Vec2 audio_levels_get(const AudioData&);
// Each frame's sounds started on that frame and mixed at `fps`, as interleaved stereo floats.
std::vector<float> audio_mix(const std::vector<std::vector<const AudioData*>>&, int fps);
+26
View File
@@ -0,0 +1,26 @@
#include "audio_data.h"
#include <fstream>
#include <iterator>
#include "uid.h"
AudioData::AudioData(const unsigned char* memory, size_t size)
{
if (!memory || size == 0)
return;
bytes.assign(memory, memory + size);
uid = uid_next();
}
AudioData::AudioData(const std::filesystem::path& path)
{
std::ifstream file(path, std::ios::binary);
std::vector<unsigned char> data = {std::istreambuf_iterator<char>(file), {}};
*this = AudioData(data.data(), data.size());
}
bool AudioData::is_valid() const
{
return !bytes.empty();
}
+19
View File
@@ -0,0 +1,19 @@
#pragma once
#include <cstddef>
#include <cstdint>
#include <filesystem>
#include <vector>
// Encoded audio file bytes. uid identifies the bytes so playback state can be cached by it.
struct AudioData
{
std::vector<unsigned char> bytes;
std::uint64_t uid = 0;
AudioData() = default;
AudioData(const unsigned char*, size_t);
AudioData(const std::filesystem::path&);
bool is_valid() const;
};
+354 -212
View File
@@ -1,262 +1,404 @@
#include "canvas.hpp"
#include "canvas.h"
#include <algorithm>
#include <glm/ext/matrix_clip_space.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "vec.h"
#include "math.hpp"
#include "math_util.h"
#include "texture.h"
using namespace glm;
using namespace anm2ed::resource;
using namespace anm2ed::util;
namespace anm2ed
static void canvas_blend_premultiplied_set()
{
Canvas::Canvas() = default;
gl.Enable(GL_BLEND);
gl.BlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
}
Canvas::Canvas(vec2 size)
{
static void canvas_blend_straight_set()
{
gl.BlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
gl.Enable(GL_BLEND);
}
static void vertex_array_make(GLuint& vao, GLuint& vbo, const void* data, GLsizeiptr size, GLenum usage,
std::initializer_list<int> attributeSizes)
{
gl.GenVertexArrays(1, &vao);
gl.GenBuffers(1, &vbo);
gl.BindVertexArray(vao);
gl.BindBuffer(GL_ARRAY_BUFFER, vbo);
gl.BufferData(GL_ARRAY_BUFFER, size, data, usage);
auto stride = 0;
for (auto attributeSize : attributeSizes)
stride += attributeSize;
auto offset = 0;
auto index = 0;
for (auto attributeSize : attributeSizes)
{
gl.EnableVertexAttribArray(index);
gl.VertexAttribPointer(index++, attributeSize, GL_FLOAT, GL_FALSE, stride * sizeof(float),
(void*)(offset * sizeof(float)));
offset += attributeSize;
}
}
Canvas::Canvas() = default;
Canvas::Canvas(Vec2 size)
{
Framebuffer::size_set(size);
vertex_array_make(axisVAO, axisVBO, AXIS_VERTICES, sizeof(AXIS_VERTICES), GL_STATIC_DRAW, {2});
vertex_array_make(gridVAO, gridVBO, GRID_VERTICES, sizeof(GRID_VERTICES), GL_STATIC_DRAW, {2, 2});
vertex_array_make(rectVAO, rectVBO, RECT_VERTICES, sizeof(RECT_VERTICES), GL_STATIC_DRAW, {2});
vertex_array_make(textureVAO, textureVBO, nullptr, sizeof(TEXTURE_VERTICES), GL_DYNAMIC_DRAW, {2, 2});
gl.GenBuffers(1, &textureEBO);
gl.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, textureEBO);
gl.BufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(TEXTURE_INDICES), TEXTURE_INDICES, GL_DYNAMIC_DRAW);
gl.BindVertexArray(0);
}
// Axis
glGenVertexArrays(1, &axisVAO);
glGenBuffers(1, &axisVBO);
Canvas::~Canvas()
{
if (!Framebuffer::is_valid())
return;
for (auto vao : {axisVAO, gridVAO, rectVAO, textureVAO})
gl.DeleteVertexArrays(1, &vao);
for (auto buffer : {axisVBO, gridVBO, rectVBO, textureVBO, textureEBO})
gl.DeleteBuffers(1, &buffer);
}
glBindVertexArray(axisVAO);
Mat4 Canvas::transform_get(float zoom, Vec2 pan) const
{
auto zoomFactor = percent_to_unit(zoom);
auto projection = mat4_ortho(0.0f, (float)size.x, 0.0f, (float)size.y, -1.0f, 1.0f);
auto view = Mat4{1.0f};
glBindBuffer(GL_ARRAY_BUFFER, axisVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(AXIS_VERTICES), AXIS_VERTICES, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), (void*)0);
// Grid
glGenVertexArrays(1, &gridVAO);
glBindVertexArray(gridVAO);
glGenBuffers(1, &gridVBO);
glBindBuffer(GL_ARRAY_BUFFER, gridVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(GRID_VERTICES), GRID_VERTICES, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, (void*)0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, (void*)(sizeof(float) * 2));
glBindVertexArray(0);
// Rect
glGenVertexArrays(1, &rectVAO);
glGenBuffers(1, &rectVBO);
glBindVertexArray(rectVAO);
glBindBuffer(GL_ARRAY_BUFFER, rectVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(RECT_VERTICES), RECT_VERTICES, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), (void*)0);
// Texture
glGenVertexArrays(1, &textureVAO);
glGenBuffers(1, &textureVBO);
glGenBuffers(1, &textureEBO);
glBindVertexArray(textureVAO);
glBindBuffer(GL_ARRAY_BUFFER, textureVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 4 * 4, nullptr, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, textureEBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(TEXTURE_INDICES), TEXTURE_INDICES, GL_DYNAMIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float)));
glBindVertexArray(0);
}
Canvas::~Canvas()
{
if (!Framebuffer::is_valid()) return;
glDeleteVertexArrays(1, &axisVAO);
glDeleteBuffers(1, &axisVBO);
glDeleteVertexArrays(1, &gridVAO);
glDeleteBuffers(1, &gridVBO);
glDeleteVertexArrays(1, &rectVAO);
glDeleteBuffers(1, &rectVBO);
}
mat4 Canvas::transform_get(float zoom, vec2 pan) const
{
auto zoomFactor = math::percent_to_unit(zoom);
auto projection = glm::ortho(0.0f, (float)size.x, 0.0f, (float)size.y, -1.0f, 1.0f);
auto view = mat4{1.0f};
view = glm::translate(view, vec3((size * 0.5f) + pan, 0.0f));
view = glm::scale(view, vec3(zoomFactor, zoomFactor, 1.0f));
view = mat4_translate(view, Vec3((size * 0.5f) + pan, 0.0f));
view = mat4_scale(view, Vec3(zoomFactor, zoomFactor, 1.0f));
return projection * view;
}
}
void Canvas::axes_render(Shader& shader, float zoom, vec2 pan, vec4 color) const
{
auto originNDC = transform_get(zoom, pan) * vec4(0.0f, 0.0f, 0.0f, 1.0f);
void Canvas::axes_render(ShaderProgram& shader, float zoom, Vec2 pan, Vec4 color) const
{
canvas_blend_premultiplied_set();
auto originNDC = transform_get(zoom, pan) * Vec4(0.0f, 0.0f, 0.0f, 1.0f);
originNDC /= originNDC.w;
glUseProgram(shader.id);
gl.UseProgram(shader.id);
glUniform4fv(glGetUniformLocation(shader.id, shader::UNIFORM_COLOR), 1, value_ptr(color));
glUniform2f(glGetUniformLocation(shader.id, shader::UNIFORM_ORIGIN_NDC), originNDC.x, originNDC.y);
gl.Uniform4fv(gl.GetUniformLocation(shader.id, UNIFORM_COLOR), 1, values_get(color));
gl.Uniform2f(gl.GetUniformLocation(shader.id, UNIFORM_ORIGIN_NDC), originNDC.x, originNDC.y);
glBindVertexArray(axisVAO);
gl.BindVertexArray(axisVAO);
glUniform1i(glGetUniformLocation(shader.id, shader::UNIFORM_AXIS), 0);
glDrawArrays(GL_LINES, 0, 2);
gl.Uniform1i(gl.GetUniformLocation(shader.id, UNIFORM_AXIS), 0);
gl.DrawArrays(GL_LINES, 0, 2);
glUniform1i(glGetUniformLocation(shader.id, shader::UNIFORM_AXIS), 1);
glDrawArrays(GL_LINES, 0, 2);
gl.Uniform1i(gl.GetUniformLocation(shader.id, UNIFORM_AXIS), 1);
gl.DrawArrays(GL_LINES, 0, 2);
glBindVertexArray(0);
glUseProgram(0);
}
gl.BindVertexArray(0);
gl.UseProgram(0);
canvas_blend_straight_set();
}
void Canvas::grid_render(Shader& shader, float zoom, vec2 pan, ivec2 size, ivec2 offset, vec4 color) const
{
auto transform = glm::inverse(transform_get(zoom, pan));
void Canvas::grid_render(ShaderProgram& shader, float zoom, Vec2 pan, IVec2 size, IVec2 offset, Vec4 color) const
{
canvas_blend_premultiplied_set();
glUseProgram(shader.id);
auto transform = mat4_inverse(transform_get(zoom, pan));
glUniformMatrix4fv(glGetUniformLocation(shader.id, shader::UNIFORM_TRANSFORM), 1, GL_FALSE, value_ptr(transform));
glUniform2f(glGetUniformLocation(shader.id, shader::UNIFORM_SIZE), (float)size.x, (float)size.y);
glUniform2f(glGetUniformLocation(shader.id, shader::UNIFORM_OFFSET), (float)offset.x, (float)offset.y);
glUniform4f(glGetUniformLocation(shader.id, shader::UNIFORM_COLOR), color.r, color.g, color.b, color.a);
gl.UseProgram(shader.id);
glBindVertexArray(gridVAO);
glDrawArrays(GL_TRIANGLES, 0, 3);
glBindVertexArray(0);
gl.UniformMatrix4fv(gl.GetUniformLocation(shader.id, UNIFORM_TRANSFORM), 1, GL_FALSE, values_get(transform));
gl.Uniform2f(gl.GetUniformLocation(shader.id, UNIFORM_SIZE), (float)size.x, (float)size.y);
gl.Uniform2f(gl.GetUniformLocation(shader.id, UNIFORM_OFFSET), (float)offset.x, (float)offset.y);
gl.Uniform4f(gl.GetUniformLocation(shader.id, UNIFORM_COLOR), color.r, color.g, color.b, color.a);
glUseProgram(0);
}
gl.BindVertexArray(gridVAO);
gl.DrawArrays(GL_TRIANGLES, 0, 3);
gl.BindVertexArray(0);
void Canvas::texture_render(Shader& shader, GLuint& texture, mat4 transform, vec4 tint, vec3 colorOffset,
float* vertices) const
{
glUseProgram(shader.id);
gl.UseProgram(0);
canvas_blend_straight_set();
}
glUniform1i(glGetUniformLocation(shader.id, shader::UNIFORM_TEXTURE), 0);
glUniform3fv(glGetUniformLocation(shader.id, shader::UNIFORM_COLOR_OFFSET), 1, value_ptr(colorOffset));
glUniform4fv(glGetUniformLocation(shader.id, shader::UNIFORM_TINT), 1, value_ptr(tint));
glUniformMatrix4fv(glGetUniformLocation(shader.id, shader::UNIFORM_TRANSFORM), 1, GL_FALSE, value_ptr(transform));
static void texture_uniform_set(const ShaderUniform& uniform, Vec4 value)
{
if (uniform.valueType == UNIFORM_VALUE_INT || uniform.valueType == UNIFORM_VALUE_SAMPLER2D)
return gl.Uniform1i(uniform.location, uniform.intValue);
switch (UNIFORM_VALUE_TYPE_INFOS[uniform.valueType].componentCount)
{
case 2:
return gl.Uniform2fv(uniform.location, 1, values_get(value));
case 3:
return gl.Uniform3fv(uniform.location, 1, values_get(value));
case 4:
return gl.Uniform4fv(uniform.location, 1, values_get(value));
default:
if (uniform.valueType == UNIFORM_VALUE_FLOAT)
gl.Uniform1f(uniform.location, value.x);
}
}
glBindVertexArray(textureVAO);
static Vec4 texture_uniform_components_get(const ShaderUniform& uniform, float playbackTime)
{
Vec4 result{};
for (int i = 0; i < (int)uniform.components.size(); ++i)
result[i] =
uniform.components[i].binding == UNIFORM_BINDING_PLAYBACK_TIME ? playbackTime : uniform.components[i].value;
return result;
}
glBindBuffer(GL_ARRAY_BUFFER, textureVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(TEXTURE_VERTICES), vertices, GL_DYNAMIC_DRAW);
static void texture_uniforms_set(ShaderProgram& shader, Mat4 transform, Vec4 tint, Vec4 colorOffset, Vec2 textureSize,
float playbackTime)
{
if (shader.uniforms.empty())
{
gl.Uniform1i(gl.GetUniformLocation(shader.id, UNIFORM_TEXTURE), 0);
gl.Uniform4fv(gl.GetUniformLocation(shader.id, UNIFORM_COLOR_OFFSET), 1, values_get(colorOffset));
gl.Uniform4fv(gl.GetUniformLocation(shader.id, UNIFORM_TINT), 1, values_get(tint));
gl.UniformMatrix4fv(gl.GetUniformLocation(shader.id, UNIFORM_TRANSFORM), 1, GL_FALSE, values_get(transform));
return;
}
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture);
for (auto& uniform : shader.uniforms)
{
if (uniform.location == -1)
continue;
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
switch (uniform.binding)
{
case UNIFORM_BINDING_MAIN_TEXTURE:
gl.Uniform1i(uniform.location, 0);
break;
case UNIFORM_BINDING_TRANSFORM:
if (uniform.valueType == UNIFORM_VALUE_MAT4)
gl.UniformMatrix4fv(uniform.location, 1, GL_FALSE, values_get(transform));
break;
case UNIFORM_BINDING_FRAME_TINT:
texture_uniform_set(uniform, tint);
break;
case UNIFORM_BINDING_COLOR_OFFSET:
texture_uniform_set(uniform, colorOffset);
break;
case UNIFORM_BINDING_TEXTURE_SIZE:
texture_uniform_set(uniform, Vec4(textureSize, 0.0f, 0.0f));
break;
case UNIFORM_BINDING_PLAYBACK_TIME:
texture_uniform_set(uniform, Vec4(playbackTime));
break;
case UNIFORM_BINDING_COMPONENTS:
texture_uniform_set(uniform, texture_uniform_components_get(uniform, playbackTime));
break;
case UNIFORM_BINDING_MANUAL:
texture_uniform_set(uniform, uniform.value);
break;
default:
break;
}
}
}
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindTexture(GL_TEXTURE_2D, 0);
glUseProgram(0);
void Canvas::texture_render(ShaderProgram& shader, GLuint texture, const TextureDraw& draw) const
{
auto& [transform, tint, colorOffset, vertices, textureSize, playbackTime, blur] = draw;
canvas_blend_premultiplied_set();
glEnable(GL_BLEND);
}
gl.UseProgram(shader.id);
void Canvas::rect_render(Shader& shader, const mat4& transform, const mat4& model, vec4 color, float dashLength,
float dashGap, float dashOffset) const
{
glUseProgram(shader.id);
texture_uniforms_set(shader, transform, tint, colorOffset, textureSize, playbackTime);
// The editor's own texture shader blurs. A custom shader without these uniforms ignores them.
gl.Uniform1f(gl.GetUniformLocation(shader.id, UNIFORM_BLUR), blur.radius);
gl.Uniform4fv(gl.GetUniformLocation(shader.id, UNIFORM_REGION), 1, values_get(blur.region));
gl.Uniform2fv(gl.GetUniformLocation(shader.id, UNIFORM_TEXEL), 1,
values_get(textureSize.x > 0 && textureSize.y > 0 ? 1.0f / textureSize : Vec2()));
gl.VertexAttrib4fv(2, values_get(tint));
glUniformMatrix4fv(glGetUniformLocation(shader.id, shader::UNIFORM_TRANSFORM), 1, GL_FALSE, value_ptr(transform));
if (auto location = glGetUniformLocation(shader.id, shader::UNIFORM_MODEL); location != -1)
glUniformMatrix4fv(location, 1, GL_FALSE, value_ptr(model));
glUniform4fv(glGetUniformLocation(shader.id, shader::UNIFORM_COLOR), 1, value_ptr(color));
gl.BindVertexArray(textureVAO);
auto origin = model * vec4(0.0f, 0.0f, 0.0f, 1.0f);
auto edgeX = model * vec4(1.0f, 0.0f, 0.0f, 1.0f);
auto edgeY = model * vec4(0.0f, 1.0f, 0.0f, 1.0f);
gl.BindBuffer(GL_ARRAY_BUFFER, textureVBO);
gl.BufferData(GL_ARRAY_BUFFER, sizeof(TEXTURE_VERTICES), vertices ? vertices : TEXTURE_VERTICES, GL_DYNAMIC_DRAW);
auto axisX = vec2(edgeX - origin);
auto axisY = vec2(edgeY - origin);
gl.ActiveTexture(GL_TEXTURE0);
gl.BindTexture(GL_TEXTURE_2D, texture);
if (auto location = glGetUniformLocation(shader.id, shader::UNIFORM_AXIS_X); location != -1)
glUniform2fv(location, 1, value_ptr(axisX));
if (auto location = glGetUniformLocation(shader.id, shader::UNIFORM_AXIS_Y); location != -1)
glUniform2fv(location, 1, value_ptr(axisY));
gl.DrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
if (auto location = glGetUniformLocation(shader.id, shader::UNIFORM_DASH_LENGTH); location != -1)
glUniform1f(location, dashLength);
if (auto location = glGetUniformLocation(shader.id, shader::UNIFORM_DASH_GAP); location != -1)
glUniform1f(location, dashGap);
if (auto location = glGetUniformLocation(shader.id, shader::UNIFORM_DASH_OFFSET); location != -1)
glUniform1f(location, dashOffset);
gl.BindVertexArray(0);
gl.BindBuffer(GL_ARRAY_BUFFER, 0);
gl.BindTexture(GL_TEXTURE_2D, 0);
gl.UseProgram(0);
glBindVertexArray(rectVAO);
glDrawArrays(GL_LINE_LOOP, 0, 4);
canvas_blend_straight_set();
}
glBindVertexArray(0);
glUseProgram(0);
}
static void rect_begin(ShaderProgram& shader, const Mat4& transform, const Mat4& model, Vec4 color)
{
canvas_blend_premultiplied_set();
gl.UseProgram(shader.id);
gl.UniformMatrix4fv(gl.GetUniformLocation(shader.id, UNIFORM_TRANSFORM), 1, GL_FALSE, values_get(transform));
if (auto location = gl.GetUniformLocation(shader.id, UNIFORM_MODEL); location != -1)
gl.UniformMatrix4fv(location, 1, GL_FALSE, values_get(model));
gl.Uniform4fv(gl.GetUniformLocation(shader.id, UNIFORM_COLOR), 1, values_get(color));
}
void Canvas::rect_fill_render(Shader& shader, const mat4& transform, const mat4& model, vec4 color) const
{
glUseProgram(shader.id);
static void rect_end(GLuint vao, GLenum mode, int count = 4)
{
gl.BindVertexArray(vao);
gl.DrawArrays(mode, 0, count);
gl.BindVertexArray(0);
gl.UseProgram(0);
canvas_blend_straight_set();
}
glUniformMatrix4fv(glGetUniformLocation(shader.id, shader::UNIFORM_TRANSFORM), 1, GL_FALSE, value_ptr(transform));
if (auto location = glGetUniformLocation(shader.id, shader::UNIFORM_MODEL); location != -1)
glUniformMatrix4fv(location, 1, GL_FALSE, value_ptr(model));
glUniform4fv(glGetUniformLocation(shader.id, shader::UNIFORM_COLOR), 1, value_ptr(color));
void Canvas::dashed_render(ShaderProgram& shader, const Mat4& transform, const Mat4& model, Vec4 color, Dash dash,
DashedShape shape) const
{
rect_begin(shader, transform, model, color);
glBindVertexArray(rectVAO);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
auto origin = model * Vec4(0.0f, 0.0f, 0.0f, 1.0f);
for (auto [name, axis] : {std::pair{UNIFORM_AXIS_X, Vec4(1.0f, 0.0f, 0.0f, 1.0f)},
std::pair{UNIFORM_AXIS_Y, Vec4(0.0f, 1.0f, 0.0f, 1.0f)}})
if (auto location = gl.GetUniformLocation(shader.id, name); location != -1)
gl.Uniform2fv(location, 1, values_get(Vec2(model * axis - origin)));
for (auto [name, value] : {std::pair{UNIFORM_DASH_LENGTH, dash.length}, std::pair{UNIFORM_DASH_GAP, dash.gap},
std::pair{UNIFORM_DASH_OFFSET, dash.offset}})
if (auto location = gl.GetUniformLocation(shader.id, name); location != -1)
gl.Uniform1f(location, value);
glBindVertexArray(0);
glUseProgram(0);
}
if (shape == DASHED_RECT)
rect_end(rectVAO, GL_LINE_LOOP, RECT_VERTEX_COUNT);
else
rect_end(rectVAO, GL_LINES, LINE_VERTEX_COUNT);
}
void Canvas::zoom_set(float& zoom, vec2& pan, vec2 focus, float step) const
{
auto zoomFactor = math::percent_to_unit(zoom);
float newZoom = glm::clamp(math::round_nearest_multiple(zoom + step, step), ZOOM_MIN, ZOOM_MAX);
// A layer draw's crop of its spritesheet. A blurred one (Flash's BlurFilter: a box `blur` canvas pixels wide) grows by
// the box's reach, in texels at the draw's scale, and averages its crop over it.
void Canvas::layer_render(ShaderProgram& shader, GLuint texture, Vec2 textureSize, const Mat4& transform,
const Draw& draw, Vec4 tint, Vec4 colorOffset) const
{
auto blurred = draw;
auto& frame = blurred.frame;
TextureBlur blur = {.region = Vec4(frame.crop, frame.crop + frame.size) / Vec4(textureSize, textureSize)};
if (frame.blur > 0.0f && frame.size.x > 0.0f && frame.size.y > 0.0f)
{
auto matrix = draw.parent * draw_quad_model_get(draw);
auto canvasArea = std::abs(matrix[0][0] * matrix[1][1] - matrix[1][0] * matrix[0][1]);
auto canvasPerTexel = std::sqrt(canvasArea / (frame.size.x * frame.size.y));
blur.radius = canvasPerTexel > 0.0f ? std::round(frame.blur * 0.5f / canvasPerTexel) : 0.0f;
frame.crop -= blur.radius;
frame.size += blur.radius * 2.0f;
frame.pivot += blur.radius;
}
auto vertices = uv_vertices_get(frame.crop / textureSize, (frame.crop + frame.size) / textureSize);
texture_render(shader, texture,
{.transform = transform * blurred.parent * draw_quad_model_get(blurred),
.tint = tint,
.colorOffset = colorOffset,
.vertices = vertices.data(),
.textureSize = textureSize,
.time = draw.time,
.blur = blur});
}
// An animation's layers alone (no markers or helpers). Spritesheet images are looked up by draw, custom shaders by id.
void Canvas::layers_render(ShaderProgram& shader, const Model& model, const Animation& animation,
const DrawOptions& options, const Mat4& transform,
const std::function<const Image*(const Draw&)>& image_get,
const std::function<ShaderProgram*(int)>& shader_get) const
{
for (auto& draw : animation_draws_get(model, animation, options))
{
if (draw.type != DrawType::LAYER)
continue;
auto& frame = draw.frame;
auto image = image_get(draw);
if (!image || !image->is_valid() || frame.size == Vec2())
continue;
auto customShader = shader_get ? shader_get(frame.shaderId) : nullptr;
layer_render(customShader ? *customShader : shader, texture_id_get(*image), image->unit_size_get(), transform,
draw, frame.tint, frame.colorOffset);
}
}
void Canvas::rect_render(ShaderProgram& shader, const Mat4& transform, const Mat4& model, Vec4 color, Dash dash) const
{
dashed_render(shader, transform, model, color, dash, DASHED_RECT);
}
// A line from start to end: the bottom edge of a rectangle laid along it.
void Canvas::line_render(ShaderProgram& shader, const Mat4& transform, Vec2 start, Vec2 end, Vec4 color,
Dash dash) const
{
auto direction = end - start;
auto normal = vec_length(direction) > 0.0f ? vec_normalize(Vec2(-direction.y, direction.x)) : Vec2(0.0f, 1.0f);
auto model = Mat4(Vec4(direction, 0.0f, 0.0f), Vec4(normal, 0.0f, 0.0f), Vec4(0.0f, 0.0f, 1.0f, 0.0f),
Vec4(start, 0.0f, 1.0f));
dashed_render(shader, transform, model, color, dash, DASHED_LINE);
}
void Canvas::rect_fill_render(ShaderProgram& shader, const Mat4& transform, const Mat4& model, Vec4 color) const
{
rect_begin(shader, transform, model, color);
rect_end(rectVAO, GL_TRIANGLE_FAN);
}
float Canvas::zoom_level_get(float zoom, int levelDelta) const
{
if (levelDelta == 0)
return zoom;
if (zoom < ZOOM_LEVELS.front())
return ZOOM_LEVELS.front();
if (zoom > ZOOM_LEVELS.back())
return ZOOM_LEVELS.back();
auto levelCount = (int)ZOOM_LEVELS.size();
int levelIndex = 0;
if (levelDelta > 0)
{
auto it = std::upper_bound(ZOOM_LEVELS.begin(), ZOOM_LEVELS.end(), zoom);
levelIndex = (int)std::distance(ZOOM_LEVELS.begin(), it) + levelDelta - 1;
}
else
{
auto it = std::lower_bound(ZOOM_LEVELS.begin(), ZOOM_LEVELS.end(), zoom);
levelIndex = (int)std::distance(ZOOM_LEVELS.begin(), it) + levelDelta;
}
return ZOOM_LEVELS[std::clamp(levelIndex, 0, levelCount - 1)];
}
void Canvas::zoom_level_adjust(float& zoom, Vec2& pan, Vec2 focus, int levelDelta) const
{
auto zoomFactor = percent_to_unit(zoom);
float newZoom = zoom_level_get(zoom, levelDelta);
if (newZoom != zoom)
{
float newZoomFactor = math::percent_to_unit(newZoom);
pan += focus * (zoomFactor - newZoomFactor);
zoom = newZoom;
float newZoomFactor = percent_to_unit(newZoom);
pan += focus * (zoomFactor - newZoomFactor);
zoom = newZoom;
}
}
Vec2 Canvas::position_translate(float& zoom, Vec2& pan, Vec2 position) const
{
auto zoomFactor = percent_to_unit(zoom);
return (position - pan - (size * 0.5f)) / zoomFactor;
}
void Canvas::set_to_rect(float& zoom, Vec2& pan, Vec4 rect) const
{
if (rect != Vec4(-1.0f) && (rect.z > 0 && rect.w > 0))
{
float scaleX = size.x / rect.z;
float scaleY = size.y / rect.w;
float fitScale = std::min(scaleX, scaleY);
zoom = unit_to_percent(fitScale);
Vec2 rectCenter = {rect.x + rect.z * 0.5f, rect.y + rect.w * 0.5f};
pan = -rectCenter * fitScale;
}
}
vec2 Canvas::position_translate(float& zoom, vec2& pan, vec2 position) const
{
auto zoomFactor = math::percent_to_unit(zoom);
return (position - pan - (size * 0.5f)) / zoomFactor;
}
void Canvas::set_to_rect(float& zoom, vec2& pan, vec4 rect) const
{
if (rect != vec4(-1.0f) && (rect.z > 0 && rect.w > 0))
{
f32 scaleX = size.x / rect.z;
f32 scaleY = size.y / rect.w;
f32 fitScale = std::min(scaleX, scaleY);
zoom = math::unit_to_percent(fitScale);
vec2 rectCenter = {rect.x + rect.z * 0.5f, rect.y + rect.w * 0.5f};
pan = -rectCenter * fitScale;
}
}
}
+111
View File
@@ -0,0 +1,111 @@
#pragma once
#include <array>
#include <functional>
#include "gl.h"
#include "vec.h"
#include "framebuffer.h"
#include "image.h"
#include "model/draw.h"
#include "shader.h"
#include "types.h"
// A box blur `radius` texels wide each way over the texture's `region` (UV min, max). Outside it is clear.
struct TextureBlur
{
float radius = 0;
Vec4 region{};
};
constexpr float DASH_LENGTH = 4.0f;
constexpr float DASH_GAP = 1.0f;
constexpr float DASH_OFFSET = 1.0f;
// A dashed outline's pattern, in canvas pixels.
struct Dash
{
float length = DASH_LENGTH;
float gap = DASH_GAP;
float offset = DASH_OFFSET;
};
enum DashedShape
{
DASHED_RECT,
DASHED_LINE
};
// How a texture is drawn: placed by `transform`, colored, over `vertices` (the whole texture when null), with what a
// layer's shader reads (its texture size and playback time) and its blur.
struct TextureDraw
{
Mat4 transform = Mat4(1.0f);
Vec4 tint = Vec4(1.0f);
Vec4 colorOffset{};
const float* vertices = nullptr;
Vec2 textureSize{};
float time = 0;
TextureBlur blur = {};
};
class Canvas : public Framebuffer
{
public:
static constexpr float TEXTURE_VERTICES[] = {0, 0, 0.0f, 0.0f, 1, 0, 1.0f, 0.0f,
1, 1, 1.0f, 1.0f, 0, 1, 0.0f, 1.0f};
static constexpr auto PIVOT_SIZE = Vec2(8, 8);
static constexpr auto ZOOM_MIN = 1.0f;
static constexpr auto ZOOM_MAX = 2000.0f;
static constexpr auto STEP = 1.0f;
static constexpr auto STEP_FAST = 5.0f;
static constexpr auto ZOOM_LEVEL_STEP = 1;
static constexpr std::array ZOOM_LEVELS = {1.0f, 2.0f, 5.0f, 10.0f, 15.0f, 25.0f, 33.0f,
50.0f, 66.0f, 75.0f, 100.0f, 125.0f, 150.0f, 200.0f,
300.0f, 400.0f, 600.0f, 800.0f, 1200.0f, 2000.0f};
static constexpr auto GRID_SIZE_MIN = 1;
static constexpr auto GRID_SIZE_MAX = 10000;
static constexpr auto GRID_OFFSET_MIN = 0;
static constexpr auto GRID_OFFSET_MAX = 10000;
static constexpr auto CHECKER_SIZE = 32.0f;
static constexpr float AXIS_VERTICES[] = {-1.0f, 0.0f, 1.0f, 0.0f};
static constexpr float GRID_VERTICES[] = {-1.f, -1.f, 0.f, 0.f, 3.f, -1.f, 2.f, 0.f, -1.f, 3.f, 0.f, 2.f};
static constexpr float RECT_VERTICES[] = {0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f};
static constexpr int RECT_VERTEX_COUNT = 4;
static constexpr int LINE_VERTEX_COUNT = 2;
static constexpr GLuint TEXTURE_INDICES[] = {0, 1, 2, 2, 3, 0};
static constexpr Dash BORDER_DASH = {.length = 1.0f, .gap = 0.5f, .offset = 0.0f};
static constexpr auto PIVOT_COLOR = COLOR_PINK;
GLuint axisVAO = 0;
GLuint axisVBO = 0;
GLuint rectVAO = 0;
GLuint rectVBO = 0;
GLuint gridVAO = 0;
GLuint gridVBO = 0;
GLuint textureVAO = 0;
GLuint textureVBO = 0;
GLuint textureEBO = 0;
Canvas();
Canvas(Vec2);
~Canvas();
Mat4 transform_get(float = 100.0f, Vec2 = {}) const;
void axes_render(ShaderProgram&, float, Vec2, Vec4 = Vec4(1.0f)) const;
void grid_render(ShaderProgram&, float, Vec2, IVec2 = IVec2(32, 32), IVec2 = {}, Vec4 = Vec4(1.0f)) const;
void texture_render(ShaderProgram&, GLuint, const TextureDraw&) const;
void layer_render(ShaderProgram&, GLuint, Vec2, const Mat4&, const Draw&, Vec4, Vec4) const;
void rect_fill_render(ShaderProgram&, const Mat4&, const Mat4&, Vec4 = Vec4(1.0f)) const;
void layers_render(ShaderProgram&, const Model&, const Animation&, const DrawOptions&, const Mat4&,
const std::function<const Image*(const Draw&)>&,
const std::function<ShaderProgram*(int)>& = {}) const;
void dashed_render(ShaderProgram&, const Mat4&, const Mat4&, Vec4, Dash, DashedShape) const;
void rect_render(ShaderProgram&, const Mat4&, const Mat4&, Vec4 = Vec4(1.0f), Dash = {}) const;
void line_render(ShaderProgram&, const Mat4&, Vec2, Vec2, Vec4 = Vec4(1.0f), Dash = {}) const;
float zoom_level_get(float, int) const;
void zoom_level_adjust(float&, Vec2&, Vec2, int) const;
Vec2 position_translate(float&, Vec2&, Vec2) const;
void set_to_rect(float& zoom, Vec2& pan, Vec4 rect) const;
};
-68
View File
@@ -1,68 +0,0 @@
#pragma once
#include <glad/glad.h>
#include <glm/glm.hpp>
#include "framebuffer.hpp"
#include "shader.hpp"
#include "types.hpp"
namespace anm2ed
{
class Canvas : public Framebuffer
{
public:
static constexpr float TEXTURE_VERTICES[] = {0, 0, 0.0f, 0.0f, 1, 0, 1.0f, 0.0f,
1, 1, 1.0f, 1.0f, 0, 1, 0.0f, 1.0f};
static constexpr auto PIVOT_SIZE = glm::vec2(8, 8);
static constexpr auto ZOOM_MIN = 1.0f;
static constexpr auto ZOOM_MAX = 2000.0f;
static constexpr auto DASH_LENGTH = 4.0f;
static constexpr auto DASH_GAP = 1.0f;
static constexpr auto DASH_OFFSET = 1.0f;
static constexpr auto STEP = 1.0f;
static constexpr auto STEP_FAST = 5.0f;
static constexpr auto ZOOM_STEP_FAST_MULTIPLIER = 5.0f;
static constexpr auto GRID_SIZE_MIN = 1;
static constexpr auto GRID_SIZE_MAX = 10000;
static constexpr auto GRID_OFFSET_MIN = 0;
static constexpr auto GRID_OFFSET_MAX = 10000;
static constexpr auto CHECKER_SIZE = 32.0f;
static constexpr float AXIS_VERTICES[] = {-1.0f, 0.0f, 1.0f, 0.0f};
static constexpr float GRID_VERTICES[] = {-1.f, -1.f, 0.f, 0.f, 3.f, -1.f, 2.f, 0.f, -1.f, 3.f, 0.f, 2.f};
static constexpr float RECT_VERTICES[] = {0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f};
static constexpr GLuint TEXTURE_INDICES[] = {0, 1, 2, 2, 3, 0};
static constexpr auto BORDER_DASH_LENGTH = 1.0f;
static constexpr auto BORDER_DASH_GAP = 0.5f;
static constexpr auto BORDER_DASH_OFFSET = 0.0f;
static constexpr auto PIVOT_COLOR = types::color::PINK;
GLuint axisVAO{};
GLuint axisVBO{};
GLuint rectVAO{};
GLuint rectVBO{};
GLuint gridVAO{};
GLuint gridVBO{};
GLuint textureVAO{};
GLuint textureVBO{};
GLuint textureEBO{};
Canvas();
Canvas(glm::vec2);
~Canvas();
glm::mat4 transform_get(float = 100.0f, glm::vec2 = {}) const;
void axes_render(resource::Shader&, float, glm::vec2, glm::vec4 = glm::vec4(1.0f)) const;
void grid_render(resource::Shader&, float, glm::vec2, glm::ivec2 = glm::ivec2(32, 32), glm::ivec2 = {},
glm::vec4 = glm::vec4(1.0f)) const;
void texture_render(resource::Shader&, GLuint&, glm::mat4 = {1.0f}, glm::vec4 = glm::vec4(1.0f), glm::vec3 = {},
float* = (float*)TEXTURE_VERTICES) const;
void rect_fill_render(resource::Shader&, const glm::mat4&, const glm::mat4&,
glm::vec4 = glm::vec4(1.0f)) const;
void rect_render(resource::Shader&, const glm::mat4&, const glm::mat4&, glm::vec4 = glm::vec4(1.0f),
float dashLength = DASH_LENGTH, float dashGap = DASH_GAP, float dashOffset = DASH_OFFSET) const;
void zoom_set(float&, glm::vec2&, glm::vec2, float) const;
glm::vec2 position_translate(float&, glm::vec2&, glm::vec2) const;
void set_to_rect(float& zoom, glm::vec2& pan, glm::vec4 rect) const;
};
}
+351
View File
@@ -0,0 +1,351 @@
#include "cli.h"
#include <algorithm>
#include <charconv>
#include <cstdio>
#include <format>
#include <map>
#include <optional>
#include <print>
#include <string>
#include "canvas.h"
#include "document.h"
#include "image.h"
#include "model/xml.h"
#include "path.h"
#include "render.h"
#include "sdl.h"
#include "settings.h"
#include "working_directory.h"
constexpr const char* USAGE = R"(usage: anm2ed <command> <file.anm2> [options]
commands:
info animations, items, spritesheets and Isaac compatibility, as text
frame one frame as a PNG (--out, --time)
convert the document as --format, to --out (default: the file itself)
render the animation as --type:
sheet all frames in a grid PNG (default; --rows, --columns)
pngs one PNG per frame in the --out folder (--format, default "{}.png")
gif, webm, mp4, ogv through FFmpeg (--ffmpeg, default: the editor's setting)
options:
--format json|xml the document format for "convert" (default xml: the game's, with the editor's copy)
--animation NAME|INDEX which animation (default: the default animation)
--out PATH where to write
--time T frame time for "frame" (default 0)
--start N, --end N frame range for "render" (default: the whole animation)
--fps N frames per second to sample (default: the animation's)
--scale S output scale (default 1)
--background RRGGBB background color, or "transparent" (default)
--no-root-transform draw without the root's transform
)";
constexpr float SCALE_DEFAULT = 1.0f;
constexpr int HEX_BASE = 16;
constexpr int HEX_RGB_LENGTH = 6;
constexpr float CHANNEL_MAX = 255.0f;
struct Arguments
{
std::string command;
std::filesystem::path file;
std::map<std::string, std::string> options;
std::optional<std::string> get(const std::string& name) const
{
auto it = options.find(name);
return it == options.end() ? std::nullopt : std::optional(it->second);
}
template <class T> T number_get(const std::string& name, T value) const
{
if (auto text = get(name))
std::from_chars(text->data(), text->data() + text->size(), value);
return value;
}
bool is(const std::string& name) const
{
return options.contains(name);
}
};
// PNG sequences go into a folder. Everything else is a file.
static bool type_is_folder(const Arguments& arguments)
{
return arguments.command == "render" && arguments.get("type").value_or("") == "pngs";
}
static std::optional<Arguments> arguments_get(int argc, const char** argv)
{
if (argc < 3)
return {};
// Absolute, so a bare file name still has a folder for the paths in it.
Arguments arguments = {.command = argv[1], .file = std::filesystem::absolute(path_from_utf8(argv[2]))};
for (int i = 3; i < argc; ++i)
{
std::string name = argv[i];
if (!name.starts_with("--"))
return {};
name.erase(0, 2);
auto isFlag = i + 1 >= argc || std::string_view(argv[i + 1]).starts_with("--");
arguments.options[name] = isFlag ? std::string{} : std::string(argv[++i]);
}
return arguments;
}
// RRGGBB (opaque) or "transparent".
static Vec4 background_get(const Arguments& arguments)
{
auto text = arguments.get("background").value_or("transparent");
if (text.starts_with('#'))
text.erase(0, 1);
unsigned value = 0;
if (text.size() != HEX_RGB_LENGTH ||
std::from_chars(text.data(), text.data() + text.size(), value, HEX_BASE).ec != std::errc{})
return {};
return {(float)((value >> 16) & 0xFF) / CHANNEL_MAX, (float)((value >> 8) & 0xFF) / CHANNEL_MAX,
(float)(value & 0xFF) / CHANNEL_MAX, 1.0f};
}
// --ffmpeg, or else the FFmpeg the editor's Render Animation uses (or "ffmpeg" on the PATH).
static std::filesystem::path ffmpeg_path_get(const Arguments& arguments)
{
if (auto ffmpeg = arguments.get("ffmpeg"))
return path_from_utf8(*ffmpeg);
auto settingsPath = preferences_directory_get() / "settings.ini";
auto settingsFfmpeg =
is_path_exist(settingsPath) ? Settings(settingsPath).renderFFmpegPath : std::filesystem::path{};
return settingsFfmpeg.empty() ? std::filesystem::path("ffmpeg") : settingsFfmpeg;
}
// By index or name. The default animation otherwise.
static std::pair<int, const Animation*> animation_get(const Model& model, const Arguments& arguments)
{
auto animations = model.animations_get();
auto name = arguments.get("animation").value_or(model.animations.defaultAnimation);
int index = -1;
if (std::from_chars(name.data(), name.data() + name.size(), index).ec == std::errc{} && index >= 0 &&
index < (int)animations.size())
return animations[index];
for (auto [i, animation] : animations)
if (animation->name == name)
return {i, animation};
if (!arguments.is("animation") && !animations.empty())
return animations.front();
return {-1, nullptr};
}
static int info_print(const Arguments& arguments)
{
Model model = {};
std::string error;
if (!model_load(model, arguments.file, &error))
{
std::println(stderr, "could not load {}: {}", path_to_utf8(arguments.file), error);
return 1;
}
auto& content = model.content;
std::println("file: {}", path_to_utf8(arguments.file));
std::println("fps: {}, created by: {}", model.info.fps, model.info.createdBy);
std::println("animations (default: {}):", model.animations.defaultAnimation);
for (auto [index, animation] : model.animations_get())
{
int layers{}, nulls{};
items_each(animation->layers, [&](const Track&, auto*) { ++layers; });
items_each(animation->nulls, [&](const Track&, auto*) { ++nulls; });
std::println(" [{}] {}: {} frames{}, {} layer tracks, {} null tracks, {} triggers", index, animation->name,
animation->frameNum, animation->isLoop ? ", loops" : "", layers, nulls,
animation->triggers.frames.size());
}
WorkingDirectory workingDirectory(arguments.file.parent_path());
std::println("spritesheets:");
for (auto& spritesheet : content.spritesheets)
{
auto image = Image(path_case_insensitive_find(spritesheet.path));
auto status = image.is_valid() ? std::format("{}x{}", image.size.x, image.size.y) : std::string("missing");
std::println(" #{} {} ({}), {} regions", spritesheet.id, path_to_utf8(spritesheet.path), status,
spritesheet.regions.size());
}
for (auto& library : content.libraries)
std::println("library #{} {}", library.id, path_to_utf8(library.path));
for (auto& layer : content.layers)
if (layer.is_animation())
std::println("layer #{} {} (animation {}, library #{})", layer.id, layer.name, layer.animation,
layer.libraryId);
else
std::println("layer #{} {} (spritesheet #{})", layer.id, layer.name, layer.spritesheetId);
for (auto& null : content.nulls)
std::println("null #{} {}", null.id, null.name);
for (auto& event : content.events)
std::println("event #{} {}", event.id, event.name);
for (auto& sound : content.sounds)
std::println("sound #{} {}", sound.id, path_to_utf8(sound.path));
auto issues = isaac_issues_get(model);
std::println("isaac issues: {} eased frames, {} group transforms, {} skewed frames, {} shader frames, {} depth "
"frames, {} alpha offset frames, {} blurred frames, {} extra trigger events, {} trigger sounds, "
"{} animation layers, {} vector spritesheets",
issues.easedFrames, issues.groupTransforms, issues.skewFrames, issues.shaderFrames, issues.depthFrames,
issues.alphaOffsetFrames, issues.blurFrames, issues.extraEvents, issues.triggerSounds,
issues.animationLayers, issues.vectorSpritesheets);
return 0;
}
static int draw_run(const Arguments& arguments)
{
auto out = arguments.get("out");
if (!out)
{
std::println(stderr, "--out is required");
return 2;
}
HeadlessGL gl = {};
if (!gl.is_valid())
{
std::println(stderr, "could not create an OpenGL 3.3 context");
return 1;
}
std::string error;
Document document(arguments.file, DOCUMENT_OPEN, &error);
if (!document.is_valid())
{
std::println(stderr, "could not load {}: {}", path_to_utf8(arguments.file), error);
return 1;
}
auto [index, animation] = animation_get(document.model, arguments);
if (!animation)
{
std::println(stderr, "no such animation: {}", arguments.get("animation").value_or(""));
return 1;
}
auto& textureInfo = SHADERS[SHADER_TEXTURE];
ShaderProgram shader(textureInfo.vertex, textureInfo.fragment);
Canvas canvas(Vec2(1.0f));
auto isRootTransform = !arguments.is("no-root-transform");
FrameRender render{.canvas = canvas,
.shader = shader,
.document = document,
.animation = *animation,
.bounds = animation_bounds_get(document, *animation, isRootTransform),
.background = background_get(arguments),
.scale = arguments.number_get("scale", SCALE_DEFAULT),
.isRootTransform = isRootTransform};
auto outPath = path_from_utf8(*out);
std::error_code ec;
std::filesystem::create_directories(type_is_folder(arguments) ? outPath : outPath.parent_path(), ec);
if (arguments.command == "frame")
{
auto pixels = animation_frame_render(render, arguments.number_get("time", 0.0f));
pixels_unpremultiply(pixels);
if (!Image::write_pixels_png(outPath, IVec2(canvas.size), pixels.data()))
{
std::println(stderr, "could not write {}", *out);
return 1;
}
std::println("{}: \"{}\" at time {}, {}x{}", *out, animation->name, arguments.number_get("time", 0.0f),
(int)canvas.size.x, (int)canvas.size.y);
return 0;
}
auto typeName = arguments.get("type").value_or("sheet");
auto type = typeName == "sheet" ? RENDER_SPRITESHEET : RENDER_PNGS;
for (int i = 0; i < RENDER_COUNT; ++i)
if (RENDER_EXTENSIONS[i] == "." + typeName)
type = (RenderType)i;
if (typeName != "sheet" && typeName != "pngs" && type == RENDER_PNGS)
{
std::println(stderr, "unknown --type: {}", typeName);
return 2;
}
auto fps = std::max(document.model.info.fps, 1);
RecorderOptions options{.type = type,
.path = outPath,
.format = path_from_utf8(arguments.get("format").value_or("{}.png")),
.ffmpegPath = ffmpeg_path_get(arguments),
.start = arguments.number_get("start", 0),
.end = arguments.number_get("end", animation->frameNum - 1),
.animationFps = fps,
.fps = arguments.number_get("fps", fps),
.rows = arguments.number_get("rows", 0),
.columns = arguments.number_get("columns", 0)};
auto count = frame_count_get(options.start, options.end, options.animationFps, options.fps);
if (!animation_record(options, render))
{
std::println(stderr, "could not write {} (FFmpeg: {})", *out, path_to_utf8(options.ffmpegPath));
return 1;
}
std::print("{}: \"{}\", {} frames ({} to {} at {} fps), each {}x{}", *out, animation->name, count, options.start,
options.end, options.fps, (int)canvas.size.x, (int)canvas.size.y);
if (type == RENDER_SPRITESHEET)
{
auto layout = spritesheet_layout_get(options.rows, options.columns, count);
std::print(", {} rows x {} columns, left to right", layout.rows, layout.columns);
}
std::println("");
return 0;
}
// Saved as the editor saves it: XML (the game's copy, with the editor's embedded) or the editor's JSON.
static int convert_run(const Arguments& arguments)
{
auto format = arguments.get("format").value_or("xml");
if (format != "xml" && format != "json")
{
std::println(stderr, "--format must be json or xml");
return 2;
}
// The game's copy bakes what it can't draw with OpenGL (and the document's shaders compile only with it).
std::optional<HeadlessGL> gl;
if (format == "xml")
gl.emplace();
std::string error;
Document document(arguments.file, DOCUMENT_OPEN, &error);
auto fileUtf8 = path_to_utf8(arguments.file);
if (!document.is_valid())
{
std::println(stderr, "could not load {}: {}", fileUtf8, error);
return 1;
}
if (!error.empty())
std::println(stderr, "{}:\n{}", fileUtf8, error);
auto out = std::filesystem::absolute(arguments.get("out").transform(path_from_utf8).value_or(arguments.file));
Options options = {};
options.isJson = format == "json";
if (document.save(out, &error, options))
return 0;
std::println(stderr, "could not write {}: {}", path_to_utf8(out), error);
return 1;
}
constexpr std::string_view COMMANDS[] = {"info", "frame", "render", "convert"};
bool is_cli(int argc, const char** argv)
{
return argc >= 2 && std::ranges::contains(COMMANDS, std::string_view(argv[1])) && !is_path_exist(argv[1]);
}
int cli_run(int argc, const char** argv)
{
auto arguments = arguments_get(argc, argv);
if (!arguments)
{
std::print(stderr, "{}", USAGE);
return 2;
}
if (arguments->command == "info")
return info_print(*arguments);
if (arguments->command == "convert")
return convert_run(*arguments);
return draw_run(*arguments);
}
+7
View File
@@ -0,0 +1,7 @@
#pragma once
// The command-line mode: "anm2ed <info|frame|render> <file.anm2> [options]" looks at a file without the editor, as
// text or drawn (by the editor's OpenGL renderer, in a hidden window) to a PNG frame, a contact sheet, PNGs, a GIF or
// a video.
bool is_cli(int, const char**);
int cli_run(int, const char**);
+16 -10
View File
@@ -1,22 +1,28 @@
#include "clipboard.hpp"
#include "clipboard.h"
#include <SDL3/SDL_clipboard.h>
#include <SDL3/SDL_stdinc.h>
namespace anm2ed
Clipboard::Clipboard()
{
Clipboard::Clipboard() { set(""); }
set("");
}
std::string Clipboard::get()
{
std::string Clipboard::get()
{
auto text = SDL_GetClipboardText();
auto string = std::string(text);
SDL_free(text);
return string;
}
bool Clipboard::is_empty() { return get().empty(); }
void Clipboard::set(const std::string& string) { SDL_SetClipboardText(string.data()); }
}
bool Clipboard::is_empty()
{
return !SDL_HasClipboardText();
}
void Clipboard::set(const std::string& string)
{
SDL_SetClipboardText(string.c_str());
}
Loaded 100 of 525 files, more files were not shown because too many files have changed in this diff. Show more