Animation objects

Miscellaneous ››
Parent Previous Next

Animation objects

ensight.objs.ens_animobj class

This class is at the core of animation in EnSight. If you want to introduce an animation into EnSight, create a subclass of this object and enable playing on it. Each instance defines a temporal block of animation and it will be dynamically called by EnSight to update itself. The simplest example would be:


class myanim(ens_animobj):

   def __init__(self):    

      ens_animobj.__init__(self)

   def state(self, v):    

      ens_animobj.state(self, v)

   def update(self, f):    

      ens_animobj.update(self, f)


The class has a number of data members:

Methods:

The ensight.objs.core object has a few attributes that control the global operation of animations:

EnsAnimAttr class

EnsAnimAttr is a convenience class to animate object attributes along a spline (zero-order or higher). The caller specifies the object, attribute, and control points and the class handles all aspects of animation, including recording. A simple example would be:


from ensight.core.ensanim import EnsAnimAttr

obj = ensight.objs.core
attr = enums.SOLUTIONTIME
times = ensight.objs.core.SOLUTIONTIME_LIMITS
cpts = [[0.0, [times[0]]], [1.0, [times[1]]]]
a = EnsAnimAttr(obj, attr, cpts)
a.num_frames = times[1] - times[0] + 1


This example animation solution time (an attribute on the core object) linearly from the min value to max value. The control points are given in a list, where each control point is of the form [t, [values]]. Animation time runs from t=0.0 to t=1.0.

EnsAttrSync class

EnsAttrSync uses callbacks to synchronize attributes between multiple parts. It will monitor a source list of parts for changes to a defined list of attributes, and it will copy these attributes to the given destination parts whenever one of them changes. A simple example would be to synchronize the VALUE attribute on several clips or isosurfaces:


from ensight.core.ensattrutil import EnsAttrSync
from ensight.objs import *

parts = [core.PARTS[0], core.PARTS[1]]
attrs = [ enums.VALUE ]
s = EnsAttrSync(src=parts, dest=parts, attr=attrs)