About
A CKey represents a key of an animation track. CKey objects are stored in a CCurve which in return is stored in a CTrack object.
CKey objects are an instance of CKbase
.
while (track != nullptr)
{
if (curve == nullptr)
continue;
{
{
}
}
}
Py_ssize_t i
Definition: abstract.h:645
PyObject * key
Definition: abstract.h:289
const CTrack * GetFirstCTrack() const
Definition: c4d_baselist.h:2870
Definition: c4d_canimation.h:366
const CKey * GetKey(Int32 index) const
Definition: c4d_canimation.h:388
Int32 GetKeyCount() const
Definition: c4d_canimation.h:381
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
CTrack * GetNext() const
Definition: c4d_canimation.h:716
CCurve * GetCurve(CCURVE type=CCURVE::CURVE, Bool bCreate=true)
Definition: c4d_canimation.h:835
maxon::Int32 Int32
Definition: ge_sys_math.h:56
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
Access
CKey objects are accessed via the host CCurve:
See CCurve Manual.
if (leftKey)
{
}
Definition: c4d_basetime.h:25
const CKey * FindKey(const BaseTime &time, Int32 *idx=nullptr, FINDANIM match=FINDANIM::EXACT) const
Definition: c4d_canimation.h:404
void SetTime(CCurve *seq, const BaseTime &t)
Definition: c4d_canimation.h:96
const char * doc
Definition: pyerrors.h:226
The host objects are accessed with:
Allocation/Deallocation
A CKey object can be created with the usual tools:
But typically keys are created using the host CCurve:
Keys can also be created using auto key functionality of the BaseDocument:
The default settings of a key are defined in the BaseDocument:
See also BaseDocument Animate.
Handle
CKey objects are manipulated with the host CCurve object.
if (newKey == nullptr)
void SetKeyDefault(BaseDocument *doc, Int32 kidx)
CKey * AddKey(const BaseTime &time, Int32 *nidx=nullptr, Bool bUndo=false, Bool SynchronizeKeys=false)
Definition: c4d_canimation.h:423
Bool FillKey(BaseDocument *doc, BaseList2D *bl, CKey *key)
Definition: c4d_canimation.h:821
PyObject * obj
Definition: complexobject.h:60
Py_ssize_t * index
Definition: abstract.h:374
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
Properties
Parameters
The parameters of a key can be edited as usual with C4DAtom::SetParameter() and C4DAtom::GetParameter(). The parameter IDs are defined in ckvalue.h
.
{
}
@ ID_CKEY_BREAK
Definition: ckvalue.h:20
#define ConstDescID(...)
Definition: lib_description.h:594
Represents a level within a DescID.
Definition: lib_description.h:298
- Note
- The boolean parameters of a key are stored internally as bits, see Bits.
Selection
In Cinema 4D there can be up to four Timeline windows. A key can be selected in one or multiple of these windows. The selection state is stored as a bit:
{
}
@ TL1_SELECT
Selection bit for Timeline 1.
Time
An animation key is defined by its position in time:
key->SetTime(curve, time);
See also BaseTime Manual.
Value
An animation key defines a certain value at a certain time:
- Note
- Data of special tracks can be read and set using C4DAtom::GetParameter() and C4DAtom::SetParameter().
-
To set the keyframe for a Vector parameter one must define tracks and keyframes for each vector component.
{
}
{
key->SetGeData(curve, data);
}
PyObject * value
Definition: abstract.h:715
Int32 GetTrackCategory() const
Definition: c4d_canimation.h:851
Definition: c4d_gedata.h:83
maxon::Float Float
Definition: ge_sys_math.h:62
#define CTRACK_CATEGORY_VALUE
Value track.
Definition: c4d_canimation.h:633
#define CTRACK_CATEGORY_DATA
Data track.
Definition: c4d_canimation.h:634
See also CTrack Read-Only Properties and CCurve Animation.
Tangents
A key also defines the local tangents. These tangents influence the interpolation between the keys.
The modes are:
The left and right tangents are defined by two points. These two points are defined by time and value.
The time property of the tangents can be accessed with:
The value property of the tangents can be accessed with:
The left and right tangent can be adjusted with:
key->SetTimeLeftAdjustValue(curve, time);
Interpolation
There are different ways to interpolate between the values of the animation keys. The interpolation from one key to the next is defined per key:
Interpolation modes are:
Quaternion Interpolation
Quaternion interpolation can be used on the rotation of a BaseObject. The kind of interpolation can be refined per key.
See also BaseObject Quaternion Rotation Mode.
Preset
Several presets exist to manage the clamp, slope and overshoot behaviour of a key.
The preset modes are:
- CKEYPRESET::AUTO_CLAMP : Auto, Classical, Clamp.
- CKEYPRESET::AUTO_OVERSHOOT : Auto, Auto Angle, remove Overshooting.
- CKEYPRESET::AUTO_OVERSHOOTWEIGHTED : Auto, Auto Angle, remove Overshooting, weighted.
- CKEYPRESET::FIXED_OVERSHOOTWEIGHTED : Auto, Fixed Angle, remove Overshooting, weighted.
- CKEYPRESET::CUSTOM : User Defined.
{
}
CKEYPRESET
Definition: ge_prepass.h:4228
@ AUTO_OVERSHOOT
Auto, Auto Angle, remove Overshooting.
@ AUTO_CLAMP
Auto, Auto Angle, Clamp.
Copy
A new CKey can be created by copying an existing one.
CKey*
const clone =
key->GetClone(
nullptr);
if (clone == nullptr)
Bool InsertKey(CKey *ckey, Bool bUndo=false, Bool SynchronizeKeys=false)
Definition: c4d_canimation.h:442
Functionality
The data stored in a key can easily be flushed.
Bits
The boolean parameters of a key are stored internally as bits. These bits can be edited directly.
See also Parameters.
Further Reading