KeyframeTrackSet (object)¶
A collection of tracks driving a single value.
The KeyframeTrackSet groups a collection of tracks together to drive the value of
a Math
type, such as Scalar, Vec2, :kl-ref:`Vec3
, Vec4, Quat, Euler or Xfo. A KeyframeTrackSet can
contain zero or many tracks, each generated based on the specified Math type.
KeyframeTrackSets are often bundled into Clips, which group together many values into a container that can drive the animation of a character.
参考
/*
** Example: keyframeTrackSet.kl
*/
require Animation;
operator entry(){
KeyframeTrackSet vec3TrackSet = KeyframeTrackSet('Vec3TrackSet', Vec3(0.4, 1.2, 2.4), 0);
vec3TrackSet.setTrackValues(0.0, Vec3(0.0, 0.0, 0.0));
vec3TrackSet.setTrackValues(3.0, Vec3(1.0, 2.0, 0.0));
vec3TrackSet.setTrackValues(7.0, Vec3(0.0, 2.0, 3.0));
Integer keyIndices[];
Vec3 value;
for(Integer i=0; i<=20; i++){
Scalar time = Math_linearInterpolate(0.0, 4.0, Scalar(i)/20.0);
vec3TrackSet.evaluate(time, value, keyIndices);
report("time:" + time + " value:" + value);
}
}
/*
** Output:
time:+0.0 value:{x:+0.0,y:+0.0,z:+0.0}
time:+0.2 value:{x:+0.066666,y:+0.133333,z:+0.0}
time:+0.4 value:{x:+0.133333,y:+0.266666,z:+0.0}
time:+0.6 value:{x:+0.2,y:+0.4,z:+0.0}
time:+0.8 value:{x:+0.266666,y:+0.533333,z:+0.0}
time:+1.0 value:{x:+0.333333,y:+0.666666,z:+0.0}
time:+1.2 value:{x:+0.4,y:+0.8,z:+0.0}
time:+1.4 value:{x:+0.466666,y:+0.933333,z:+0.0}
time:+1.6 value:{x:+0.533333,y:+1.066666,z:+0.0}
time:+1.8 value:{x:+0.599999,y:+1.199999,z:+0.0}
time:+2.0 value:{x:+0.666666,y:+1.333333,z:+0.0}
time:+2.2 value:{x:+0.733333,y:+1.466666,z:+0.0}
time:+2.4 value:{x:+0.8,y:+1.6,z:+0.0}
time:+2.6 value:{x:+0.866666,y:+1.733333,z:+0.0}
time:+2.8 value:{x:+0.933333,y:+1.866666,z:+0.0}
time:+3.0 value:{x:+1.0,y:+2.0,z:+0.0}
time:+3.2 value:{x:+0.95,y:+2.0,z:+0.15}
time:+3.4 value:{x:+0.9,y:+2.0,z:+0.3}
time:+3.6 value:{x:+0.85,y:+2.0,z:+0.449999}
time:+3.8 value:{x:+0.8,y:+2.0,z:+0.599999}
time:+4.0 value:{x:+0.75,y:+2.0,z:+0.75}
*/
Members¶
String | name | |
String | valueType | |
UInt32 | flags | |
KeyframeTrack[] | tracks |
Methods¶
KeyframeTrackSet ( in KeyframeTrackSet other ) | |
KeyframeTrackSet ( in String name, in Color color, in Scalar defaultValue, in UInt32 flags ) | |
KeyframeTrackSet ( in String name, in Euler defaultValue, in UInt32 flags ) | |
KeyframeTrackSet ( in String name, in Quat defaultValue, in UInt32 flags ) | |
KeyframeTrackSet ( in String name, in UInt32 flags ) | |
KeyframeTrackSet ( in String name, in Vec2 defaultValue, in UInt32 flags ) | |
KeyframeTrackSet ( in String name, in Vec3 defaultValue, in UInt32 flags ) | |
KeyframeTrackSet ( in String name, in Vec4 defaultValue, in UInt32 flags ) | |
KeyframeTrackSet ( in String name, in Xfo defaultValue, in UInt32 flags ) | |
KeyframeTrackSet () | |
addTrack ! ( in IKeyframeTrack track ) | |
Integer | addTrack ! ( in String name, in Color color, in Scalar defaultValue ) |
clear ! () | |
clearTracks ! () | |
KeyframeTrackSet | clone ? () |
evaluate ? ( in Scalar time, out Euler value, out Integer keyIndices[] ) | |
evaluate ? ( in Scalar time, out Quat value, out Integer keyIndices[] ) | |
evaluate ? ( in Scalar time, out Scalar value, out Integer keyIndices[] ) | |
evaluate ? ( in Scalar time, out Scalar values[], out Integer keyIndices[] ) | |
evaluate ? ( in Scalar time, out Vec2 value, out Integer keyIndices[] ) | |
evaluate ? ( in Scalar time, out Vec3 value, out Integer keyIndices[] ) | |
evaluate ? ( in Scalar time, out Vec4 value, out Integer keyIndices[] ) | |
evaluate ? ( in Scalar time, out Xfo value, out Integer keyIndices[] ) | |
Integer | findTrack ? ( in String name ) |
String | getDesc ? ( in String indent, in Boolean includeTracks ) |
String | getDesc ? () |
UInt32 | getFlags ? () |
String | getName ? () |
UInt32 | getNumTracks ? () |
Vec2 | getTimeRange ? () |
IKeyframeTrack | getTrack ? ( in String name ) |
IKeyframeTrack | getTrack ? ( in UInt32 index ) |
String[] | getTrackNames ? () |
String | getValueType ? () |
setFlag ! ( in UInt32 flag ) | |
setTrack ! ( in String name, in IKeyframeTrack track ) | |
setTrackValues ! ( in Scalar time, in Quat value ) | |
setTrackValues ! ( in Scalar time, in Scalar value ) | |
setTrackValues ! ( in Scalar time, in Vec2 value ) | |
setTrackValues ! ( in Scalar time, in Vec3 value ) | |
setTrackValues ! ( in Scalar time, in Vec4 value ) | |
setTrackValues ! ( in Scalar time, in Xfo value ) | |
Boolean | testFlag ? ( in UInt32 flag ) |
Methods in detail¶
KeyframeTrackSet ( in KeyframeTrackSet other )
copy constructor
KeyframeTrackSet ( in String name, in Color color, in Scalar defaultValue, in UInt32 flags )
Constructs a new KeyframeTrackSet using the given name, and initializing the tracks with the given Scalar value. For a Scalar value, only a single track will be generated in the track set, and the color of that track will be set using the provided value.
name | The name of the track set, and the single contrained track. |
color | The color of the single track |
defaultValue | The value to use to generate the tracks. |
flags | The flags value will be used to determine how the tracks should be generated. |
KeyframeTrackSet ( in String name, in Euler defaultValue, in UInt32 flags )
Constructs a new KeyframeTrackSet using the given name, and initializing the tracks with the given Euler value. This value will be used to generate the number of tracks, thier names, and thier default values.
name | The name of the track set |
defaultValue | The value to use to generate the tracks. |
flags | The flags value will be used to determine how the tracks should be generated. |
KeyframeTrackSet ( in String name, in Quat defaultValue, in UInt32 flags )
Constructs a new KeyframeTrackSet using the given name, and initializing the tracks with the given Quat value. This value will be used to generate the number of tracks, thier names, and thier default values.
name | The name of the track set |
defaultValue | The value to use to generate the tracks. |
flags | The flags value will be used to determine how the tracks should be generated. |
KeyframeTrackSet ( in String name, in UInt32 flags )
Constructs a new empty KeyframeTrackSet.
name | The name of the KeyframeTrackSet. |
flags | The given flags value to use. |
KeyframeTrackSet ( in String name, in Vec2 defaultValue, in UInt32 flags )
Constructs a new KeyframeTrackSet using the given name, and initializing the tracks with the given Vec2 value. This value will be used to generate the number of tracks, thier names, and thier default values.
name | The name of the track set |
defaultValue | The value to use to generate the tracks. |
flags | The flags value will be used to determine how the tracks should be generated. |
KeyframeTrackSet ( in String name, in Vec3 defaultValue, in UInt32 flags )
Constructs a new KeyframeTrackSet using the given name, and initializing the tracks with the given Vec3 value. This value will be used to generate the number of tracks, thier names, and thier default values.
name | The name of the track set |
defaultValue | The value to use to generate the tracks. |
flags | The flags value will be used to determine how the tracks should be generated. |
KeyframeTrackSet ( in String name, in Vec4 defaultValue, in UInt32 flags )
Constructs a new KeyframeTrackSet using the given name, and initializing the tracks with the given Vec4 value. This value will be used to generate the number of tracks, thier names, and thier default values.
name | The name of the track set |
defaultValue | The value to use to generate the tracks. |
flags | The flags value will be used to determine how the tracks should be generated. |
KeyframeTrackSet ( in String name, in Xfo defaultValue, in UInt32 flags )
Constructs a new KeyframeTrackSet using the given name, and initializing the tracks with the given Xfo value. This value will be used to generate the number of tracks, thier names, and thier default values.
name | The name of the track set |
defaultValue | The value to use to generate the tracks. |
flags | The flags value will be used to determine how the tracks should be generated. |
default constructor
KeyframeTrackSet.addTrack! ( in IKeyframeTrack track )
Adds a new track to the track set.
track | the new track to add |
Integer KeyframeTrackSet.addTrack! ( in String name, in Color color, in Scalar defaultValue )
Adds a new track to the KeyframeTrackSet
name | The name the track will be found under in the tracks set. |
color | The color of the new track. |
defaultValue | The default value to assign the track. |
KeyframeTrackSet.clear! ()
clears the content of the KeyframeTrack
KeyframeTrackSet.clearTracks! ()
Removes all tracks in the KeyframeTrackSet.
KeyframeTrackSet KeyframeTrackSet.clone? ()
clone method
KeyframeTrackSet.evaluate? ( in Scalar time, out Euler value, out Integer keyIndices[] )
Evaluates a single track into the given Euler value.
注釈
this method should be used on a KeyframeTrackSet created using a Euler value.
time | the time at which to evaluate the track. |
value | The value that will contain the result of the track evaluations |
keyIndices | the cache of key indices used to accelerate subsequent track evaluations. |
KeyframeTrackSet.evaluate? ( in Scalar time, out Quat value, out Integer keyIndices[] )
Evaluates a single track into the given Quat value.
注釈
this method should be used on a KeyframeTrackSet created using a Quat value.
time | the time at which to evaluate the track. |
value | The value that will contain the result of the track evaluations |
keyIndices | the cache of key indices used to accelerate subsequent track evaluations. |
KeyframeTrackSet.evaluate? ( in Scalar time, out Scalar value, out Integer keyIndices[] )
Evaluates a single track into the given Scalar value.
注釈
this method should be used on a KeyframeTrackSet created using a Scalar value.
time | the time at which to evaluate the track. |
value | The value that will contain the result of the track evaluation |
keyIndices | the cache of key indices used to accelerate subsequent track evaluations. |
KeyframeTrackSet.evaluate? ( in Scalar time, out Scalar values[], out Integer keyIndices[] )
Evaluates a single track into the given Scalar values.
time | the time at which to evaluate the track. |
value | The values that will contain the result of the track evaluations |
keyIndices | the cache of key indices used to accelerate subsequent track evaluations. |
KeyframeTrackSet.evaluate? ( in Scalar time, out Vec2 value, out Integer keyIndices[] )
Evaluates a single track into the given Vec2 value.
注釈
this method should be used on a KeyframeTrackSet created using a Vec2 value.
time | the time at which to evaluate the track. |
value | The value that will contain the result of the track evaluations |
keyIndices | the cache of key indices used to accelerate subsequent track evaluations. |
KeyframeTrackSet.evaluate? ( in Scalar time, out Vec3 value, out Integer keyIndices[] )
Evaluates a single track into the given Vec3 value.
注釈
this method should be used on a KeyframeTrackSet created using a Vec3 value.
time | the time at which to evaluate the track. |
value | The value that will contain the result of the track evaluations |
keyIndices | the cache of key indices used to accelerate subsequent track evaluations. |
KeyframeTrackSet.evaluate? ( in Scalar time, out Vec4 value, out Integer keyIndices[] )
Evaluates a single track into the given Vec4 value.
注釈
this method should be used on a KeyframeTrackSet created using a Vec4 value.
time | the time at which to evaluate the track. |
value | The value that will contain the result of the track evaluations |
keyIndices | the cache of key indices used to accelerate subsequent track evaluations. |
KeyframeTrackSet.evaluate? ( in Scalar time, out Xfo value, out Integer keyIndices[] )
Evaluates a single track into the given Xfo value.
注釈
this method should be used on a KeyframeTrackSet created using a Xfo value.
time | the time at which to evaluate the track. |
value | The value that will contain the result of the track evaluations |
keyIndices | the cache of key indices used to accelerate subsequent track evaluations. |
Integer KeyframeTrackSet.findTrack? ( in String name )
find a track by name, returning the track index.
the | name of the track to search for. |
String KeyframeTrackSet.getDesc? ( in String indent, in Boolean includeTracks )
Generates a Description string of this KeyframeTrackSet.
indent | The indentation to use when generating the string. |
String KeyframeTrackSet.getDesc? ()
Generates a Description string of this KeyframeTrackSet.
UInt32 KeyframeTrackSet.getFlags? ()
Returns the flags value of the KeyframeTrackSet
String KeyframeTrackSet.getName? ()
Returns the name of the KeyframeTrackSet.
UInt32 KeyframeTrackSet.getNumTracks? ()
Returns the number of tracks stored in the KeyframeTrackSet
Vec2 KeyframeTrackSet.getTimeRange? ()
Returns the time range defined by the first and last key in each track.
IKeyframeTrack KeyframeTrackSet.getTrack? ( in String name )
Returns a track by name
IKeyframeTrack KeyframeTrackSet.getTrack? ( in UInt32 index )
Returns a track by index.
String[] KeyframeTrackSet.getTrackNames? ()
Returns an array of the names of the track sets in the clip.
String KeyframeTrackSet.getValueType? ()
Returns the value type of this KeyframeTrackSet. can be generated from the KeyframeTrackSet. e.g. ‘Vec3‘, ‘Euler‘, ‘Xfo‘
注釈
The value type is a string giving the name of the data type that
KeyframeTrackSet.setFlag! ( in UInt32 flag )
Sets a binary flag to store with the track set.
flag | the flag to set |
KeyframeTrackSet.setTrack! ( in String name, in IKeyframeTrack track )
Replaces an existing track with a new track.
name | The name of the track to replace. Generates an error if the name does not match any existing tracks. |
track | The track to replace the existing one. |
KeyframeTrackSet.setTrackValues! ( in Scalar time, in Quat value )
Sets the values of the contained tracks using the given value.
注釈
This method is used to generate keyframes on the tracks, or update existing keys if keys already exist at the given time
time | The time to set the new value |
value | The value to set on the tracks |
KeyframeTrackSet.setTrackValues! ( in Scalar time, in Scalar value )
Sets the values of the contained tracks using the given value.
注釈
This method is used to generate keyframes on the tracks, or update existing keys if keys already exist at the given time
time | The time to set the new value |
value | The value to set on the tracks |
KeyframeTrackSet.setTrackValues! ( in Scalar time, in Vec2 value )
Sets the values of the contained tracks using the given value.
注釈
This method is used to generate keyframes on the tracks, or update existing keys if keys already exist at the given time
time | The time to set the new value |
value | The value to set on the tracks |
KeyframeTrackSet.setTrackValues! ( in Scalar time, in Vec3 value )
Sets the values of the contained tracks using the given value.
注釈
This method is used to generate keyframes on the tracks, or update existing keys if keys already exist at the given time
time | The time to set the new value |
value | The value to set on the tracks |
KeyframeTrackSet.setTrackValues! ( in Scalar time, in Vec4 value )
Sets the values of the contained tracks using the given value.
注釈
This method is used to generate keyframes on the tracks, or update existing keys if keys already exist at the given time
time | The time to set the new value |
value | The value to set on the tracks |
KeyframeTrackSet.setTrackValues! ( in Scalar time, in Xfo value )
Sets the values of the contained tracks using the given value.
注釈
This method is used to generate keyframes on the tracks, or update existing keys if keys already exist at the given time
time | The time to set the new value |
value | The value to set on the tracks |
Boolean KeyframeTrackSet.testFlag? ( in UInt32 flag )
Tests the binary flags in the track set against the given flags value