Clip (object)

The clip stores a collection of track sets, each one representing a complex values such as a Vec3 or Xfo.

A Clip is typically used to store all the animation for a character action. Multiple clips can then store a library of animation data. The Clips can be evaluated, to generate ClipValues which can be blended together and used to drive the pose of a character.

参考

TrackSet

/*
** Example: clip.kl
*/

require Animation;

operator entry(){

  //////////////////////////////////
  // Generate a clip using each type of track set. 
  Clip clip('MyClip');
  clip.addTrackSet('ScalarTrackSet', Color(1.0,0.0,0.0), 1.2, 0);
  clip.addTrackSet('Vec2TrackSet', Vec2(0.4, 1.2), 0);
  clip.addTrackSet('Vec3TrackSet', Vec3(0.4, 1.2, 2.4), 0);
  clip.addTrackSet('Vec4TrackSet', Vec4(0.4, 1.2, 2.4, 5.7), 0);
  clip.addTrackSet('QuatTrackSet', Quat(), 0);
  clip.addTrackSet('EulerTrackSet', Euler(0.4, 1.2, 6.8, RotationOrder('zyx')), 0);
  clip.addTrackSet('XfoTrackSet', Xfo(), 0);

  UInt32 seed = 5467;
  UInt32 offset = 0;
  String trackSetNames[] = clip.getTrackSetNames();
  for(Integer i=0; i<trackSetNames.size(); i++) {  
    report('trackSet:'+trackSetNames[i]);
    KeyframeTrackSet trackSet = clip.getTrackSet(trackSetNames[i]);
    String trackNames[] = trackSet.getTrackNames();
    for(Integer j=0; j<trackNames.size(); j++) {
      report('  track:'+trackNames[j]);
      KeyframeTrack track = trackSet.getTrack(trackNames[j]);
      track.addKey(Keyframe(0.0, mathRandomScalar(seed, ++offset), Vec2(0.0, 0.0), Vec2(0.333, 0.0)));
      track.addKey(Keyframe(2.0, mathRandomScalar(seed, ++offset), Vec2(-0.5, 25.0), Vec2(0.5, 25.0)));
      track.addKey(Keyframe(4.0, mathRandomScalar(seed, ++offset), Vec2(-0.333, 0.0), Vec2(0.333, 0.0)));
    }
  }

  //////////////////////////////////
  // Evalaute the clip over time to get the clipValues. 
  for(Integer t=0; t<5; t++) {  
    ClipValues clipValues = clip.evaluate((Scalar(t)/5.0));
    report(clipValues.getDesc());
  }
}

/*
** Output:

trackSet:ScalarTrackSet
  track:ScalarTrackSet
trackSet:Vec2TrackSet
  track:x
  track:y
trackSet:Vec3TrackSet
  track:x
  track:y
  track:z
trackSet:Vec4TrackSet
  track:x
  track:y
  track:z
  track:t
trackSet:QuatTrackSet
  track:v.x
  track:v.y
  track:v.z
  track:w
trackSet:EulerTrackSet
  track:euler.x
  track:euler.y
  track:euler.z
trackSet:XfoTrackSet
ClipValues:{ 
  ScalarTrackSet=+0.439575 
  Vec2TrackSet={x:+1.17588e-3,y:+0.846923} 
  Vec3TrackSet={x:+0.951416,y:+0.729003,z:+0.061187} 
  Vec4TrackSet={x:+0.092971,y:+0.381774,z:+0.863403,t:+0.494201} 
  QuatTrackSet={v:{x:+0.243927,y:+0.243988,z:+0.663818},w:+0.663574} 
  EulerTrackSet={v:{x:+0.051864,y:+0.332763,z:+0.228302},w:+0.913452} 
  XfoTrackSet={tr:{x:+0.0,y:+0.0,z:+0.0},ori:{v:{x:+0.0,y:+0.0,z:+0.0},w:+1.0},sc:{x:+1.0,y:+1.0,z:+1.0}} 
}
ClipValues:{ 
  ScalarTrackSet=-0.290832 
  Vec2TrackSet={x:-0.718505,y:+0.0941} 
  Vec3TrackSet={x:+0.18634,y:-2.833557e-2,z:-0.660034} 
  Vec4TrackSet={x:-0.638671,y:-0.352661,z:+0.103652,t:-0.232086} 
  QuatTrackSet={v:{x:-0.695312,y:-0.711547,z:+0.087371},w:+0.052406} 
  EulerTrackSet={v:{x:-0.210479,y:-0.048934,z:-0.092727},w:+0.971923} 
  XfoTrackSet={tr:{x:+0.0,y:+0.0,z:+0.0},ori:{v:{x:+0.0,y:+0.0,z:+0.0},w:+1.0},sc:{x:+1.0,y:+1.0,z:+1.0}} 
}
ClipValues:{ 
  ScalarTrackSet=-2.32666 
  Vec2TrackSet={x:-2.722168,y:-2.008789} 
  Vec3TrackSet={x:-1.95288,y:-2.144531,z:-2.668457} 
  Vec4TrackSet={x:-2.678222,y:-2.400879,z:-2.020019,t:-2.255371} 
  QuatTrackSet={v:{x:-0.540039,y:-0.549072,z:-0.441528},w:-0.460388} 
  EulerTrackSet={v:{x:-0.454589,y:+0.230987,z:-0.495239},w:-0.703369} 
  XfoTrackSet={tr:{x:+0.0,y:+0.0,z:+0.0},ori:{v:{x:+0.0,y:+0.0,z:+0.0},w:+1.0},sc:{x:+1.0,y:+1.0,z:+1.0}} 
}
ClipValues:{ 
  ScalarTrackSet=-5.146484 
  Vec2TrackSet={x:-5.492187,y:-4.93164} 
  Vec3TrackSet={x:-4.932617,y:-5.088867,z:-5.445312} 
  Vec4TrackSet={x:-5.502929,y:-5.239258,z:-4.975586,t:-5.055664} 
  QuatTrackSet={v:{x:-0.51184,y:-0.520385,z:-0.474243},w:-0.492309} 
  EulerTrackSet={v:{x:-0.136779,y:-0.60437,z:-0.166961},w:-0.766967} 
  XfoTrackSet={tr:{x:+0.0,y:+0.0,z:+0.0},ori:{v:{x:+0.0,y:+0.0,z:+0.0},w:+1.0},sc:{x:+1.0,y:+1.0,z:+1.0}} 
}
ClipValues:{ 
  ScalarTrackSet=-7.921875 
  Vec2TrackSet={x:-8.208984,y:-7.831054} 
  Vec3TrackSet={x:-7.899414,y:-8.011719,z:-8.169922} 
  Vec4TrackSet={x:-8.285156,y:-8.037109,z:-7.912109,t:-7.808594} 
  QuatTrackSet={v:{x:-0.502563,y:-0.511718,z:-0.483093},w:-0.502197} 
  EulerTrackSet={v:{x:+0.695556,y:-1.838684e-2,z:+0.684814},w:+0.216461} 
  XfoTrackSet={tr:{x:+0.0,y:+0.0,z:+0.0},ori:{v:{x:+0.0,y:+0.0,z:+0.0},w:+1.0},sc:{x:+1.0,y:+1.0,z:+1.0}} 
}

*/

