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

+20 -13
View File
@@ -286,26 +286,33 @@ namespace anm2ed::edit
return remap[sourceId] = imported.id;
};
for (auto sound : source.content.sounds)
// Sounds and libraries are matched by path.
auto paths_merge = [&](auto& items, const auto& sourceItems, ElementType type)
{
auto sourceId = sound.id;
sound.path = path_remap(sound.path);
auto existing = isAppendAsNew ? content.sounds.end()
: std::ranges::find_if(content.sounds, [&](const Sound& other)
{ return other.path == sound.path; });
sound.id = existing != content.sounds.end() ? existing->id : item_next_id_get(content.sounds);
if (existing != content.sounds.end())
*existing = sound;
else
content.sounds.push_back(sound);
remaps[ElementType::SOUND_ELEMENT][sourceId] = sound.id;
}
for (auto item : sourceItems)
{
auto sourceId = item.id;
item.path = path_remap(item.path);
auto existing = isAppendAsNew
? items.end()
: std::ranges::find_if(items, [&](const auto& other) { return other.path == item.path; });
item.id = existing != items.end() ? existing->id : item_next_id_get(items);
if (existing != items.end())
*existing = item;
else
items.push_back(item);
remaps[type][sourceId] = item.id;
}
};
paths_merge(content.sounds, source.content.sounds, ElementType::SOUND_ELEMENT);
paths_merge(content.libraries, source.content.libraries, ElementType::LIBRARY);
for (auto layer : source.content.layers)
{
auto existing = isAppendAsNew ? nullptr : name_find(content.layers, layer.name);
auto sourceId = layer.id;
layer.spritesheetId = existing ? existing->spritesheetId : spritesheet_import(layer.spritesheetId);
layer.libraryId = id_remap(ElementType::LIBRARY, layer.libraryId);
remaps[ElementType::LAYER_ELEMENT][sourceId] = named_merge(content.layers, layer);
}
for (auto null : source.content.nulls)
+1
View File
@@ -81,6 +81,7 @@ namespace anm2ed::edit
DURATION,
SHADER,
DEPTH,
CHILD,
EVENT,
SOUNDS,
COUNT
+9 -1
View File
@@ -213,7 +213,8 @@ namespace anm2ed::edit
if (property == FrameProperty::EVENT || property == FrameProperty::SOUNDS) return false;
auto isLayerOnly = property == FrameProperty::PIVOT || property == FrameProperty::CROP ||
property == FrameProperty::SIZE || property == FrameProperty::REGION ||
property == FrameProperty::SHADER || property == FrameProperty::DEPTH;
property == FrameProperty::SHADER || property == FrameProperty::DEPTH ||
property == FrameProperty::CHILD;
return type == ItemType::LAYER || !isLayerOnly;
}
@@ -269,6 +270,13 @@ namespace anm2ed::edit
case FrameProperty::DEPTH:
target.depth = source.depth;
break;
case FrameProperty::CHILD:
target.childAnimation = source.childAnimation;
target.childMode = source.childMode;
target.childStart = source.childStart;
target.isChildStartRandom = source.isChildStartRandom;
target.isChildRestart = source.isChildRestart;
break;
case FrameProperty::EVENT:
target.eventId = source.eventId;
break;