CTrack Class Reference

#include <c4d_canimation.h>

Inheritance diagram for CTrack:

Detailed Description

Represents an animation track.
Contains curves holding keys.
Example: Creating Align to Spline tag and adding track with 2 keys:

// Add align to spline tag to object
BaseTag* tag = op->MakeTag(Taligntospline);
if (tag)
{
// Allocate track for align to spline tag
if (track)
{
// Add track to align to spline tag
tag->InsertTrackSorted(track);
// Get track curve
CCurve* curve = track->GetCurve();
if (curve!=nullptr)
{
// Add first key
CKey* key = curve->AddKey(BaseTime(0.0));
key->SetValue(curve, 0.0);
// Add second key
key = curve->AddKey(BaseTime(1.0));
key->SetValue(curve, 0.9);
}
}
}
PyObject * key
Definition: abstract.h:289
void InsertTrackSorted(CTrack *track)
Definition: c4d_basetag.h:52
Definition: c4d_basetime.h:25
Definition: c4d_canimation.h:366
CKey * AddKey(const BaseTime &time, Int32 *nidx=nullptr, Bool bUndo=false, Bool SynchronizeKeys=false)
Definition: c4d_canimation.h:423
Represents a key in the CCurve of a track which represent the animation of a parameter.
Definition: c4d_canimation.h:58
Definition: c4d_canimation.h:671
static CTrack * Alloc(BaseList2D *bl, const DescID &id)
CCurve * GetCurve(CCURVE type=CCURVE::CURVE, Bool bCreate=true)
Definition: c4d_canimation.h:835
#define Taligntospline
Align to spline.
Definition: ge_prepass.h:1439
#define ConstDescID(...)
Definition: lib_description.h:594
PyObject * op
Definition: object.h:520
Represents a level within a DescID.
Definition: lib_description.h:298
@ ALIGNTOSPLINETAG_POSITION
Definition: taligntospline.h:9
Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Private Member Functions

 CTrack ()
 
 ~CTrack ()
 

Alloc/Free

static CTrackAlloc (BaseList2D *bl, const DescID &id)
 
static void Free (CTrack *&bl)
 

Navigation

CTrackGetNext () const
 
CTrackGetPred () const
 

Description ID

const DescIDGetDescriptionID () const
 
Bool SetDescriptionID (BaseList2D *object, const DescID &id)
 

Before/After Loop

CLOOP GetBefore () const
 
void SetBefore (CLOOP type)
 
CLOOP GetAfter () const
 
void SetAfter (CLOOP type)
 

Time Track

CTrackGetTimeTrack (BaseDocument *doc)
 
void SetTimeTrack (CTrack *track)
 

Miscellaneous

Bool AnimateTrack (const BaseDocument *doc, BaseList2D *op, const BaseTime &tt, ANIMATEFLAGS flags, Bool *chg, void *data=nullptr)
 
Bool Animate (const CAnimInfo *info, Bool *chg, void *data=nullptr)
 
Bool Draw (GeClipMap *map, const BaseTime &clip_left, const BaseTime &clip_right) const
 
Bool FillKey (BaseDocument *doc, BaseList2D *bl, CKey *key)
 
void FlushData ()
 
CCurveGetCurve (CCURVE type=CCURVE::CURVE, Bool bCreate=true)
 
const CCurveGetCurve (CCURVE type=CCURVE::CURVE) const
 
Int32 GetTrackCategory () const
 
const BaseList2DGetObject () const
 
BaseList2DGetObject ()
 
Float GetValue (const BaseDocument *doc, const BaseTime &time) const
 
Int32 GetUnit (Float *step)
 
const BaseContainerGetParameterDescription (BaseContainer &temp) const
 
Int32 GuiMessage (const BaseContainer &msg, BaseContainer &result)
 
Bool Remap (Float64 time, Float64 *ret_time, Int32 *ret_cycle) const
 
Bool TrackInformation (BaseDocument *doc, CKey *key, maxon::String *str, Bool set)
 
