CKey Class Reference

#include <c4d_canimation.h>

Inheritance diagram for CKey:

Detailed Description

Represents a key in the CCurve of a track which represent the animation of a parameter.

Tangents are only guaranteed to be available for tracks of category CTRACK_CATEGORY_VALUE. Tracks of the categories CTRACK_CATEGORY_DATA and CTRACK_CATEGORY_PLUGIN may contain tangent data or not. E.g., a BaseTime track will provide tangents for its keys, while a PLA track will not. Such tracks which do not provide tangent data will however not raise an error on attempting to retrieve a tangent for a key, but instead return the null-vector (0, 0, 0).

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

 CKey ()
 
 ~CKey ()
 
const CKeyoperator= (const CKey &key)
 

Alloc/Free

static CKeyAlloc ()
 
static void Free (CKey *&key)
 

Get/Set Time

BaseTime GetTime () const
 
void SetTime (CCurve *seq, const BaseTime &t)
 
BaseTime GetTimeLeft () const
 
void SetTimeLeft (CCurve *seq, const BaseTime &t)
 
BaseTime GetTimeRight () const
 
void SetTimeRight (CCurve *seq, const BaseTime &t)
 

Get/Set Value

Float GetValue () const
 
void SetValue (CCurve *seq, Float v)
 
const GeDataGetGeData () const
 
void SetGeData (CCurve *seq, const GeData &d)
 
Float GetValueLeft () const
 
void SetValueLeft (CCurve *seq, Float v)
 
Float GetValueRight () const
 
void SetValueRight (CCurve *seq, Float v)
 

Interpolation

CINTERPOLATION GetInterpolation () const
 
void SetInterpolation (CCurve *seq, CINTERPOLATION inter)
 
ROTATIONINTERPOLATION_QUATERNION GetQuatInterpolation () const
 
void SetQuatInterpolation (CCurve *seq, ROTATIONINTERPOLATION_QUATERNION inter, Bool bUndo=true)
 

Copy/Clone

Bool CopyDataTo (CCurve *destseq, CKey *dest, AliasTrans *trans) const
 
CKeyGetClone (AliasTrans *trans) const
 

Miscellaneous

CTrackGetTrack ()
 
CCurveGetCurve ()
 
void FlushData ()
 

AutoTangent Mode

CAUTOMODE GetAutomaticTangentMode () const
 
void SetAutomaticTangentMode (CCurve *seq, CAUTOMODE autoMode)
 

Tangent Helpers

Bool SetTimeLeftAdjustValue (CCurve *seq, const BaseTime &t)
 
Bool SetTimeRightAdjustValue (CCurve *seq, const BaseTime &t)
 

Key Preset Mode

CKEYPRESET GetKeyPreset () const
 
void SetKeyPreset (CCurve *seq, CKEYPRESET preset)
 

Additional Inherited Members

- 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)
 

Constructor & Destructor Documentation

◆ CKey()

CKey ( )
private

◆ ~CKey()

~CKey ( )
private

Member Function Documentation

◆ operator=()

const CKey& operator= ( const CKey key)
private

◆ Alloc()

static CKey* Alloc ( )
static

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

Returns
The allocated key, or nullptr if the allocation failed.

◆ Free()

static void Free ( CKey *&  key)
static

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

Parameters
[in,out]keyThe key to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ GetTime()

BaseTime GetTime ( ) const

Gets the time of the key.

Returns
The time.

◆ SetTime()

void SetTime ( CCurve seq,
const BaseTime t 
)

Sets the time of the key.

Parameters
[in]seqThe curve the key belongs to.
[in]tThe time to set.

◆ GetTimeLeft()

BaseTime GetTimeLeft ( ) const

Gets the time component of the left tangent of the key.

See class description for details on the availability of tangents. Note that this function does not take key presets, e.g., CKEYPRESET::AUTO_CLAMP, into account, but always returns the underlying true tangent data, as if the preset was CKEYPRESET::CUSTOM. Use CCurve::GetTangents to retrieve tangents respecting the key preset settings.

Returns
The time component of the left tangent.

◆ SetTimeLeft()

void SetTimeLeft ( CCurve seq,
const BaseTime t 
)

Gets the time component of the left tangent of the key.

See class description for details on the availability of tangents.

Parameters
[in]seqThe curve the key belongs to.
[in]tThe time component of the left tangent to set.

◆ GetTimeRight()

BaseTime GetTimeRight ( ) const

Gets the time component of the right tangent of the key.

See class description for details on the availability of tangents. Note that this function does not take key presets, e.g., CKEYPRESET::AUTO_CLAMP, into account, but always returns the underlying true tangent data, as if the preset was CKEYPRESET::CUSTOM. Use CCurve::GetTangents to retrieve tangents respecting the key preset settings.

Returns
The time component of the right tangent.

◆ SetTimeRight()

