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.
This commit is contained in:
shweet committed 2026-11-22 18:58:37 -05:00
1 parent 228a15b5b3
commit ada48aefdd
19 files changed
+78 -53

No files matched your search

+2 -2
View File
@@ -309,7 +309,7 @@ static void track_entries_merge(std::vector<TrackEntry>& destination, const std:
// Merges source animations into the target (frames appended, prepended, replacing or ignored), optionally deleting
// the sources. `ungroupIds` dissolves groups afterwards. Returns the merged animation's uid.
Uids animations_merge(Model& model, int target, std::set<int> sources, Merge type, bool isDeleteAfter,
Uids animations_merge(Model& model, int target, std::set<int> sources, Merge type, MergeSources sourcesAfter,
const std::set<int>& ungroupIds)
{
if (!model.animation_get(target))
@@ -346,7 +346,7 @@ Uids animations_merge(Model& model, int target, std::set<int> sources, Merge typ
}
auto targetUid = model.animation_get(target)->uid;
if (isDeleteAfter)
if (sourcesAfter == SOURCES_DELETED)
{
sources.erase(target);
animations_take(model, sources, {});
+12 -3
View File
@@ -111,7 +111,7 @@ Uids root_bake_into(Model&, const std::set<Reference>&, const std::set<Reference
void items_remove(Model&, int, const std::map<int, std::set<int>>&, const std::map<int, std::set<int>>&);
Uids items_group(Model&, int, int, const std::set<int>&, const std::string&);
void items_move(Model&, int, int, const std::set<int>&, const std::set<int>&, RowTarget, bool, bool);
void items_move(Model&, int, int, const std::set<int>&, const std::set<int>&, RowTarget, DropZone);
void animation_length_fit(Model&, int);
int item_add(Model&, ItemType, int, int, Layer, Null, int, Destination);
@@ -123,7 +123,7 @@ void animations_remove(Model&, const std::set<int>&, const std::set<int>&);
Uids animations_move(Model&, const std::set<int>&, const std::set<int>&, AnimationTarget);
void animations_group(Model&, const std::set<int>&, const std::string&);
Uids animations_paste(Model&, const std::string&, int, int, std::set<int>&, std::string*);
Uids animations_merge(Model&, int, std::set<int>, Merge, bool, const std::set<int>&);
Uids animations_merge(Model&, int, std::set<int>, Merge, MergeSources, const std::set<int>&);
std::string region_name_get(const std::string&, int);
void regions_generate(Model&, const std::set<int>&, const std::set<Reference>&, const std::string&, RegionFrameMapping);
@@ -134,7 +134,16 @@ Uids animation_grid_generate(Model&, const std::vector<Reference>&, const GridOp
Uids frames_change_apply(Model&, const ChangeTargets&, FrameChange, ChangeType);
bool regions_trim(Model&, int, const std::set<int>&, const Image&);
std::optional<Image> spritesheet_pack(Model&, int, const Image&, int);
std::optional<Image> spritesheets_merge(Model&, const std::set<int>&, const ImageGet&, bool, bool, bool, Origin);
// How spritesheets merge: side by side or stacked, and the regions made for each sheet.
struct SpritesheetMergeOptions
{
bool isAppendRight = false;
bool isMakeRegions = false;
bool isMakePrimaryRegion = false;
Origin origin = Origin::CUSTOM;
};
std::optional<Image> spritesheets_merge(Model&, const std::set<int>&, const ImageGet&, SpritesheetMergeOptions);
// Where a spritesheet path of a document (this one, or a library) points, from this document.
using SpritesheetPathGet = std::function<std::filesystem::path(const Model&, const std::filesystem::path&)>;
+2 -1
View File
@@ -110,8 +110,9 @@ std::optional<Image> spritesheet_pack(Model& model, int id, const Image& sheet,
// Appends sheets to the first, right or below. The result is an SVG (holding any PNG sheets as images) when any of
// them is one. The first sheet's path takes the result's extension.
std::optional<Image> spritesheets_merge(Model& model, const std::set<int>& ids, const ImageGet& image_get,
bool isAppendRight, bool isMakeRegions, bool isMakePrimaryRegion, Origin origin)
SpritesheetMergeOptions options)
{
auto [isAppendRight, isMakeRegions, isMakePrimaryRegion, origin] = options;
if (ids.size() < 2)
return {};
for (auto id : ids)
+3 -1
View File
@@ -36,8 +36,10 @@ Uids items_group(Model& model, int animationIndex, int type, const std::set<int>
// Moves tracks and whole groups next to (or into) a target row. Layers are listed bottom-up, so for them "after" on
// screen is "before" in the file.
void items_move(Model& model, int animationIndex, int type, const std::set<int>& ids, const std::set<int>& groupIds,
RowTarget target, bool isDropAfter, bool isDropIntoGroup)
RowTarget target, DropZone zone)
{
auto isDropAfter = zone != DROP_BEFORE;
auto isDropIntoGroup = zone == DROP_INSIDE;
if ((target.groupId != -1 && groupIds.contains(target.groupId)) || (target.isGroup && groupIds.contains(target.id)))
return;
auto entries = track_entries_edit(model, animationIndex, type);