Clip Clip Clip IClip IClip Clip->IClip FbxClip FbxClip FbxClip->Clip

Members

String name  
ITrackSet[String] trackSets  
Integer[][] keyIndices  

Methods

  Clip ( in Clip other )
  Clip ( in String name )
  Clip ()
  addTrackSet ! ( in ITrackSet trackSet )
ITrackSet addTrackSet ! ( in String name, in Color color, in Scalar defaultValue, in UInt32 flags )
ITrackSet addTrackSet ! ( in String name, in Euler defaultValue, in UInt32 flags )
  addTrackSet ! ( in String name, in ITrackSet trackSet )
ITrackSet addTrackSet ! ( in String name, in Quat defaultValue, in UInt32 flags )
ITrackSet addTrackSet ! ( in String name, in Vec2 defaultValue, in UInt32 flags )
ITrackSet addTrackSet ! ( in String name, in Vec3 defaultValue, in UInt32 flags )
ITrackSet addTrackSet ! ( in String name, in Vec4 defaultValue, in UInt32 flags )
ITrackSet addTrackSet ! ( in String name, in Xfo defaultValue, in UInt32 flags )
Clip clone ? ()
IClipValues evaluate ! ( in Scalar time )
IClipValues evaluate ? ( in Scalar time, io Integer keyIndices[][] )
String getDesc ? ( in String indent )
String getDesc ? ()
String getName ? ()
UInt32 getNumTrackSets ? ()
Vec2 getTimeRange ? ()
ITrackSet getTrackSet ? ( in String name )
String[] getTrackSetNames ? ()
Boolean hasTrackSet ? ( in String name )
  setTrackSet ! ( in String name, in ITrackSet trackSet )

Methods in detail

Clip ( in Clip other )

copy constructor


Clip ( in String name )


Clip ()

default constructor


Clip.addTrackSet! ( in ITrackSet trackSet )

Adds an existing trackSets to the clip.

trackSet The trackSet to add.


ITrackSet Clip.addTrackSet! ( in String name, in Color color, in Scalar defaultValue, in UInt32 flags )

Adds a new Scalar trackSet to the clip.


ITrackSet Clip.addTrackSet! ( in String name, in Euler defaultValue, in UInt32 flags )

Adds a new Euler trackSet to the clip.


Clip.addTrackSet! ( in String name, in ITrackSet trackSet )

Adds an existing trackSets to the clip with a given name. This enables generating a clip using existing track sets that map to a different set of controls.

name The name to use for the trackSet in this clip.
trackSet The trackSet to add.


ITrackSet Clip.addTrackSet! ( in String name, in Quat defaultValue, in UInt32 flags )

Adds a new Quat trackSet to the clip.


ITrackSet Clip.addTrackSet! ( in String name, in Vec2 defaultValue, in UInt32 flags )

Adds a new Vec2 trackSet to the clip.


ITrackSet Clip.addTrackSet! ( in String name, in Vec3 defaultValue, in UInt32 flags )

Adds a new Vec3 trackSet to the clip.


ITrackSet Clip.addTrackSet! ( in String name, in Vec4 defaultValue, in UInt32 flags )

Adds a new Vec4 trackSet to the clip.


ITrackSet Clip.addTrackSet! ( in String name, in Xfo defaultValue, in UInt32 flags )

Adds a new Xfo trackSet to the clip.


Clip Clip.clone? ()

clone method


IClipValues Clip.evaluate! ( in Scalar time )


IClipValues Clip.evaluate? ( in Scalar time, io Integer keyIndices[][] )


String Clip.getDesc? ( in String indent )

Generates a Description string of this Clip.

indent The indentation to use when generating the string.


String Clip.getDesc? ()

Generates a Description string of this Clip.


String Clip.getName? ()


UInt32 Clip.getNumTrackSets? ()


Vec2 Clip.getTimeRange? ()

Returns the timerange defined by the first and last key in each track in the stored track sets.


ITrackSet Clip.getTrackSet? ( in String name )


String[] Clip.getTrackSetNames? ()


Boolean Clip.hasTrackSet? ( in String name )


Clip.setTrackSet! ( in String name, in ITrackSet trackSet )