AnimationServer

References
public sealed class AnimationServer : IStorable
The animation server owns the named animations belonging to a document, and runs them.

Animations are an offline batch process. A frame takes as long as it takes to solve the document and capture the images, which is typically far longer than a frame is meant to last on playback, so the server writes numbered images to disk rather than trying to keep any kind of real time schedule. Only one animation may run at a time, and a run may be cancelled or resumed.

Properties

Animations

#
public Animation[] Animations { get; }
Gets all animations in this document.

Count

#
public int Count { get; }
Gets the number of animations in this document.

Document

#
public Document Document { get; }
Gets the document this server belongs to.

IsRunning

#
public bool IsRunning { get; }
Gets whether an animation is running.

Running

#
public Animation Running { get; }
Gets the animation currently running, or null.

StoredCount

#
public int StoredCount { get; }
Gets how many animations would actually be written to a file, which is every one except the placeholders.

Deleting the last animation leaves an empty one behind so the animation window still has something to show. That stand-in is not saved, so a document holding nothing else has nothing to write and should not be asked to.

Methods

Add

#
public bool Add(Animation animation)
Add an animation to this document.
animation (Animation)

Adopt

#
public Animation Adopt(Guid objectId)
Find the animation which drives an object, or create one for it. This is what the 'animate this' entry point on an object calls.
objectId (Guid)Instance id of the object to animate.
An animation containing a binding for the object.

Cancel

#
public void Cancel()
Ask the running animation to stop. The current frame is abandoned rather than finished, and the document is put back the way it was.

Find

#
public Animation Find(Guid identity)
Find an animation by identity.
identity (Guid)

FindByObject

#
public Animation FindByObject(Guid objectId)
Find the first animation which drives a specific object.
objectId (Guid)

Remove

#
public bool Remove(Animation animation)
Remove an animation from this document.
animation (Animation)

Run

#
public Task<AnimationReport> Run(Animation animation, bool resume)
Run an animation. The returned task completes when the run does; it does not fault, every failure is reported through the resulting report instead.
animation (Animation)Animation to run. Must belong to this document.
resume (bool)True to leave frames which are already on disk alone.

Store

#
public void Store(IWriter writer)
This method is called whenever the instance is required to serialize itself.
writer (IWriter)Writer object to serialize with.
Store

SuggestName

#
public string SuggestName()
Suggest a name for a new animation which is not already in use.

Events

Progress

#
Raised once per frame while an animation runs. Raised on the animation thread, so a handler which touches the user interface must marshal.