void SetTimeRight ( CCurve seq,
const BaseTime t 
)

Gets the time component of the right tangent of the key.

See class description for details on the availability of tangents.

Parameters
[in]seqThe curve the key belongs to.
[in]tThe time component of the right tangent to set.

◆ GetValue()

Float GetValue ( ) const

Gets the value of the key.

Used to read keys of tracks that are of category CTRACK_CATEGORY_VALUE. This usually only does apply to DTYPE_REAL and DTYPE_LONG tracks, other data types must be read with CKey.GetGeData. An exception to that rule are tracks for data types that are composed out of float values, like for example Vector or Matrix. Here the type is being decomposed into multiple tracks of floating point values. E.g., for a vector into its three or four components and for a matrix first into its vectors and then each vector into its components. Call CTrack::GetTrackCategory to determine the category of a track and therefore the method which has to be used to read data from its keys. Example: Reading of PLA keys.

GeData data;
if (!key->GetParameter(ConstDescID(DescLevel(CK_PLA_DATA,CUSTOMDATATYPE_PLA,0)), data, 0))
return false;
if (pla==nullptr)
return false;
VariableTag *ptag = nullptr,
*htag = nullptr;
pla->GetVariableTags(ptag, htag);
PyObject * key
Definition: abstract.h:289
@ CK_PLA_DATA
Definition: ckpla.h:8
Definition: c4d_gedata.h:83
const DATATYPE * GetCustomDataType() const
Definition: c4d_gedata.h:542
PLA custom data type (CUSTOMDATATYPE_PLA) for PLA tracks.
Definition: customgui_pla.h:35
void GetVariableTags(PointTag *&ptag, TangentTag *&htag)
Definition: c4d_basetag.h:148
#define CUSTOMDATATYPE_PLA
PLA custom data type ID.
Definition: customgui_pla.h:26
#define ConstDescID(...)
Definition: lib_description.h:594
Represents a level within a DescID.
Definition: lib_description.h:298

ptag/htag contain the point/tangent information.

Returns
The value.

◆ SetValue()

void SetValue ( CCurve seq,
Float  v 
)

Sets the value of the key.

Used to write keys of tracks that are of category CTRACK_CATEGORY_VALUE. This usually only does apply to DTYPE_REAL and DTYPE_LONG tracks, other data types must be read with CKey.GetGeData. An exception to that rule are tracks for data types that are composed out of float values, like for example Vector or Matrix. Here the type is being decomposed into multiple tracks of floating point values. E.g., for a vector into its three or four components and for a matrix first into its vectors and then each vector into its components. Call CTrack::GetTrackCategory to determine the category of a track and therefore the method which has to be used to read data from its keys.

Parameters
[in]seqThe curve the key belongs to.
[in]vThe value to set.

◆ GetGeData()

const GeData& GetGeData ( ) const

Gets the data of the key.

Used to read keys of tracks that are of category CTRACK_CATEGORY_DATA. This usually does apply to tracks that neither store DTYPE_REAL and DTYPE_LONG data, and those data types must be written with CKey::GetValue. An exception to that rule are tracks for data types that are composed out of float values, like for example Vector or Matrix. Here the type is being decomposed into multiple tracks of floating point values. E.g., for a vector into its three or four components and for a matrix first into its vectors and then each vector into its components. Call CTrack::GetTrackCategory to determine the category of a track and therefore the method which has to be used to write data into its keys.

Returns
The data.

◆ SetGeData()

void SetGeData ( CCurve seq,
const GeData d 
)

Sets the data of the key.

Used to write keys of tracks that are of category CTRACK_CATEGORY_DATA. This usually does apply to tracks that neither store DTYPE_REAL and DTYPE_LONG data, and those data types must be written with CKey::SetValue. An exception to that rule are tracks for data types that are composed out of float values, like for example Vector or Matrix. Here the type is being decomposed into multiple tracks of floating point values. E.g., for a vector into its three or four components and for a matrix first into its vectors and then each vector into its components. Call CTrack::GetTrackCategory to determine the category of a track and therefore the method which has to be used to write data into its keys.

Parameters
[in]seqThe curve the key belongs to.
[in]dThe new key data.

◆ GetValueLeft()

Float GetValueLeft ( ) const

Gets the value component of the left tangent of the key.

See class description for details on the availability of tangents. Note that this function does not take key presets, e.g., CKEYPRESET::AUTO_CLAMP, into account, but always returns the underlying true tangent data, as if the preset was CKEYPRESET::CUSTOM. Use CCurve::GetTangents to retrieve tangents respecting the key preset settings.

Returns
The value component of the left tangent.

◆ SetValueLeft()

void SetValueLeft ( CCurve seq,
Float  v 
)

Sets the value component of the left tangent of the key.

See class description for details on the availability of tangents.

Parameters
[in]seqThe curve the key belongs to.
[in]vThe value component of the left tangent to set.

