About
A CTrack represents an animation track of a parameter of an object in Cinema 4D. The tracks are stored with the animated object and contain curves and keys.
CTrack objects are an instance of CTbase
.
if (track == nullptr)
{
if (track == nullptr)
stage->InsertTrackSorted(track);
}
if (curve == nullptr)
if (key1 == nullptr)
{
}
if (key2 == nullptr)
{
}
Access
The animation tracks of an object's parameters are stored with the object itself:
- Note
- The keyframe selection is defined with the BaseList2D class, see BaseList2D Manual.
while (track != nullptr)
{
}
Allocation/Deallocation
A CTrack can be created with the usual tools:
A newly created CTrack must be added to a host object:
if (track == nullptr)
{
if (track == nullptr)
track->
SetName(
"My New Animation Track"_s);
obj->InsertTrackSorted(track);
}
To create special tracks the ID of that special track must be used. The special tracks are:
if (soundTrack == nullptr)
soundTrack->
SetName(
"New Sound Track"_s);
obj->InsertTrackSorted(soundTrack);
if (plaTrack == nullptr)
if (curve == nullptr)
if (key1 == nullptr)
plaTrack->
FillKey(doc, polyObject, key1);
for (
Int32 i = 0; i < count; ++i)
points[i] = points[i] +
Vector(0, 100.0 * random.
Get01(), 0.0);
if (key2 == nullptr)
plaTrack->
FillKey(doc, polyObject, key2);
Navigation
CTrack objects are stored in a list:
while (track != nullptr)
{
}
- Note
- The GeListHead object that is the parent of the tracks can be obtained with BaseList2D::GetCTrackRoot().
Read-Only Properties
Several values can be read from a CTrack:
The track categories are:
See also CKey Value.
Properties
Parameters
The parameters of a track can be edited as usual with C4DAtom::SetParameter() and C4DAtom::GetParameter(). The parameter IDs are defined in ctbase.h
.
const Vector red { 1.0, 0, 0 };
Selection
In Cinema 4D there can be up to four timeline windows. An animation track can be selected in one or multiple of these windows. The selection state is stored as a bit:
if (curve)
{
if (keyCount == 0)
else
}
See also CKey Selection.
Description ID
The parameter animated using a certain track is defined with its DescID. This DescID can be accessed:
if (track == nullptr)
GeListHead*
const trackRoot = obj->GetCTrackRoot();
if (trackRoot == nullptr)
if (clone == nullptr)
Loop Settings
The loop settings define how an animation track should behave before the first key and after the last key.
The loop types are:
Points in time beyond the defined animation track can be mapped into time inside the track.
- CTrack::Remap(): Remaps the given time into a position inside the animation track.
for (
Float64 t = 0.0; t < 10.0; t = t + 0.1)
{
track->
Remap(t, &remapTime, &cycle);
}
Time Track
The behavior of an animation track depends on the current time which is typically the current time of the BaseDocument. But the time that controls a track can be also defined with a time track.
if (timeTrack == nullptr)
while (track != nullptr)
{
}
Timeline Height
An animation track can be displayed in a Timeline window.
Track Information
An animation track can provide additional information for each key or the current time in form of a String.
Synchronisation
Multiple tracks can be synchronized. Typically this applies to tracks of the components of a Vector parameter.
Functionality
Since a track might be displayed in the GUI (Timeline window) it can draw an image:
Further utility functions are:
See also CCurve Manual.
Further Reading
static String FloatToString(Float32 v, Int32 vvk=-1, Int32 nnk=-3)
Definition: c4d_string.h:529
@ OK
Image loaded/created.
static CTrack * Alloc(BaseList2D *bl, const DescID &id)
Definition: c4d_basetime.h:24
IMAGERESULT Init(Int32 w, Int32 h, Int32 bits)
C4DAtom * GetClone(COPYFLAGS flags, AliasTrans *trn)
Definition: c4d_baselist.h:1447
Definition: lib_description.h:328
Bool ChangeNBit(NBIT bit, NBITCONTROL bitmode)
@ VECTOR_X
X component.
Definition: lib_description.h:268
const CKey * GetKey(Int32 index) const
Definition: c4d_canimation.h:377
maxon::Float Float
Definition: ge_sys_math.h:66
@ DTYPE_BASELISTLINK
BaseLink.
Definition: lib_description.h:74
void SetTimeTrack(CTrack *track)
Definition: c4d_canimation.h:777
void SetAfter(CLOOP type)
Definition: c4d_canimation.h:759
@ ID_CTRACK_FCURVE_COLOR
Definition: ctbase.h:10
Definition: c4d_canimation.h:354
const DescID & GetDescriptionID() const
Definition: c4d_canimation.h:722
@ ID_BASEOBJECT_REL_POSITION
Definition: obase.h:15
void InsertTrackSorted(CTrack *track)
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
#define CTtime
Time.
Definition: ge_prepass.h:1358
CTrack * FindCTrack(const DescID &id)
CKey * AddKey(const BaseTime &time, Int32 *nidx=nullptr, Bool bUndo=false, Bool SynchronizeKeys=false)
Definition: c4d_canimation.h:412
@ VECTOR_Y
Y component.
Definition: lib_description.h:269
Definition: c4d_canimation.h:659
void SetBefore(CLOOP type)
Definition: c4d_canimation.h:747
Float GetValue(BaseDocument *doc, const BaseTime &time)
Definition: c4d_canimation.h:844
#define CTpla
PLA.
Definition: ge_prepass.h:1355
void BeginDraw()
Must be called before any drawing functions.
#define MSG_UPDATE
Must be sent if the bounding box has to be recalculated. (Otherwise use MSG_CHANGE....
Definition: c4d_baselist.h:340
Definition: c4d_string.h:38
Bool FillKey(BaseDocument *doc, BaseList2D *bl, CKey *key)
Definition: c4d_canimation.h:810
@ OFFSETREPEAT
Offset repeat.
Bool SetParameter(const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
CTrack * GetNext() const
Definition: c4d_canimation.h:705
BaseTime GetTime(void) const
@ DTYPE_VECTOR
Vector
Definition: lib_description.h:70
Represents a level within a DescID.
Definition: lib_description.h:287
void SetGeData(CCurve *seq, const GeData &d)
Definition: c4d_canimation.h:170
Int32 GetTrackCategory() const
Definition: c4d_canimation.h:830
void SetBaseList2D(BaseList2D *bl)
Definition: c4d_gedata.h:657
Definition: c4d_gedata.h:82
void SetName(const maxon::String &name)
Definition: c4d_baselist.h:2354
maxon::Int32 Int32
Definition: ge_sys_math.h:60
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:210
Bool Message(Int32 type, void *data=nullptr)
Definition: c4d_baselist.h:1424
Definition: c4d_canimation.h:57
Bool ShowBitmap(const Filename &fn)
Bool TrackInformation(BaseDocument *doc, CKey *key, maxon::String *str, Bool set)
Definition: c4d_canimation.h:885
void InsertLast(GeListNode *bn)
Definition: c4d_baselist.h:2095
@ CID_SOUND_NAME
Definition: ctsound.h:7
@ ID_CTRACK_USE_PREF
Definition: ctbase.h:38
maxon::Vec3< maxon::Float64, 1 > Vector
Definition: ge_math.h:145
Bool Draw(GeClipMap *map, const BaseTime &clip_left, const BaseTime &clip_right) const
Definition: c4d_canimation.h:801
@ STAGEOBJECT_CLINK
Definition: ostage.h:6
#define CTRACK_CATEGORY_VALUE
Value track.
Definition: c4d_canimation.h:622
Definition: ge_autoptr.h:36
Bool Remap(Float64 time, Float64 *ret_time, Int32 *ret_cycle) const
Definition: c4d_canimation.h:874
@ TL1_SELECT
Selection bit for Timeline 1.
void EndDraw()
Must be called after a sequence of drawing functions to free the memory allocated by BeginDraw().
Definition: c4d_tools.h:811
String GetName() const
Definition: c4d_baselist.h:2348
@ DTYPE_REAL
Float
Definition: lib_description.h:68
CCurve * GetCurve(CCURVE type=CCURVE::CURVE, Bool bCreate=true)
Definition: c4d_canimation.h:824
CTrack * GetFirstCTrack()
Definition: c4d_baselist.h:2010
#define MAXON_SCOPE
Definition: apibase.h:2798
Bool SetDescriptionID(BaseList2D *object, const DescID &id)
Definition: c4d_canimation.h:730
Int32 GetKeyCount(void) const
Definition: c4d_canimation.h:370
maxon::Float64 Float64
Definition: ge_sys_math.h:67
#define CTsound
Sound.
Definition: ge_prepass.h:1356