CURVEINTERPOLATION_MODE GetEvaluationMode () const
 
void SetEvaluationMode (CURVEINTERPOLATION_MODE mode)
 
void SetLambda (maxon::Delegate< Float(const BaseDocument *doc, BaseList2D *op, const BaseTime &tt, ANIMATEFLAGS flags, Bool *chg, void *data)> lambdaFn)
 
Bool HasLambda () const
 
void ClearLambda ()
 
GeData GetAnimatedGeData (const BaseDocument *doc, BaseList2D *op, const BaseTime &time) const
 

height

Int32 GetHeight () const
 
Int32 GetTLHeight (Int32 id) const
 
void SetTLHeight (Int32 id, Int32 size)
 

Synchronization

Bool IsSynchronized () const
 
void SetSynchronized (Bool synch)
 

Additional Inherited Members

- Public Member Functions inherited from BaseList2D
void SetBit (Int32 mask)
 
Bool GetBit (Int32 mask) const
 
void DelBit (Int32 mask)
 
void ToggleBit (Int32 mask)
 
Int32 GetAllBits () const
 
void SetAllBits (Int32 bits)
 
void SetBitEx (Int32 mask, Int32 flags)
 
const CharGetViewportRenderId (VIEWPORT_RENDER_ID typeId) const
 
BaseList2DGetNext ()
 
const BaseList2DGetNext () const
 
BaseList2DGetPred ()
 
const BaseList2DGetPred () const
 
BaseContainer GetData ()
 
void SetData (const BaseContainer &bc, Bool add=true)
 
const BaseContainerGetDataInstanceRef () const
 
BaseContainerGetDataInstanceRef ()
 
const BaseContainerGetDataInstance () const
 
BaseContainerGetDataInstance ()
 
String GetName () const
 
void SetName (const maxon::String &name, Bool setDirty=true)
 
String GetBubbleHelp ()
 
Bool TransferGoal (BaseList2D *dst, Bool undolink)
 
Bool TransferMarker (BaseList2D *dst) const
 
Bool CopyDynamicDescriptionFrom (const BaseList2D *src)
 
Bool Scale (Float scale)
 
Bool Edit ()
 
void GetIcon (IconData *dat)
 
GeListHeadGetNLARoot (Bool create)
 
BaseList2DAnimationLayerRemap (BaseObject **layer=nullptr)
 
String GetTypeName () const
 
const BaseList2DGetMain () const
 
BaseList2DGetMain ()
 
void InsertTrackSorted (CTrack *track)
 
Bool AddEventNotification (BaseList2D *bl, NOTIFY_EVENT eventid, NOTIFY_EVENT_FLAG flags, const BaseContainer *data)
 
Bool RemoveEventNotification (const BaseDocument *doc, BaseList2D *bl, NOTIFY_EVENT eventid)
 
Bool FindEventNotification (const BaseDocument *doc, BaseList2D *bl, NOTIFY_EVENT eventid)
 
Bool SetDescIDState (const DescID &id, DESCIDSTATE descidstate)
 
DESCIDSTATE GetDescIDState (const DescID &id, Bool tolerant) const
 
GeListHeadGetOverrideRoot (Bool create)
 
BaseOverrideGetFirstOverride ()
 
GeListHeadGetShaderRepositoryRoot (Bool create)
 
GeListHeadGetHiddenShaderRoot (Bool create)
 
maxon::NimbusForwardRef GetNimbusRef (const maxon::Id &spaceId) const
 
maxon::Result< maxon::NimbusForwardRefPrivateGetOrCreateNimbusRef (const maxon::Id &spaceId)
 
void RemoveNimbusRef (const maxon::Id &spaceId)
 
maxon::Result< maxon::HashMap< maxon::Id, maxon::NimbusForwardRef > > GetAllNimbusRefs () const
 
Bool IsNodeBased () const
 
maxon::Result< BoolGetAccessedObjects (METHOD_ID method, AccessedObjectsCallback &access) const
 
