From 544ab3cac9de9131571a287173c132b5d1595b85 Mon Sep 17 00:00:00 2001 From: shweet Date: Sun, 22 Nov 2026 18:39:08 -0500 Subject: [PATCH] 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. --- src/document.cpp | 2 +- src/edit/animations.cpp | 8 +++----- src/edit/content.cpp | 17 ++++++--------- src/edit/edit.h | 28 ++++++++++++------------- src/edit/frames.cpp | 14 +++++-------- src/edit/tracks.cpp | 15 ++++++-------- src/model/model.cpp | 32 ++++++----------------------- src/model/model.h | 15 ++------------ src/playback.cpp | 9 -------- src/playback.h | 4 ---- src/types.h | 1 - src/ui/animation_preview.cpp | 2 -- src/ui/animations.cpp | 6 ++---- src/ui/timeline_menus.cpp | 1 - src/ui/timeline_tracks.cpp | 2 +- tests/operations.cpp | 40 +++++++++++++++++++++++++++++------- 16 files changed, 79 insertions(+), 117 deletions(-) diff --git a/src/document.cpp b/src/document.cpp index d8cc97a..ee706ed 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -1052,7 +1052,7 @@ bool Document::frames_range_select(Reference firstReference, Reference lastRefer return false; auto item = model.track_get(lastReference); - if (!item || std::max(firstReference.frameIndex, lastReference.frameIndex) >= track_frames_count_get(*item)) + if (!item || std::max(firstReference.frameIndex, lastReference.frameIndex) >= (int)item->frames.size()) return false; auto [firstIndex, lastIndex] = std::minmax(firstReference.frameIndex, lastReference.frameIndex); diff --git a/src/edit/animations.cpp b/src/edit/animations.cpp index 69627ed..4da3068 100644 --- a/src/edit/animations.cpp +++ b/src/edit/animations.cpp @@ -114,11 +114,10 @@ Uids animation_add(Model& model, int index, int groupId, int templateIndex, cons return {uid}; } -Uids animations_remove(Model& model, const std::set& indices, const std::set& groupIds) +void animations_remove(Model& model, const std::set& indices, const std::set& groupIds) { animations_take(model, indices, {}); animation_groups_remove(model, groupIds); - return {}; } // Moves animations and whole groups beside a target animation or group. Animations dropped on their own join the @@ -176,17 +175,16 @@ Uids animations_move(Model& model, const std::set& indices, const std::set< } // Gathers animations into a new group placed where the first of them was. -Uids animations_group(Model& model, const std::set& indices, const std::string& name) +void animations_group(Model& model, const std::set& indices, const std::string& name) { auto first = indices.empty() ? nullptr : model.animation_get(*indices.begin()); if (!first) - return {}; + return; auto& entries = model.animations.entries; auto entry = animation_place_get(model, first->uid).entry; AnimationGroup group = { .id = group_next_id(entries), .name = name, .items = animations_take(model, indices, {}).items}; entries.insert(entries.begin() + std::clamp(entry, 0, (int)entries.size()), std::move(group)); - return {}; } // Pastes clipboard animations (and groups, which get new ids) before the animation at `start`. Lone animations join diff --git a/src/edit/content.cpp b/src/edit/content.cpp index 870abea..112e686 100644 --- a/src/edit/content.cpp +++ b/src/edit/content.cpp @@ -39,7 +39,7 @@ template static void layer_frames_each(Model& model, int animat } // Makes a region for each distinct crop/size/pivot among the frames (and points frames at them when mapping is SET). -Uids regions_generate(Model& model, const std::set& animationIndices, const std::set& frames, +void regions_generate(Model& model, const std::set& animationIndices, const std::set& frames, const std::string& format, RegionFrameMapping mapping) { std::unordered_map regionNumbers; @@ -66,11 +66,10 @@ Uids regions_generate(Model& model, const std::set& animationIndices, const if (spritesheet && source && source->regionId == -1) frame_apply(*model.frame_edit(reference), spritesheet->id); } - return {}; } // Points frames without a region at a region of their spritesheet with the same crop/size/pivot. -Uids regions_scan(Model& model) +void regions_scan(Model& model) { for (int i = 0; i < model.animations_count_get(); ++i) layer_frames_each(model, i, [&](Frame& frame, int spritesheetId) { @@ -79,17 +78,15 @@ Uids regions_scan(Model& model) if (auto match = region_matched_get(item_get(model.content.spritesheets, spritesheetId)->regions, frame)) frame.regionId = match->id; }); - return {}; } // Copies each layer frame's region crop/size/pivot onto it. Frames pointing at a missing region lose it. -Uids region_frames_sync(Model& model) +void region_frames_sync(Model& model) { for (int i = 0; i < model.animations_count_get(); ++i) layer_frames_each(model, i, [&](Frame& frame, int spritesheetId) { frame_region_apply(frame, item_get(model.content.spritesheets, spritesheetId)->regions); }); - return {}; } // Clears frame references to the spritesheet's unused regions, then removes them. @@ -97,7 +94,7 @@ Uids region_frames_sync(Model& model) // in every animation, an event or sound from its triggers (dropping those left with neither), a shader from its // frames (which go back to the default), a region from its frames (which keep its crop, size and pivot), a // spritesheet's plain layers, and a library's layers, flattened into plain ones. -Uids content_remove(Model& model, ElementType type, const std::set& ids, int spritesheetId, +void content_remove(Model& model, ElementType type, const std::set& ids, int spritesheetId, const LibraryGet& library_get, const SpritesheetPathGet& path_get) { auto& content = model.content; @@ -186,21 +183,19 @@ Uids content_remove(Model& model, ElementType type, const std::set& ids, in default: break; } - return {}; } // Pastes regions into a spritesheet at a position. They get fresh ids after the existing ones. -Uids regions_paste(Model& model, int spritesheetId, const std::string& text, int insertIndex, std::string* errorString) +void regions_paste(Model& model, int spritesheetId, const std::string& text, int insertIndex, std::string* errorString) { auto spritesheet = item_get(model.content.spritesheets, spritesheetId); if (!spritesheet) - return {}; + return; auto regions = items_from_string(text, errorString); for (auto& region : regions) region.id = item_next_id_get(spritesheet->regions) + (int)(®ion - regions.data()); insertIndex = std::clamp(insertIndex, 0, (int)spritesheet->regions.size()); spritesheet->regions.insert(spritesheet->regions.begin() + insertIndex, regions.begin(), regions.end()); - return {}; } // Appends grid frames to each layer track (optionally making a region per frame) and fits the animation length. diff --git a/src/edit/edit.h b/src/edit/edit.h index 9258d21..c5c871c 100644 --- a/src/edit/edit.h +++ b/src/edit/edit.h @@ -94,39 +94,39 @@ Uids frames_property_set(Model&, const std::set&, FrameProperty, cons std::map> frames_by_track_get(const std::set&); Uids frame_insert(Model&, Reference, int); -Uids frames_delete(Model&, const std::set&); +void frames_delete(Model&, const std::set&); Uids frames_duplicate(Model&, const std::set&, Reference); -Uids frames_reverse(Model&, const std::set&); +void frames_reverse(Model&, const std::set&); Uids frames_bake(Model&, const std::set&, int, bool, bool); Uids frame_split(Model&, Reference, int); Uids frames_split(Model&, const std::set&, int); Uids frames_move(Model&, const std::set&, Reference, int); -Uids frame_durations_set(Model&, const std::map&); -Uids trigger_at_frame_set(Model&, Reference, int); +void frame_durations_set(Model&, const std::map&); +void trigger_at_frame_set(Model&, Reference, int); Uids frames_paste(Model&, Reference, const std::set&, const std::string&, int, std::string*); Uids root_bake_into(Model&, const std::set&, const std::set&, RootBakeOptions); -Uids items_remove(Model&, int, const std::map>&, const std::map>&); +void items_remove(Model&, int, const std::map>&, const std::map>&); Uids items_group(Model&, int, int, const std::set&, const std::string&); -Uids items_move(Model&, int, int, const std::set&, const std::set&, RowTarget, bool, bool); -Uids animation_length_fit(Model&, int); +void items_move(Model&, int, int, const std::set&, const std::set&, RowTarget, bool, bool); +void animation_length_fit(Model&, int); int item_add(Model&, ItemType, int, int, Layer, Null, int, Destination); std::set animation_group_ids_get(const Model&); std::set animation_group_indices_get(const Model&, int); void animation_groups_remove(Model&, const std::set&); Uids animation_add(Model&, int, int, int, const std::string&); -Uids animations_remove(Model&, const std::set&, const std::set&); +void animations_remove(Model&, const std::set&, const std::set&); Uids animations_move(Model&, const std::set&, const std::set&, AnimationTarget); -Uids animations_group(Model&, const std::set&, const std::string&); +void animations_group(Model&, const std::set&, const std::string&); Uids animations_paste(Model&, const std::string&, int, int, std::set&, std::string*); Uids animations_merge(Model&, int, std::set, Merge, bool, const std::set&); std::string region_name_get(const std::string&, int); -Uids regions_generate(Model&, const std::set&, const std::set&, const std::string&, RegionFrameMapping); -Uids regions_scan(Model&); -Uids region_frames_sync(Model&); -Uids regions_paste(Model&, int, const std::string&, int, std::string*); +void regions_generate(Model&, const std::set&, const std::set&, const std::string&, RegionFrameMapping); +void regions_scan(Model&); +void region_frames_sync(Model&); +void regions_paste(Model&, int, const std::string&, int, std::string*); Uids animation_grid_generate(Model&, const std::vector&, const GridOptions&); Uids frames_change_apply(Model&, const ChangeTargets&, FrameChange, ChangeType); bool regions_trim(Model&, int, const std::set&, const Image&); @@ -136,6 +136,6 @@ std::optional spritesheets_merge(Model&, const std::set&, const Imag // Where a spritesheet path of a document (this one, or a library) points, from this document. using SpritesheetPathGet = std::function; Model animation_layers_flatten(Model, const LibraryGet&, const SpritesheetPathGet&, const std::set& = {}); -Uids content_remove(Model&, ElementType, const std::set&, int, const LibraryGet&, const SpritesheetPathGet&); +void content_remove(Model&, ElementType, const std::set&, int, const LibraryGet&, const SpritesheetPathGet&); Model isaac_bridge(Model); bool file_merge(Model&, const std::filesystem::path&, const std::filesystem::path&, FileMergePreset); diff --git a/src/edit/frames.cpp b/src/edit/frames.cpp index f9588dc..cdaa2eb 100644 --- a/src/edit/frames.cpp +++ b/src/edit/frames.cpp @@ -53,14 +53,13 @@ Uids frame_insert(Model& model, Reference reference, int time) return {frame.uid}; } -Uids frames_delete(Model& model, const std::set& frames) +void frames_delete(Model& model, const std::set& frames) { for (auto& [trackReference, indices] : frames_by_track_get(frames)) if (auto track = model.track_edit(trackReference)) for (auto it = indices.rbegin(); it != indices.rend(); ++it) if (*it >= 0 && *it < (int)track->frames.size()) track->frames.erase(track->frames.begin() + *it); - return {}; } Uids frames_duplicate(Model& model, const std::set& frames, Reference focus) @@ -100,7 +99,7 @@ Uids frames_duplicate(Model& model, const std::set& frames, Reference } // Reverses the selected frames of each track as one block placed where the first of them was. -Uids frames_reverse(Model& model, const std::set& frames) +void frames_reverse(Model& model, const std::set& frames) { for (auto& [trackReference, indices] : frames_by_track_get(frames)) { @@ -118,7 +117,6 @@ Uids frames_reverse(Model& model, const std::set& frames) auto index = std::min(*indices.begin(), (int)track->frames.size()); track->frames.insert(track->frames.begin() + index, reversed.begin(), reversed.end()); } - return {}; } Uids frames_bake(Model& model, const std::set& frames, int interval, bool isRoundScale, bool isRoundRotation) @@ -319,25 +317,23 @@ Uids frames_property_set(Model& model, const std::set& references, Fr return uids; } -Uids frame_durations_set(Model& model, const std::map& durations) +void frame_durations_set(Model& model, const std::map& durations) { for (auto [reference, duration] : durations) if (auto frame = model.frame_edit(reference)) frame->duration = std::clamp(duration, FRAME_DURATION_MIN, FRAME_DURATION_MAX); - return {}; } // Places a trigger at a frame, stepping it back past any other trigger already there. -Uids trigger_at_frame_set(Model& model, Reference reference, int atFrame) +void trigger_at_frame_set(Model& model, Reference reference, int atFrame) { auto trigger = model.frame_edit(reference); if (!trigger) - return {}; + return; trigger->atFrame = atFrame; for (auto& other : model.track_get(reference)->frames) if (&other != trigger && other.atFrame == trigger->atFrame) trigger->atFrame--; - return {}; } // Pastes clipboard frames after the track's selected frames (or its current frame). Triggers go at `time`, stepping diff --git a/src/edit/tracks.cpp b/src/edit/tracks.cpp index 97210aa..5526e69 100644 --- a/src/edit/tracks.cpp +++ b/src/edit/tracks.cpp @@ -8,7 +8,7 @@ static std::vector* track_entries_edit(Model& model, int animationIn return animation ? &animation_entries_get(*animation, type) : nullptr; } -Uids items_remove(Model& model, int animationIndex, const std::map>& ids, +void items_remove(Model& model, int animationIndex, const std::map>& ids, const std::map>& groupIds) { for (auto type : {LAYER, NULL_}) @@ -18,7 +18,6 @@ Uids items_remove(Model& model, int animationIndex, const std::map{}; entries_take(*entries, [&](Track& track) { return typeIds.contains(track.id); }, typeGroupIds); } - return {}; } // Wraps ungrouped tracks in a new group placed where the first of them was. @@ -36,17 +35,17 @@ Uids items_group(Model& model, int animationIndex, int type, const std::set // 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. -Uids items_move(Model& model, int animationIndex, int type, const std::set& ids, const std::set& groupIds, +void items_move(Model& model, int animationIndex, int type, const std::set& ids, const std::set& groupIds, RowTarget target, bool isDropAfter, bool isDropIntoGroup) { if ((target.groupId != -1 && groupIds.contains(target.groupId)) || (target.isGroup && groupIds.contains(target.id))) - return {}; + return; auto entries = track_entries_edit(model, animationIndex, type); if (!entries) - return {}; + return; auto taken = entries_take(*entries, [&](Track& track) { return ids.contains(track.id); }, groupIds); if (taken.items.empty() && taken.groups.empty()) - return {}; + return; // Where top-level items go: beside the target row, or beside the group that holds it. auto isAfter = type == LAYER ? !isDropAfter : isDropAfter; @@ -80,14 +79,12 @@ Uids items_move(Model& model, int animationIndex, int type, const std::set& taken.items.clear(); } entries_insert(*entries, topIndex, std::move(taken)); - return {}; } -Uids animation_length_fit(Model& model, int animationIndex) +void animation_length_fit(Model& model, int animationIndex) { if (auto animation = model.animation_edit(animationIndex)) animation->frameNum = animation_length_get(*animation); - return {}; } // Adds a layer or null (or updates the one with the item's id) and gives it a track in one or every animation. diff --git a/src/model/model.cpp b/src/model/model.cpp index 4776d0d..63c3cd7 100644 --- a/src/model/model.cpp +++ b/src/model/model.cpp @@ -333,12 +333,6 @@ Handle Model::handle_get(Reference reference, bool isGroup) const return handle; } -std::uint64_t Model::uid_get(Reference reference, bool isGroup) const -{ - auto handle = handle_get(reference, isGroup); - return handle.frame ? handle.frame : handle.item ? handle.item : handle.animation; -} - template static void animation_uids_each(Animation& animation, Callback&& callback) { callback(animation.uid); @@ -403,11 +397,6 @@ std::set spritesheets_vector_used_get(const Model& model) return ids; } -int track_frames_count_get(const Track& track) -{ - return (int)track.frames.size(); -} - int track_length_get(const Track& track) { int length = 0; @@ -452,17 +441,14 @@ Animation animation_clone(Animation animation) return animation; } -static void track_locations_add(std::unordered_map& locations, const Track& track, +static void track_locations_add(std::unordered_map& locations, const Track& track, Reference reference) { - constexpr ElementType TRACK_TYPES[] = {ElementType::UNKNOWN, ElementType::ROOT_ANIMATION, - ElementType::LAYER_ANIMATION, ElementType::NULL_ANIMATION, - ElementType::TRIGGERS}; - locations[track.uid] = {reference, TRACK_TYPES[(int)track.type]}; + locations[track.uid] = reference; for (auto& frame : track.frames) { ++reference.frameIndex; - locations[frame.uid] = {reference, track.type == ItemType::TRIGGER ? ElementType::TRIGGER : ElementType::FRAME}; + locations[frame.uid] = reference; } } @@ -470,7 +456,7 @@ UidIndex::UidIndex(const Model& model) { for (auto [index, animation] : model.animations_get()) { - locations[animation->uid] = {{index}, ElementType::ANIMATION}; + locations[animation->uid] = {index}; track_locations_add(locations, animation->root, {index, ROOT}); track_locations_add(locations, animation->triggers, {index, TRIGGER}); for (auto type : {LAYER, NULL_}) @@ -481,7 +467,7 @@ UidIndex::UidIndex(const Model& model) {index, type, track.id, -1, group ? type : NONE, group ? group->id : -1}); }, [&](const TrackGroup& group) { - locations[group.uid] = {{index, type, group.id}, ElementType::GROUP}; + locations[group.uid] = {index, type, group.id}; track_locations_add(locations, group.root, {index, ROOT, -1, -1, type, group.id}); }); } @@ -495,13 +481,7 @@ bool UidIndex::contains(std::uint64_t uid) const std::optional UidIndex::reference_get(std::uint64_t uid) const { auto it = locations.find(uid); - return it == locations.end() ? std::nullopt : std::optional(it->second.reference); -} - -ElementType UidIndex::type_get(std::uint64_t uid) const -{ - auto it = locations.find(uid); - return it == locations.end() ? ElementType::UNKNOWN : it->second.type; + return it == locations.end() ? std::nullopt : std::optional(it->second); } // Equality by value. Animations shared with another model compare by pointer first. diff --git a/src/model/model.h b/src/model/model.h index 730a4e5..c14b895 100644 --- a/src/model/model.h +++ b/src/model/model.h @@ -375,30 +375,20 @@ public: Frame frame_effective(int, const Frame&) const; std::set unused_get(ElementType, const Animation* = nullptr) const; int uses_count(ElementType, const std::set&, int = -1, const Animation* = nullptr) const; - std::uint64_t uid_get(Reference, bool = false) const; Handle handle_get(Reference, bool = false) const; void uids_repair(); }; -// uid -> where that element is now (as a Reference) and what it is, built in one walk of the animations. +// uid -> where that element is now, as a Reference, built in one walk of the animations. class UidIndex { -public: - struct Location - { - Reference reference = {}; - ElementType type = {}; - }; - -private: - std::unordered_map locations; + std::unordered_map locations; public: UidIndex() = default; explicit UidIndex(const Model&); bool contains(std::uint64_t) const; std::optional reference_get(std::uint64_t) const; - ElementType type_get(std::uint64_t) const; }; bool is_model_equal(const Model&, const Model&); @@ -408,7 +398,6 @@ Vec2 region_pivot_get(const Region&); void frame_region_rect_set(Frame&, const Region&); void frame_region_apply(Frame&, const std::vector&); std::set spritesheets_vector_used_get(const Model&); -int track_frames_count_get(const Track&); int track_length_get(const Track&); int animation_length_get(const Animation&); IVec2 animation_play_range_get(const Animation&); diff --git a/src/playback.cpp b/src/playback.cpp index cac0ff1..4942f03 100644 --- a/src/playback.cpp +++ b/src/playback.cpp @@ -10,12 +10,6 @@ void Playback::toggle() time = 0.0f; isFinished = false; isPlaying = !isPlaying; - timing_reset(); -} - -void Playback::timing_reset() -{ - tickAccumulator = 0.0f; } void Playback::clamp(int length) @@ -48,7 +42,6 @@ void Playback::tick(int fps, int start, int end, bool isLoop, float deltaSeconds time = (float)end - 1.0f; isPlaying = false; isFinished = true; - timing_reset(); } } @@ -56,12 +49,10 @@ void Playback::decrement(int length) { --time; clamp(length); - timing_reset(); } void Playback::increment(int length) { ++time; clamp(length); - timing_reset(); } diff --git a/src/playback.h b/src/playback.h index fb3b374..770c396 100644 --- a/src/playback.h +++ b/src/playback.h @@ -8,12 +8,8 @@ public: bool isFinished = false; void toggle(); - void timing_reset(); void clamp(int); void tick(int, int, int, bool, float); void decrement(int); void increment(int); - -private: - float tickAccumulator = 0; }; diff --git a/src/types.h b/src/types.h index 00f2efb..6987e8a 100644 --- a/src/types.h +++ b/src/types.h @@ -58,4 +58,3 @@ enum class OnionskinMode INDEX }; -constexpr auto ID_NONE = -1; diff --git a/src/ui/animation_preview.cpp b/src/ui/animation_preview.cpp index 39f0696..755c2b1 100644 --- a/src/ui/animation_preview.cpp +++ b/src/ui/animation_preview.cpp @@ -156,7 +156,6 @@ void AnimationPreview::tick(Manager& manager, Settings& settings, float deltaSec { playback.isPlaying = false; playback.isFinished = false; - playback.timing_reset(); } else { @@ -237,7 +236,6 @@ void AnimationPreview::recording_start(Manager& manager, Settings& settings, Doc return recording_stop(manager, document); } document.playback.isPlaying = true; - document.playback.timing_reset(); document.playback.time = recorder.time_get(); document.frameTime = document.playback.time; } diff --git a/src/ui/animations.cpp b/src/ui/animations.cpp index 077f294..59cefd9 100644 --- a/src/ui/animations.cpp +++ b/src/ui/animations.cpp @@ -625,14 +625,12 @@ void animations_update(Panel& panel, AnimationsPanel& animations) auto targets = animation_groupable_indices_get(document); command_push(panel, [&state, targets = std::set(targets.begin(), targets.end())](Document& document) { - auto groupIds = animation_group_ids_get(document.model); - auto groupId = groupIds.empty() ? 0 : *groupIds.rbegin() + 1; + auto groupId = group_next_id(document.model.animations.entries); document.edit_apply(EDIT_GROUP_ITEMS, [&](Model& model) { - auto uids = animations_group(model, targets, localize.get(TEXT_NEW_GROUP)); + animations_group(model, targets, localize.get(TEXT_NEW_GROUP)); animations_selection_set(document, targets, {groupId}); document.reference_set({*targets.begin()}); state.scrollId = *targets.begin(); - return uids; }); }); }); diff --git a/src/ui/timeline_menus.cpp b/src/ui/timeline_menus.cpp index 620218d..1d05b58 100644 --- a/src/ui/timeline_menus.cpp +++ b/src/ui/timeline_menus.cpp @@ -38,7 +38,6 @@ void TimelineContext::playback_stop() { playback.isPlaying = false; playback.isFinished = false; - playback.timing_reset(); } void TimelineContext::context_menu() diff --git a/src/ui/timeline_tracks.cpp b/src/ui/timeline_tracks.cpp index 01119a4..a79c66f 100644 --- a/src/ui/timeline_tracks.cpp +++ b/src/ui/timeline_tracks.cpp @@ -301,7 +301,7 @@ void TimelineContext::item_child(const TimelineRow& row, int index) return value ? localize.get(BASIC_YES) : localize.get(BASIC_NO); }; auto visibleLabel = yesNoLabel(isVisible); - auto framesCount = item ? track_frames_count_get(*item) : 0; + auto framesCount = item ? (int)item->frames.size() : 0; switch (type) { diff --git a/tests/operations.cpp b/tests/operations.cpp index c5ea522..4b40cc8 100644 --- a/tests/operations.cpp +++ b/tests/operations.cpp @@ -151,12 +151,20 @@ TEST_CASE("edit layer operations") {"frame_insert", "02_items.anm2", [&](Model& anm2) { return frame_insert(anm2, {0, LAYER, 0, 0}, 0); }, 1}, {"trigger_insert", "02_items.anm2", [&](Model& anm2) { return frame_insert(anm2, {0, TRIGGER, -1, 0}, 2); }, 1}, {"frames_delete", "02_items.anm2", - [&](Model& anm2) { return frames_delete(anm2, {{0, LAYER, 0, 0}, {0, ROOT, -1, 1}}); }, 0}, + [&](Model& anm2) { + frames_delete(anm2, {{0, LAYER, 0, 0}, {0, ROOT, -1, 1}}); + return Uids{}; + }, + 0}, {"frames_duplicate", "02_items.anm2", [&](Model& anm2) { return frames_duplicate(anm2, {{0, LAYER, 0, 0}, {0, LAYER, 0, 1}}, {0, LAYER, 0, 1}); }, 2}, {"frames_reverse", "07_special_interpolation.anm2", - [&](Model& anm2) { return frames_reverse(anm2, {{0, LAYER, 0, 0}, {0, LAYER, 0, 2}}); }, 0}, + [&](Model& anm2) { + frames_reverse(anm2, {{0, LAYER, 0, 0}, {0, LAYER, 0, 2}}); + return Uids{}; + }, + 0}, {"frames_bake", "07_special_interpolation.anm2", [&](Model& anm2) { return frames_bake(anm2, {{0, LAYER, 0, 0}, {0, LAYER, 0, 1}}, 2, true, false); }, 5}, {"frame_split", "02_items.anm2", [&](Model& anm2) { return frame_split(anm2, {0, LAYER, 1, 0}, 2); }, 1}, @@ -178,16 +186,33 @@ TEST_CASE("edit layer operations") {"items_group", "03b_groups_legacy_flat.anm2", [&](Model& anm2) { return items_group(anm2, 0, LAYER, {2}, "New"); }, 1}, {"items_move", "03b_groups_legacy_flat.anm2", - [&](Model& anm2) { return items_move(anm2, 0, LAYER, {2}, {}, {true, LAYER, 0, -1}, false, true); }, 0}, + [&](Model& anm2) { + items_move(anm2, 0, LAYER, {2}, {}, {true, LAYER, 0, -1}, false, true); + return Uids{}; + }, + 0}, {"items_remove", "03b_groups_legacy_flat.anm2", - [&](Model& anm2) { return items_remove(anm2, 0, {{LAYER, {2}}}, {{NULL_, {3}}}); }, 0}, + [&](Model& anm2) { + items_remove(anm2, 0, {{LAYER, {2}}}, {{NULL_, {3}}}); + return Uids{}; + }, + 0}, {"animation_add", "03a_groups_nested.anm2", [&](Model& anm2) { return animation_add(anm2, 1, 0, 0, "Added"); }, 1}, - {"animations_remove", "03a_groups_nested.anm2", [&](Model& anm2) { return animations_remove(anm2, {1}, {0}); }, + {"animations_remove", "03a_groups_nested.anm2", + [&](Model& anm2) { + animations_remove(anm2, {1}, {0}); + return Uids{}; + }, 0}, {"animations_move", "02_items.anm2", [&](Model& anm2) { return animations_move(anm2, {0}, {}, {.animationIndex = 1, .isAfter = true}); }, 1}, - {"animations_group", "02_items.anm2", [&](Model& anm2) { return animations_group(anm2, {0, 1}, "Group"); }, 0}, + {"animations_group", "02_items.anm2", + [&](Model& anm2) { + animations_group(anm2, {0, 1}, "Group"); + return Uids{}; + }, + 0}, {"animations_paste", "02_items.anm2", [&](Model& anm2) { std::set groupIds; @@ -198,7 +223,8 @@ TEST_CASE("edit layer operations") {"regions_paste", "05_regions.anm2", [&](Model& anm2) { auto region = item_get(item_get(anm2.content.spritesheets, 0)->regions, 1); - return regions_paste(anm2, 0, item_to_string(*region), 1, nullptr); + regions_paste(anm2, 0, item_to_string(*region), 1, nullptr); + return Uids{}; }, 0}, {"animation_grid_generate", "05_regions.anm2",