snapshot method

MotionSnapshot snapshot()

The motion at one moment, deep-copied — the other half of the editor's undo journal (the scene's is SceneDocument.snapshot).

Implementation

MotionSnapshot snapshot() {
  // The timeline places group OBJECTS, so a snapshot's arrangement has to
  // point at the snapshot's own copies rather than at the live ones.
  var copies = {for (var g in groups) g: g.copy()};
  return MotionSnapshot._(
    [...params],
    copies.values.toList(),
    _copyExpr(timeline, copies),
    // The target's name AS IT WAS, captured rather than read back off the
    // node: a rename between snapshot and restore moves the node's name,
    // and this is the string that has to survive it.
    [for (var g in groups) g.node.name],
  );
}