maxon::Result< BoolGetAccessedObjectsRec (ACCESSED_OBJECTS_MASK read, ACCESSED_OBJECTS_MASK write, METHOD_ID method, Bool withSiblings, Bool withChildren, AccessedObjectsCallback &access) const
 
maxon::Result< BoolGetAccessedObjectsOfHierarchy (ACCESSED_OBJECTS_MASK read, ACCESSED_OBJECTS_MASK write, METHOD_ID method, AccessedObjectsCallback &access) const
 
maxon::Result< BoolGetAccessedObjectsOfChildren (ACCESSED_OBJECTS_MASK read, ACCESSED_OBJECTS_MASK write, METHOD_ID method, AccessedObjectsCallback &access) const
 
maxon::Result< BoolGetAccessedObjectsOfFirstChildHierarchy (ACCESSED_OBJECTS_MASK read, ACCESSED_OBJECTS_MASK write, METHOD_ID method, AccessedObjectsCallback &access) const
 
maxon::Result< maxon::GenericDataGroupChanges ()
 
void GetMarkerStampEx (UInt32 *l1, UInt32 *l2)
 
const GeMarkerGetMarker () const
 
void SetMarker (const GeMarker &m)
 
Bool AddUniqueID (Int32 appid, const Char *const mem, Int bytes)
 
Bool FindUniqueID (Int32 appid, const Char *&mem, Int &bytes) const
 
Int32 GetUniqueIDCount () const
 
Bool GetUniqueIDIndex (Int32 idx, Int32 &id, const Char *&mem, Int &bytes) const
 
Bool SetAnimatedParameter (const CTrack *track, const DescID &id, const GeData &t_data1, const GeData &t_data2, Float mix, DESCFLAGS_SET flags)
 
Bool GetAnimatedParameter (const DescID &id, GeData &t_data1, GeData &t_data2, Float &mix, DESCFLAGS_GET flags) const
 
BaseShaderGetFirstShader () const
 
void InsertShader (BaseShader *shader, BaseShader *pred=nullptr)
 
void ClearKeyframeSelection ()
 
Bool FindKeyframeSelection (const DescID &id)
 
Bool SetKeyframeSelection (const DescID &id, Bool selection)
 
Bool KeyframeSelectionContent ()
 
LayerObjectGetLayerObject (const BaseDocument *doc)
 
const LayerObjectGetLayerObject (const BaseDocument *doc) const
 
Bool SetLayerObject (const LayerObject *layer)
 
const LayerDataGetLayerData (const BaseDocument *doc, Bool rawdata=false) const
 
Bool SetLayerData (BaseDocument *doc, const LayerData &data)
 
GeListHeadGetCTrackRoot (Bool create)
 
const GeListHeadGetCTrackRoot () const
 
const CTrackGetFirstCTrack () const
 
CTrackGetFirstCTrack ()
 
const CTrackFindCTrack (const DescID &id) const
 
CTrackFindCTrack (const DescID &id)
 
- Public Member Functions inherited from GeListNode
GeListNodeGetNext ()
 
const GeListNodeGetNext () const
 
GeListNodeGetPred ()
 
const GeListNodeGetPred () const
 
GeListNodeGetDown ()
 
const GeListNodeGetDown () const
 
GeListNodeGetUp ()
 
const GeListNodeGetUp () const
 
GeListNodeGetDownLast ()
 
const GeListNodeGetDownLast () const
 
void InsertBefore (GeListNode *bl)
 
void InsertAfter (GeListNode *bl)
 
void InsertUnder (GeListNode *bl)
 
void InsertUnderLast (GeListNode *bl)
 
void Remove ()
 
void FlushChilds ()
 
void MoveChildrenTo (GeListNode *dest)
 
GeListHeadGetListHead ()
 
const GeListHeadGetListHead () const
 
Int32 GetNodeID (Int32 index=0) const
 
template<typename CAST >
const CAST * GetNodeData (Int32 index=0) const
 
