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

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

Count

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

Document

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

IsRunning

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

Running

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

StoredCount

#
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.

public int StoredCount { get; }

Methods

Add

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

Adopt

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

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.
public void Cancel()

Find

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

FindByObject

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

Remove

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

Run

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

Store

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

SuggestName

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

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.