Chimera version 1.7 (November 5, 2012)
The Animate package implements both scene and animation functionality. Core attributes such as model names, residue types and atom positions are handled automatically by the Animate package. Tools are responsible for saving, restoring and animating objects and attributes that they introduce. Notification of scene and animation events happen through the standard Chimera trigger mechanism.
There are two triggers associated with scenes:
chimera.SCENE_TOOL_SAVE
chimera.SCENE_TOOL_RESTORE
Each scene object has a dictionary, tool_settings
,
for managing tool-specific data. Tools are responsible for creating
their own keys and values for storing and accessing data in the
dictionary. Singleton tools such as 2DLabels
can use fixed strings such as "2D Labels (gui)" as their
keys; multi-instance tools will need to come up with unique keys and
make sure that they are not overwriting data for some other tool.
Typically, data is saved in SCENE_TOOL_SAVE
and accessed
in SCENE_TOOL_RESTORE
handlers.
Animate
updates the graphics display during
transitions. There are three types of transitions:
frames
attribute of the key frame).
There is a static "transition" for the initial frame if
it has a non-zero frames
value.There are four triggers associated with key frame and scene transitions:
chimera.ANIMATION_TRANSITION_START
chimera.ANIMATION_TRANSITION_STEP
chimera.ANIMATION_TRANSITION_FINISH
chimera.SCENE_TOOL_RESTORE
ANIMATION_TRANSITION_FINISH
. The purpose for firing
this trigger is to simplify writing tools that do not need
step-by-step animation yet want to restore state when a scene
state is reached. These tools can just register for the
SCENE_TOOL_RESTORE
trigger and completely ignore the ANIMATION_TRANSITION_*
triggers. Tools that wants to handle both step-by-step animation
and scene restoration will need to avoid getting the
SCENE_TOOL_RESTORE
trigger twice by deregistering for
it in ANIMATION_TRANSITION_START
and reregistering for
it in ANIMATION_TRANSITION_FINISH
.
The transition object received by handlers has several useful attributes and methods:
frames
frameCount
ANIMATION_TRANSITION_START
, this value should always be zero.
For ANIMATION_TRANSTION_STEP
,
this value ranges from 1 to frames
, inclusive.
For ANIMATION_TRANSITION_FINISH
,
this value should be the same as frames
.target()
Animate.Keyframe.Keyframe
for movie playback or
Animate.Scene.Scene
for scene restoration using the
default transition.scene()
Keyframe
nor a Scene
.tool_settings
tool_settings
in transition objects are transient.
When a transition completes, the dictionary is automatically
removed and any stored data will be lost.