template<typename CAST >
CAST * GetNodeData (Int32 index=0)
 
void SetCustomData (GeListNode *node)
 
GeListNodeGetCustomData ()
 
const GeListNodeGetCustomData () const
 
const BaseDocumentGetDocument () const
 
BaseDocumentGetDocument ()
 
maxon::Result< BoolGetBranchInfo (const maxon::ValueReceiver< const BranchInfo & > &info, GETBRANCHINFO flags) const
 
Bool IsDocumentRelated () const
 
Int32 GetInfo () const
 
Bool GetNBit (NBIT bit) const
 
UInt32 GetNBitMask (Int32 index) const
 
Bool ChangeNBit (NBIT bit, NBITCONTROL bitmode)
 
- Public Member Functions inherited from C4DAtomGoal
Bool HasLinks () const
 
- Public Member Functions inherited from C4DAtom
Int32 GetType () const
 
Int32 GetRealType () const
 
Int32 GetDiskType () const
 
Bool IsInstanceOf (Int32 id) const
 
Int32 GetClassification () const
 
Bool Message (Int32 type, void *data=nullptr)
 
Bool MultiMessage (MULTIMSG_ROUTE flags, Int32 type, void *data)
 
C4DAtomGetClone (COPYFLAGS flags, AliasTrans *trn) const
 
Bool CopyTo (C4DAtom *dst, COPYFLAGS flags, AliasTrans *trn) const
 
Bool Read (HyperFile *hf, Int32 id, Int32 level)
 
Bool Write (HyperFile *hf) const
 
Bool ReadObject (HyperFile *hf, Bool readheader)
 
Bool WriteObject (HyperFile *hf) const
 
Bool GetDescription (Description *description, DESCFLAGS_DESC flags) const
 
Bool GetParameter (const DescID &id, GeData &t_data, DESCFLAGS_GET flags) const
 
Bool SetParameter (const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
 
DynamicDescriptionGetDynamicDescriptionWritable ()
 
const DynamicDescriptionGetDynamicDescription () const
 
Bool CopyDynamicDescriptionFrom (const BaseList2D *src)
 
Bool GetEnabling (const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc) const
 
Bool TranslateDescID (const DescID &id, DescID &res_id, C4DAtom *&res_at)
 
UInt32 GetDirty (DIRTYFLAGS flags) const
 
void SetDirty (DIRTYFLAGS flags)
 
UInt32 GetHDirty (HDIRTYFLAGS mask) const
 
void SetHDirty (HDIRTYFLAGS mask)
 
- Static Public Member Functions inherited from BaseList2D
static BaseList2DAlloc (Int32 type)
 
static void Free (BaseList2D *&bl)
 
- Static Public Attributes inherited from BaseList2D
static const Int32 SETBIT_FLAG_NODIRTY
 
static const Int32 SETBIT_FLAG_REMOVE
 

Constructor & Destructor Documentation

◆ CTrack()

CTrack ( )
private

◆ ~CTrack()

~CTrack ( )
private

Member Function Documentation

◆ Alloc()

static CTrack* Alloc ( BaseList2D bl,
const DescID id 
)
static

Allocates a track. Destroy the allocated track with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in]blThe object to allocate the track for.
[in]idThe description ID to allocate the track for.
For instance a position track is allocated with:
@ DTYPE_VECTOR
Vector
Definition: lib_description.h:70
@ DTYPE_REAL
Float
Definition: lib_description.h:68
@ VECTOR_X
X component.
Definition: lib_description.h:279
A track of type LONG is allocated with:
@ DTYPE_LONG
Int32
Definition: lib_description.h:67
@ ID_BASEOBJECT_VISIBILITY_EDITOR
Definition: obase.h:10
Plugin and special tracks are allocated passing the ID:
IDs for Cinema 4D's special tracks are: TrackTypes
Returns
The allocated track, or nullptr if the allocation failed.

◆ Free()

static void Free ( CTrack *&  bl)
static

Destructs tracks allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in]blThe track to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ GetNext()

