AnimationEditor

General description

The “AnimationEditor” component is used to build an animation from key points motion, or typically to build effector goals trajectories.

AnimationEditor

How to use the component

To learn how to create a SOFA scene, please refer to the tutorial provided by the SOFA Modeler or this documentation.

This component needs a “MechanicalObject” in its context:

goal = bunny.createChild('goal')
goal.createObject('EulerImplicite')
goal.createObject('CGLinearSolver')
goal.createObject('MechanicalObject', position="3 -12 -20   3 -12 -10   10 -12 10   10 -12 30   10 -12 45 ", showObject="1")
goal.createObject('AnimationEditor', listening="1")
goal.createObject('UncoupledConstraintCorrection')

The “AnimationEditor” component inherites from SOFA controller. In SOFA, a controller has an input data “listening” that has to be set to true if you want the component to be active in your scene, “listening=1”.

Now you can build your animation. To navigate through the timeline, click left on the scene window and use the following keyboard commands:

  • ctrl+ : move the cursor to the right
  • ctrl+← : move the cursor to the left
  • ctrl+”+” : move the cursor to the next keyframe
  • ctrl+”-“ : move the cursor to the previous keyframe

The cursor is represented by a white triangle. You can now move the key points that you created with “MechanicalObject” and save a keyframe. Between two keyframes an interpolation is computed to create the animation. A keyframe is represented by a yellow triangle upon a line. Here are the keyframes commands:

  • ctrl+a : add a key in the cursor location
  • ctrl+d : delete the key
  • ctrl+c : copy the key
  • ctrl+x : cut the key
  • ctrl+v : paste the key

You can also save, load or play/pause the animation using the following commands:

  • ctrl+w : (write) save the animation in “filename”
  • ctrl+m : play/pause the animation

Examples are provided in the “examples/component/controller/AnimationEditor” directory of the plugin. The component is templated with Vec3 and Rigid3. Here is an example of a rigid animation.

This kind of animation could be used, for instance, for the control of an effector in position and rotation. The “PositionEffector” component is also templated with Rigid3. Thus, you can save a trajectory for a 6DoF target.

Data field

Input data

maxKeyFrame : Max>=1. Default 150.

filename : Name of the file to save/load the animation.

loop : If true, enable to loop the animation (on the play mode)

Comments are closed.