About
A CCurve represents an animation curve that stores and interpolates animation keys. A CCurve is stored in a CTrack object.
CCurve objects are an instance of CSbase
.
CTrack* track = activeObject->GetFirstCTrack();
while (track != nullptr)
{
CCurve* const curve = track->GetCurve();
if (curve == nullptr)
continue;
const Int32 keyCount = curve->GetKeyCount();
{
CKey*
const key = curve->GetKey(
i);
{
}
}
track = track->GetNext();
}
Py_ssize_t i
Definition: abstract.h:645
PyObject * key
Definition: abstract.h:289
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
maxon::Int32 Int32
Definition: ge_sys_math.h:51
Access
CCurve objects cannot be created on their own. They are created with a CTrack that contains the CCurve object.
- CTrack::GetCurve(): Returns the CCurve object stored with a CTrack. See example above.
- CCurve::GetTrack(): Returns the CTrack that stores the CCurve.
Keys
Access Keys
The CCurve objects stores the animation keys and provides access to these:
- CCurve::GetKeyCount(): Returns the number of keys.
- CCurve::GetKey(): Returns the CKey at the given index.
- CCurve::FindKey(): Returns the (next) CKey at the given time.
const BaseTime time =
doc->GetTime();
if (leftKey)
{
leftKey->SetTime(curve, time);
}
LEFT
Modify the left tangent handle.
Definition: ge_prepass.h:1
const char * doc
Definition: pyerrors.h:226
Add Keys
A CCurve object can create and receive keys:
- CCurve::AddKey(): Adds a new key to the CCurve.
- CCurve::AddKeyAdaptTangent(): Adds a new key to the CCurve but retains the curve's current curvature.
- CCurve::InsertKey(): Inserts a key into the CCurve. The CCurve takes ownership.
const BaseTime stepTime = BaseTime(
step, fps);
BaseTime keyTime =
doc->GetMinTime();
{
if (curve->AddKey(keyTime, nullptr) == nullptr)
keyTime = keyTime + stepTime;
}
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
const char Py_ssize_t const char Py_ssize_t Py_ssize_t max
Definition: modsupport.h:59
const char Py_ssize_t const char Py_ssize_t min
Definition: modsupport.h:58
PyObject PyObject * step
Definition: sliceobject.h:34
See also CKey Allocation/Deallocation.
Handle Keys
A CCurve object can be used to manipulate its keys:
- CCurve::DelKey(): Deletes the key at the given index.
- CCurve::MoveKey(): Moves the key at the given index.
- CCurve::FlushKeys(): Removes all keys from the curve.
- CCurve::SetKeyDirty(): Sets the key dirty.
- CCurve::SetKeyDefault(): Sets the default settings for the key at the given index.
CKey*
const newKey = curve->AddKey(time, &
index);
if (newKey == nullptr)
track->FillKey(
doc,
obj, newKey);
PyObject * obj
Definition: complexobject.h:60
Py_ssize_t * index
Definition: abstract.h:374
Unmuted Keys
A key can be muted so it is ignored.
- CCurve::FindNextUnmuted(): Returns the next unmuted key searching from the given index. (included)
- CCurve::FindPrevUnmuted(): Returns the previous unmuted key searching from the given index. (included)
const CKey*
const key = curve->FindNextUnmuted(0);
{
const Float time =
key->GetTime().Get();
}
maxon::Float Float
Definition: ge_sys_math.h:57
See also CKey Bits.
Animation
The interpolation between the keys defines the dynamics of an animation. This interpolation is refined with the tangents.
- CCurve::CalcHermite(): Calculates the Hermite spline between two sets of key values.
- CCurve::CalcSoftTangents(): Calculates the soft tangents (i.e. auto interpolation) around the key of the given index.
- CCurve::GetTangents(): Computes the tangents of a key, taking into account all options like zero slope, link slope etc.
- CCurve::GetValue(): Returns the value calculated at the given time, taking into account things like time curves.
BaseTime time(0.0);
const BaseTime
step(0.1);
{
}
PyObject * value
Definition: abstract.h:715
Time
A CCurve is confined by a first and a last key:
- CCurve::GetStartTime(): Returns the start time of the curve.
- CCurve::GetEndTime(): Returns the end time of the curve.
const BaseTime
start = curve->GetStartTime();
const BaseTime
end = curve->GetEndTime();
PyObject PyObject Py_ssize_t start
Definition: complexobject.h:62
PyObject PyObject Py_ssize_t Py_ssize_t end
Definition: complexobject.h:63
Further Reading