CTrack* GetNext ( ) const

Gets the next track in the list. Convenience version of GeListNode::GetNext()

Returns
The next track, or nullptr if there is none. Cinema 4D owns the pointed track.

◆ GetPred()

CTrack* GetPred ( ) const

Gets the previous track in the list. Convenience version of GeListNode::GetPred()

Returns
The previous track, or nullptr if there is none. Cinema 4D owns the pointed track.

◆ GetDescriptionID()

const DescID& GetDescriptionID ( ) const

Gets the description ID of the track.

Returns
The description ID.

◆ SetDescriptionID()

Bool SetDescriptionID ( BaseList2D object,
const DescID id 
)

Sets the description ID of the track.

Parameters
[in]objectThe object for the track. The caller owns the pointed object.
[in]idThe description ID of the track to set.
Returns
true if successful, otherwise false.

◆ GetBefore()

CLOOP GetBefore ( ) const

Gets the pre-track loop type.

Returns
The before loop type.

◆ SetBefore()

void SetBefore ( CLOOP  type)

Sets the pre-track loop type.

Parameters
[in]typeThe before loop type to set.

◆ GetAfter()

CLOOP GetAfter ( ) const

Gets the post-track loop type.

Returns
The after loop type.

◆ SetAfter()

void SetAfter ( CLOOP  type)

Sets the post-track loop type.

Parameters
[in]typeThe after loop type to set.

◆ GetTimeTrack()

CTrack* GetTimeTrack ( BaseDocument doc)

Gets the time track.

Parameters
[in]docThe document for the operation.
Returns
The time track.

◆ SetTimeTrack()

void SetTimeTrack ( CTrack track)

Sets the time track.

Parameters
[in]trackThe time track to set.

◆ AnimateTrack()

Bool AnimateTrack ( const BaseDocument doc,
BaseList2D op,
const BaseTime tt,
ANIMATEFLAGS  flags,
Bool chg,
void *  data = nullptr 
)

Internal.

◆ Animate()

Bool Animate ( const CAnimInfo info,
Bool chg,
void *  data = nullptr 
)

Internal.

◆ Draw()

Bool Draw ( GeClipMap map,
const BaseTime clip_left,
const BaseTime clip_right 
) const

Draws the track into a clip map, if drawing is supported.

Parameters
[out]mapThe clip map to draw into. The caller owns the pointed clip map.
[in]clip_leftThe left clipping.
[in]clip_rightThe right clipping.
Returns
true if the track was drawn, otherwise false.

◆ FillKey()

Bool FillKey ( BaseDocument doc,
BaseList2D bl,
CKey key 
)

Fills key with default values.

Parameters
[in]docThe document. The caller owns the pointed document.
[in]blThe base list of the key to fill. The caller owns the pointed object.
[out]keyThe key to fill. The caller owns the pointed key.
Returns
true if key was filled, otherwise false.

◆ FlushData()

void FlushData ( )

Flushes the data.

Note
Empties and resets sequence data but not the keys.

◆ GetCurve() [1/2]

CCurve* GetCurve ( CCURVE  type = CCURVE::CURVE,
Bool  bCreate = true 
)

Gets a curve of the track.

Parameters
[in]typeThe curve type: CCURVE
[in]bCreateIf true a curve is created if none exists.
Returns
The curve. Can be nullptr if type is something else than CCURVE::CURVE.

◆ GetCurve() [2/2]

const CCurve* GetCurve ( CCURVE  type = CCURVE::CURVE) const

Gets a curve of the track.

Parameters
[in]typeThe curve type: CCURVE
Returns
The curve. Can be nullptr if type is something else than CCURVE::CURVE.

◆ GetTrackCategory()

Int32 GetTrackCategory ( ) const

Gets the track category.

Returns
The track category: CTRACK_CATEGORY.

◆ GetObject() [1/2]

const BaseList2D* GetObject ( ) const

Gets the host object of the track.

Returns
The host object, or nullptr.

◆ GetObject() [2/2]