◆ GetValueRight()

Float GetValueRight ( ) const

Gets the value component of the right tangent of the key.

See class description for details on the availability of tangents. Note that this function does not take key presets, e.g., CKEYPRESET::AUTO_CLAMP, into account, but always returns the underlying true tangent data, as if the preset was CKEYPRESET::CUSTOM. Use CCurve::GetTangents to retrieve tangents respecting the key preset settings.

Returns
The value component of the right tangent.

◆ SetValueRight()

void SetValueRight ( CCurve seq,
Float  v 
)

Sets the value component of the right tangent of the key.

See class description for details on the availability of tangents.

Parameters
[in]seqThe curve the key belongs to.
[in]vThe value component of the right tangent to set.

◆ GetInterpolation()

CINTERPOLATION GetInterpolation ( ) const

Gets the interpolation type of the key.

Returns
The interpolation type: CINTERPOLATION

◆ SetInterpolation()

void SetInterpolation ( CCurve seq,
CINTERPOLATION  inter 
)

Sets the interpolation type of the key.

Parameters
[in]seqThe curve the key belongs to.
[in]interThe interpolation type to set: CINTERPOLATION

◆ GetQuatInterpolation()

ROTATIONINTERPOLATION_QUATERNION GetQuatInterpolation ( ) const

Gets the quaternion interpolation type of the key.

Since
R18
Returns
The interpolation type: ROTATIONINTERPOLATION_QUATERNION

◆ SetQuatInterpolation()

void SetQuatInterpolation ( CCurve seq,
ROTATIONINTERPOLATION_QUATERNION  inter,
Bool  bUndo = true 
)

Sets the quaternion interpolation type of the key.

Note
Keys at the same time on other component curve will be modified.
Since
R18
Parameters
[in]seqThe curve the key belongs to.
[in]interThe interpolation type to set: ROTATIONINTERPOLATION_QUATERNION
[in]bUndotrue to add the three rotation keys in the undo system, otherwise false.

◆ CopyDataTo()

Bool CopyDataTo ( CCurve destseq,
CKey dest,
AliasTrans trans 
) const

Copies the key data to dest.

Parameters
[in]destseqThe curve the destination key belongs to.
[in]destThe destination key.
[in]transAn alias translator for the operation. Can be nullptr. The caller owns the pointed object.
Returns
true if successful, otherwise false.

◆ GetClone()

CKey* GetClone ( AliasTrans trans) const

Gets a copy of the key.

Parameters
[in]transAn alias translator for the operation. Can be nullptr. The caller owns the pointed alias translator.
Returns
The cloned key. The caller owns the pointed key.

◆ GetTrack()

CTrack* GetTrack ( )

Gets the track of the key.

Returns
The track.

◆ GetCurve()

CCurve* GetCurve ( )

Gets the curve of the key.

Returns
The curve.

◆ FlushData()

void FlushData ( )

Flushes the key: empties and resets data.

◆ GetAutomaticTangentMode()

CAUTOMODE GetAutomaticTangentMode ( ) const

Gets the AutoTangent mode of the key.

Since
R17.032
Returns
The AutoTangent mode: CAUTOMODE

◆ SetAutomaticTangentMode()

void SetAutomaticTangentMode ( CCurve seq,
CAUTOMODE  autoMode 
)

Sets the AutoTangent mode of the key.

Since
R17.032
Parameters
[in]seqThe curve the key belongs to.
[in]autoModeThe AutoTangent mode to set: CAUTOMODE

◆ SetTimeLeftAdjustValue()

Bool SetTimeLeftAdjustValue ( CCurve seq,
const BaseTime t 
)

Sets Time Left and adjusts Value so the angle stays the same.

Since
R17.032
Parameters
[in]seqThe curve the key belongs to.
[in]tThe new left time to set.
Returns
true if successful. false if current Time Left is smaller than FLT_MIN and Value is not Zero (angle cannot stay the same).

◆ SetTimeRightAdjustValue()

Bool SetTimeRightAdjustValue ( CCurve seq,
const BaseTime t 
)

Sets Time Right and adjusts Value so the angle stays the same.

Since
R17.032
Parameters
[in]seqThe curve the key belongs to.
[in]tThe new right time to set.
Returns
true if successful. false if current Time Right is smaller than FLT_MIN and Value is not Zero (angle cannot stay the same).

◆ GetKeyPreset()

CKEYPRESET GetKeyPreset ( ) const

Gets the preset mode of the key.

Since
R18.027
Returns
The preset mode: CKEYPRESET

◆ SetKeyPreset()

void SetKeyPreset ( CCurve seq,
CKEYPRESET  preset 
)

Sets the preset mode of the key.

Since
R18.027
Parameters
[in]seqThe curve the key belongs to.
[in]presetThe preset mode to set: CKEYPRESET