public void Copy() { try { if (!CanEdit()) { return; } var time = clipTime; var entry = AtomAnimationClip.Copy(time, GetAllOrSelectedTargets().ToList()); if (entry.empty) { SuperController.LogMessage("Timeline: Nothing to copy"); } else { clipboard.Clear(); clipboard.time = time; clipboard.entries.Add(entry); } } catch (Exception exc) { SuperController.LogError($"Timeline.{nameof(AtomAnimationEditContext)}.{nameof(Copy)}: {exc}"); } }
public void CopyDeleteSelected(bool copy, bool delete) { plugin.animationEditContext.clipboard.Clear(); plugin.animationEditContext.clipboard.time = _startJSON.valNoCallback; foreach (var target in animationEditContext.GetAllOrSelectedTargets()) { target.StartBulkUpdates(); try { var keyframes = target.GetAllKeyframesTime(); for (var key = keyframes.Length - 1; key >= 0; key--) { var keyTime = keyframes[key]; if (keyTime < _startJSON.val || keyTime > _endJSON.val) { continue; } if (copy) { plugin.animationEditContext.clipboard.entries.Insert(0, AtomAnimationClip.Copy(keyTime, animationEditContext.GetAllOrSelectedTargets().ToList())); } if (delete && !keyTime.IsSameFrame(0) && !keyTime.IsSameFrame(current.animationLength)) { target.DeleteFrame(keyTime); } } } finally { target.EndBulkUpdates(); } } }
public AtomClipboardEntry Start(float clipTime, IEnumerable <FreeControllerAnimationTarget> targets) { // ReSharper disable once RedundantEnumerableCastCall var snapshot = AtomAnimationClip.Copy(clipTime, targets.Cast <IAtomAnimationTarget>().ToList()); if (snapshot.controllers.Count == 0) { SuperController.LogError($"Timeline: Cannot offset, no keyframes were found at time {clipTime}."); return(null); } if (snapshot.controllers.Select(c => _clip.targetControllers.First(t => t.controller == c.controller)).Any(t => !t.EnsureParentAvailable(false))) { return(null); } return(snapshot); }
public void Cut() { try { if (!CanEdit()) { return; } var time = clipTime; var entry = AtomAnimationClip.Copy(time, GetAllOrSelectedTargets().ToList()); if (entry.empty) { SuperController.LogMessage("Timeline: Nothing to cut"); } else { clipboard.Clear(); clipboard.time = time; clipboard.entries.Add(entry); if (time.IsSameFrame(0f) || time.IsSameFrame(current.animationLength)) { return; } foreach (var target in GetAllOrSelectedTargets()) { target.DeleteFrame(time); } } } catch (Exception exc) { SuperController.LogError($"Timeline.{nameof(AtomAnimationEditContext)}.{nameof(Cut)}: {exc}"); } }