System ID LW Backdrop Info Globals Table of Contents

"Animation Envelopes"

Availability:  LightWave 6.0
Component:  Layout

An envelope is an array of time-varying settings, or keyframes. This global returns functions that allow you to create and manage envelopes and envelope groups.

Global Call

   LWEnvelopeFuncs *envfunc;
   envfunc = global( "Animation Envelopes", GFUSE_TRANSIENT );

The global function returns a pointer to an LWEnvelopeFuncs.

   typedef struct st_LWEnvelopeFuncs {
      LWEnvelopeID    (*create)(LWEnvGroupID, const char *, int);
      void            (*destroy)(LWEnvelopeID);
      LWEnvGroupID    (*createGroup)(LWEnvGroupID parent, const char *);
      void            (*destroyGroup)(LWEnvGroupID);
      LWError         (*copy)(LWEnvelopeID to, LWEnvelopeID from);
      LWError         (*load)(LWEnvelopeID, LWLoadState *);
      LWError         (*save)(LWEnvelopeID, LWSaveState *);
      double          (*evaluate)(LWEnvelopeID, LWTime);
      int             (*edit)(LWEnvGroupID, LWEnvelopeID,
                         int flags, void *data);
      int             (*envAge)(LWEnvelopeID);
      LWEnvKeyframeID (*createKey)(LWEnvelopeID, LWTime, double value);
      void            (*destroyKey)(LWEnvelopeID, LWEnvKeyframeID);
      LWEnvKeyframeID (*nextKey)(LWEnvelopeID, LWEnvKeyframeID);
      LWEnvKeyframeID (*prevKey)(LWEnvelopeID, LWEnvKeyframeID);
      int             (*keySet)(LWEnvelopeID, LWEnvKeyframeID,
                         LWKeyTag, void *value);
      int             (*keyGet)(LWEnvelopeID, LWEnvKeyframeID,
                         LWKeyTag, void *value);
   } LWEnvelopeFuncs;
env = create( group, name, type )
Creates a new envelope.

destroy( env )
Destroys an envelope.

group = createGroup( parent, name )
Creates a new envelope group.

destroyGroup( group )
Destroys an envelope group.

error = copy( to, from )
Copies the contents of an envelope.

error = load( env, loadstate )
Loads an envelope from an envelope file.

error = save( env, savestate )
Saves an envelope to an envelope file.

value = evaluate( env, time )
Returns the interpolated value of the envelope at a given time.

result = edit( group, env, flags, mydata )
Allows the user to edit the envelope group.

age = envAge( env )
Returns an integer containing the number of times the envelope has been changed.

key = createKey( env, time, value )
Creates a new key in an envelope.

destroyKey( env, key )
Deletes a key in an envelope.

key = nextKey( env, key )
Returns the next key in the envelope.

key = prevKey( env, key )
Returns the previous key in the envelope.

result = keySet( env, key, tag, value )
Sets the value of a key.

result = keyGet( env, key, tag, value )
Gets the value of a key.

Example

This code fragment don't do so much yet.

   #include <lwserver.h>
   #include <lwenvel.h>

   LWEnvelopeFuncs *envfunc;
   envfunc = global( "Animation Envelopes", GFUSE_TRANSIENT );