BaseList2D* GetObject ( )

Gets the host object of the track.

Returns
The host object, or nullptr.

◆ GetValue()

Float GetValue ( const BaseDocument doc,
const BaseTime time 
) const

Gets the value of the track at time.

Parameters
[in]docThe document for the track.
[in]timeThe time.
Returns
The track value.

◆ GetUnit()

Int32 GetUnit ( Float step)

Gets the unit and step of the track.

Parameters
[out]stepAssigned the step.
Returns
The unit: UNIT

◆ GetParameterDescription()

const BaseContainer* GetParameterDescription ( BaseContainer temp) const

Private.

◆ GuiMessage()

Int32 GuiMessage ( const BaseContainer msg,
BaseContainer result 
)

Sends a GUI message to the track.

See also
The article GUI Messages for more information.
Parameters
[in]msgThe GUI message container.
[out]resultThe result container.
Returns
The result.

◆ Remap()

Bool Remap ( Float64  time,
Float64 ret_time,
Int32 ret_cycle 
) const

Remaps time.

Parameters
[in]timeThe input time.
[out]ret_timeThe output time.
[out]ret_cycleThe output cycle.
Returns
true if time was remapped, otherwise false.

◆ TrackInformation()

Bool TrackInformation ( BaseDocument doc,
CKey key,
maxon::String str,
Bool  set 
)

Gets or sets track information at the current time, or at key if specified.
The information in str is displayed in tooltips etc.

Parameters
[in]docThe document. The caller owns the pointed document.
[in]keyThe optional key. The caller owns the pointed key.
[in,out]strThe information string to get or set. The caller owns the pointed string.
[in]setIf true the information is set, otherwise it is retrieved.
Returns
true if track information was retrieved or set, otherwise false.

◆ GetHeight()

Int32 GetHeight ( ) const

Gets the height of the track.

Returns
The height of the track in pixels.

◆ GetTLHeight()

Int32 GetTLHeight ( Int32  id) const

Gets the height of the mini F-Curves in the Timeline.

Parameters
[in]idPass a value between 0-3 for one of the four Timelines.
Returns
The height of the mini F-curve in pixels.

◆ SetTLHeight()

void SetTLHeight ( Int32  id,
Int32  size 
)

Sets the height of the mini F-Curves in the Timeline.

Parameters
[in]idPass a value between 0-3 for one of the four Timelines.
[in]sizeThe new size of the mini F-Curves in pixels.

◆ IsSynchronized()

Bool IsSynchronized ( ) const

Checks if keys are synchronized with other Component tracks (Vector Track only).

Since
R18
Returns
true if track is synchronized, otherwise false.

◆ SetSynchronized()

void SetSynchronized ( Bool  synch)

Sets synchronization between component Track (Vector Track only).

Since
R18
Parameters
[in]synchtrue if Track needs to be synchronized, otherwise false.

◆ GetEvaluationMode()

CURVEINTERPOLATION_MODE GetEvaluationMode ( ) const

Gets evaluation mode.

Since
S24
Returns
interpolation mode.

◆ SetEvaluationMode()

void SetEvaluationMode ( CURVEINTERPOLATION_MODE  mode)

Sets evaluation mode.

Since
S24
Parameters
[in]modecurve interpolation mode.

◆ SetLambda()

void SetLambda ( maxon::Delegate< Float(const BaseDocument *doc, BaseList2D *op, const BaseTime &tt, ANIMATEFLAGS flags, Bool *chg, void *data)>  lambdaFn)

Internal.

◆ HasLambda()

Bool HasLambda ( ) const

Internal.

◆ ClearLambda()

void ClearLambda ( )

Internal.

◆ GetAnimatedGeData()

GeData GetAnimatedGeData ( const BaseDocument doc,
BaseList2D op,
const BaseTime time 
) const

Gets the data of the track at time.

Parameters
[in]docThe document for the track.
[in]opThe op yielding the track.
[in]timeThe time.
Returns
The track data.