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>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-08 16:51:48 -04:00
1 parent 6edf5f0e5b
commit d1a6d89d14
44 files changed
+873 -81

No files matched your search

+24
View File
@@ -55,6 +55,12 @@ namespace anm2ed::model
int regionId{-1};
int shaderId{-1};
int depth{}; // a layer frame draws this many layers above (or below) its place in the timeline; editor-only
// On an animation layer: the child animation (empty for the layer's own) and how it plays; editor-only.
std::string childAnimation{};
ChildMode childMode{ChildMode::LOOP};
int childStart{};
bool isChildStartRandom{};
bool isChildRestart{};
int atFrame{-1};
int eventId{-1};
std::vector<int> soundIds{};
@@ -193,11 +199,27 @@ namespace anm2ed::model
int id{-1};
std::string name{};
int spritesheetId{};
// An animation layer plays `animation` (from library `libraryId`, or this file at -1) instead of showing its
// spritesheet.
int libraryId{-1};
std::string animation{};
Extras extras{};
bool is_animation() const { return !animation.empty(); }
bool operator==(const Layer&) const = default;
};
// Another .anm2 whose animations this one's layers can play.
struct Library
{
std::uint64_t uid{util::uid_next()};
int id{-1};
std::filesystem::path path{};
Extras extras{};
bool operator==(const Library&) const = default;
};
struct Null
{
std::uint64_t uid{util::uid_next()};
@@ -248,6 +270,7 @@ namespace anm2ed::model
std::vector<Null> nulls{};
std::vector<Event> events{};
std::vector<Sound> sounds{};
std::vector<Library> libraries{};
std::vector<ElementType> layout{ElementType::SPRITESHEETS, ElementType::SHADERS, ElementType::LAYERS,
ElementType::NULLS, ElementType::EVENTS};
Extras extras{};
@@ -338,6 +361,7 @@ namespace anm2ed::model
int animations_count_get() const;
const Animation* animation_get(int) const;
const Animation* animation_named_get(std::string_view) const;
Animation* animation_edit(int);
int animation_group_id_get(int) const;
const AnimationGroup* animation_group_get(int) const;