public sealed class AnimationClipDocumentA hand-authored animation clip, open for editing.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Doc 20 files this row as "the format does not exist", and this is the format plus the two operations an editor needs on top of it. Everything a person does to a clip — adding a curve, moving a key, adding an event, changing the duration — has to be one entry on the undo stack, and a document that let a view mutate the asset directly would be the bug IEditorCommand exists to make obvious.
⚠ Every edit is expressed as replacing a curve, not as mutating one. A curve is a list of keys with tangents and a drag changes several of them at once; a command per key would make undoing a box-select of twenty keys twenty presses. Replacing the whole curve is one command whose undo is the previous list, and the lists are small — a hand-animated curve is tens of keys, not thousands.
⚠ A file this build cannot read throws from FromYaml and is caught here. The document opens empty with the failure in LoadError, for CompositorDocument's reason: a panel that could show the problem has to be reachable.
Fields and properties (10)
public const string ExtensionWhat an authored clip is written as.
public string AssetPathWhere the file is, absolute.
public AnimationClipAsset ClipThe clip.
public string? LoadErrorWhy the file would not read, or .
public Func<AnimationClipDocument, ProposalInputs?>? SceneWhat the clip was marked up against, for the proposal pass.
public IReadOnlyList<ConstraintProposal> ProposalsWhat the last proposal pass found, most confident first.
public string ProposalErrorWhy the last pass found nothing, or empty.
public const float KeyEpsilonHow close two keys have to be before one replaces the other, in seconds.
public const float MinimumDurationThe shortest a clip may be, in seconds.
public int KeyCountHow many keys the clip carries, across every curve.
Events (1)
public Action<AnimationClipDocument>? ChangedRaised after anything changes the clip.
Methods (26)
public IReadOnlyList<ConstraintProposal> Propose()Watches the clip play against its authoring context and looks for contacts.
public ConstraintTagRecord Accept(ConstraintProposal proposal)Adds a proposal's tag to the clip, undoably.
public AnimationClipDocument(EditorProject project, AssetId asset, string path)Opens a clip.
public AnimationTargetData? Target(string target)The target of a given name, or .
public bool AddTarget(string target)Adds a target, undoably.
public bool RemoveTarget(AnimationTargetData target)Removes a target and everything it carries, undoably.
public static AnimationCurveData? Curve(AnimationTargetData target, AnimationProperty property)The curve driving one property of one target, or .
public void SetCurve(AnimationTargetData target, AnimationProperty property, IReadOnlyList<AnimationKeyData> keys)Replaces one curve's keys, undoably.
public void AddKey(AnimationTargetData target, AnimationProperty property, float time, float value)Adds one key to a curve, making the curve if it is not there, undoably.
public AnimationEventData AddEvent(string name, float time)Adds an event, undoably.
public bool RemoveEvent(AnimationEventData entry)Removes an event, undoably.
public void MoveEvent(AnimationEventData entry, float time)Moves an event, undoably.
public ConstraintTagRecord AddConstraint(ConstraintTagRecord tag)Adds a constraint, undoably.
public bool RemoveConstraint(ConstraintTagRecord tag)Removes a constraint, undoably.
public void MoveConstraint(ConstraintTagRecord tag, float begin, float end)Drags a constraint's ends, undoably.
public void SetConstraintField<T>(ConstraintTagRecord tag, string label, Func<ConstraintTagRecord, T> read, Action<ConstraintTagRecord, T> write, T value)Changes one field of a constraint, undoably.
public IReadOnlyList<ConstraintTagRecord> ApplyTemplate(ConstraintTemplateContent template, float begin = 0, float end = 1)Applies a template over a span of the clip, undoably.
public TemplateDiff CompareTemplate(ConstraintTemplateContent template, float begin = 0, float end = 1)What re-applying a template would do, without doing it.
public TemplateDiff ReapplyTemplate(ConstraintTemplateContent template, float begin = 0, float end = 1)Re-applies a template, replacing the tags it produced and leaving the rest, undoably.
public void ConstraintsAt(float phase, ICollection<(ConstraintTagRecord Tag, float Weight)> into)Which constraints are live at a moment in the clip.
public static float Activation(ConstraintTagRecord tag, float phase)How much of a tag is live at a phase, matching what the runtime will do.
public void SetDuration(float duration)Changes how long the clip is, undoably.
public void SetFrameRate(float rate)Changes what the timeline snaps to, undoably.
public void SetWrap(WrapMode wrap)Changes what happens at the end, undoably.
public static float Evaluate(AnimationTargetData target, AnimationProperty property, float time)What one property is worth at a time, or its rest value.
protected override void SaveCore()Writes the document back to wherever it came from.
Used by (8)
- AnimationBinderVixen.Editor.AssetEditors
- AnimationClipEditorFactoryVixen.Editor.AssetEditors
- AnimationClipViewVixen.Editor.AssetEditors
- AnimationWiringTestsVixen.Editor.App.Tests
- AuthoringContextTestsVixen.Editor.AssetEditors.Tests
- AuthoringTestsVixen.Editor.AssetEditors.Tests
- ConstraintFieldAccessVixen.Editor.AssetEditors
- ConstraintFieldAccessorVixen.Editor.AssetEditors