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:
1 parent
6edf5f0e5b
commit
d1a6d89d14
44 files changed
+873
-81
No files matched your search
+13
-2
@@ -47,6 +47,13 @@ namespace anm2ed::model
|
||||
return const_cast<Animation*>(slot->get());
|
||||
}
|
||||
|
||||
const Animation* Model::animation_named_get(std::string_view name) const
|
||||
{
|
||||
for (auto [index, animation] : animations_get())
|
||||
if (animation->name == name) return animation;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<std::pair<int, const Animation*>> Model::animations_get() const
|
||||
{
|
||||
std::vector<std::pair<int, const Animation*>> result{};
|
||||
@@ -232,9 +239,9 @@ namespace anm2ed::model
|
||||
});
|
||||
};
|
||||
|
||||
if (type == ElementType::SPRITESHEET)
|
||||
if (type == ElementType::SPRITESHEET || type == ElementType::LIBRARY)
|
||||
for (const auto& layer : content.layers)
|
||||
used.insert(layer.spritesheetId);
|
||||
used.insert(type == ElementType::LIBRARY ? layer.libraryId : layer.spritesheetId);
|
||||
else if (only)
|
||||
used_insert(*only);
|
||||
else
|
||||
@@ -255,6 +262,8 @@ namespace anm2ed::model
|
||||
return unused_ids_get(content.events, used);
|
||||
case ElementType::SOUND_ELEMENT:
|
||||
return unused_ids_get(content.sounds, used);
|
||||
case ElementType::LIBRARY:
|
||||
return unused_ids_get(content.libraries, used);
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
@@ -356,6 +365,8 @@ namespace anm2ed::model
|
||||
repair(event.uid);
|
||||
for (auto& sound : content.sounds)
|
||||
repair(sound.uid);
|
||||
for (auto& library : content.libraries)
|
||||
repair(library.uid);
|
||||
}
|
||||
|
||||
int track_frames_count_get(const Track& track) { return (int)track.frames.size(); }
|
||||
|
||||
Reference in new issue
Block a user