Stage 2: stable element uids and selection that follows edits
- Element::uid: runtime-only, unique per document (uids_repair on load and after
every edit gives copies and new elements fresh uids; never serialized or hashed)
- Handle {animation, item, frame} uids and UidIndex (one walk: uid -> Reference)
- Snapshots capture the selection's handles when an edit starts and re-resolve the
fields the edit left untouched on commit, undo and redo; replaces
restored_snapshot_sanitize. Covers the main reference, frame/item/group
references, timeline frame selection and the animation list selection.
- tests/selection.cpp: references survive inserts, copies, deletes, animation
removal/reordering and regrouping
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
26ab394fe4
commit
20bfbace7a
7 files changed
+395
-77
No files matched your search
@@ -110,6 +110,19 @@ namespace anm2ed
|
||||
void apply(Snapshot&, SnapshotStepDirection) const;
|
||||
};
|
||||
|
||||
// The selection as it was before a change, with the uids that let it follow elements through the change.
|
||||
struct SnapshotSelection
|
||||
{
|
||||
Reference reference{};
|
||||
std::set<Reference> frameReferences{};
|
||||
std::set<Reference> itemReferences{};
|
||||
std::set<Reference> groupReferences{};
|
||||
std::set<int> frameIndices{};
|
||||
std::set<int> animationIndices{};
|
||||
std::map<Reference, Handle> handles{};
|
||||
std::map<Reference, Handle> groupHandles{};
|
||||
};
|
||||
|
||||
class SnapshotStack
|
||||
{
|
||||
public:
|
||||
@@ -136,6 +149,7 @@ namespace anm2ed
|
||||
SnapshotStack redoStack{};
|
||||
Snapshot current{};
|
||||
std::optional<SnapshotStep> pendingStep{};
|
||||
std::optional<SnapshotSelection> pendingSelection{};
|
||||
|
||||
void anm2_push(const std::string&);
|
||||
void tracks_push(const std::string&, const std::set<Reference>&);
|
||||
|
||||
Reference in new issue
Block a user