Enumerating and Identifying Sub-Animatables
 
 
 

If your plug-in wishes to support the animatable interface and appear in the track view you must identify which sub-objects are animatable. These are called sub-animatables. You can do this by overriding the following methods from the Animatable class.

Note: a parameter block is considered a single animatable sub-object, and any parameters it manages are not counted as animatable sub-objects for the purposes of the following functions.

Example 1

The following example is the implementation used by the position constraint sample:

// Return one animatable sub-objects, which correspond the parameter block
int NumSubs() {
  return1;
}
 
// Returns the nth animatable sub-object
Animatable* SubAnim(int i) {
  returni != 0 ? pblock : NULL;
}
 
// Return the name of the nth animatable sub-object
MSTR SubAnimName(int i) {
  returnGetString(IDS_AG_POSITIONPARAMS);
}
 
// Returns a reference number of the nth animatable sub-object
int SubNumToRefNum(inti) {
   if (subNum==0)
     return 0; // depends on the number and order of references
   else
     return -1;
}

Example 2

The following example demonstrates multiple sub-animatables from the simple modifier base class (SimpleMod):

int SimpleMod::NumSubs() {
  return3;
}
 
Animatable* SimpleMod::SubAnim(inti)
{
   switch (i)
   {
     case 0: return posControl; // Center
     case 1: return tmControl;  // Gizmo
     case 2: return pblock;     // Parameter block
     default: return NULL;
   }
}
 
MSTR SimpleMod::SubAnimName(inti)
{
   switch (i)
   {
     case 0: return MSTR(_M("Center"));
     case 1: return MSTR(_M("Gizmo"));
     case 2: return MSTR(_M("Parameters"));
     default: return MSTR(_M(""));
   }
}