c4d.CCurve

class c4d.CCurve
This is the animation curve base class.
Belongs to a CTrack that contain CKeys.

Methods Signatures

CCurve.GetKeyCount(self) Returns the count of CKey
CCurve.GetKey(self, index) Get a writeable key by index.
CCurve.FindKey(self, time[, match]) Find a writable key by time.
CCurve.AddKey(self, time[, bUndo, ...]) Find a writable key by time.
CCurve.AddKeyAdaptTangent(self, time, bUndo[, ...]) Add a key to the curve but retain the curve’s current curvature.
CCurve.InsertKey(self, ckey[, bUndo, ...]) Insert a key into this curve.
CCurve.DelKey(self, index[, bUndo, ...]) Delete a key from this curve.
CCurve.MoveKey(self, time, idx[, seq, ...]) Move a key in the curve.
CCurve.FlushKeys(self[, bUndo, ...]) Remove all keys from this curve.
CCurve.SortKeysByTime(self) Private. Should not be used.
CCurve.SetKeyDirty(self) Set keys to dirty. Equivalent to SetDirty(DIRTY_CHILDREN).
CCurve.GetTrack(self) Get the track of this curve.
CCurve.GetValue(self, time, fps) Get the value calculated at time, taking into account things like timecurves.
CCurve.SetKeyDefault(self, doc, kidx) Set the defaults for key kidx for the curve.
CCurve.GetStartTime(self) Returns the start time of the curve.
CCurve.GetEndTime(self) Returns the end time of the curve.
CCurve.FindNextUnmuted(self, index) Returns the next unmuted key.
CCurve.FindPrevUnmuted(self, index) Returns the previous unmuted key.

Inheritance

Inheritance

Parent Class:

Methods Documentation

CCurve.GetKeyCount(self)

Returns the count of CKey

Return type:int
Returns:The count.
CCurve.GetKey(self, index)

Get a writeable key by index.

Parameters:index (int) – Key index.
Raises:IndexError – If key index is out of range : 0<=index<GetKeyCount().
Return type:c4d.CKey
Returns:The key found, or None.
CCurve.FindKey(self, time, match=FINDANIM_EXACT)

Find a writable key by time.

found = curve.FindKey(time)
if found==None: return

key = found["key"] #The found key
index = found["idx"] #The index of the found key
Parameters:
  • time (c4d.BaseTime) – A time.
  • match (int) –

    Search method:

    FINDANIM_EXACT Exact.
    FINDANIM_LEFT Search left.
    FINDANIM_RIGHT Search right.
Return type:

dict{key: CKey, int: int}

Returns:

Dict with the found key and index, or None.

CCurve.AddKey(self, time, bUndo=False, SynchronizeKeys=False)

Find a writable key by time.

added = curve.AddKey(time)
if added==None: return

key = found["key"] #The found key
index = found["nidx"] #The index of the found key
Parameters:
  • time (c4d.BaseTime) – The time to add the key at.
  • bUndo (bool) –

    New in version R18.020.

    If True this action will be undoable.

    Note

    The caller has to to manage start/end of undo actions with BaseDocument.StartUndo()/EndUndo().

  • SynchronizeKeys (bool) –

    New in version R18.020.

    If True the routine is called on other components of the vector (if valid). Curve must be part of a Track.

Return type:

dict{‘nidx’: int, ‘key’: c4d.CKey}

Returns:

The added key index and object (None if it failed).

CCurve.AddKeyAdaptTangent(self, time, bUndo, SynchronizeKeys=False)

Add a key to the curve but retain the curve’s current curvature.

New in version R18.020.

Parameters:
  • time (c4d.BaseTime) – The time to add the key at.
  • bUndo (bool) – If True this action will be undoable. The caller has to to manage start/end of undo actions with BaseDocument.StartUndo()/EndUndo().
  • SynchronizeKeys (bool) – If True the routine is called on other components of the vector (if valid). Curve must be part of a Track.
Return type:

dict{‘nidx’: int, ‘key’: c4d.CKey}

Returns:

The added key index and object (None if it failed).

CCurve.InsertKey(self, ckey, bUndo=False, SynchronizeKeys=False)

Insert a key into this curve.

Parameters:
  • ckey (c4d.CKey) – The key to insert.
  • bUndo (bool) –

    New in version R18.020.

    If True this action will be undoable.

    Note

    The caller has to to manage start/end of undo actions with BaseDocument.StartUndo()/EndUndo().

  • SynchronizeKeys (bool) –

    New in version R18.020.

    If True the routine is called on other components of the vector (if valid). Curve must be part of a Track.

Return type:

bool

Returns:

True if successful, otherwise False.

CCurve.DelKey(self, index, bUndo=False, SynchronizeKeys=False)

Delete a key from this curve.

Parameters:
  • index (int) – The index of the key to delete.
  • bUndo (bool) –

    New in version R18.020.

    If True this action will be undoable.

    Note

    The caller has to to manage start/end of undo actions with BaseDocument.StartUndo()/EndUndo().

  • SynchronizeKeys (bool) –

    New in version R18.020.

    If True the routine is called on other components of the vector (if valid). Curve must be part of a Track.

Raises:

IndexError – If key index is out of range : 0<=index<GetKeyCount().

Return type:

bool

Returns:

True if successful, otherwise False.

CCurve.MoveKey(self, time, idx, seq=None, bUndo=False, SynchronizeKeys=False)

Move a key in the curve.

Parameters:
  • time (c4d.BaseTime) – The new time.
  • idx (int) – The index of the key to move.
  • seq (c4d.CCurve) – Optional destination curve.
  • bUndo (bool) –

    New in version R18.020.

    If True this action will be undoable.

    Note

    The caller has to to manage start/end of undo actions with BaseDocument.StartUndo()/EndUndo().

  • SynchronizeKeys (bool) –

    New in version R18.020.

    If True the routine is called on other components of the vector (if valid). Curve must be part of a Track.

Raises:

IndexError – If key idx is out of range : 0<=idx<GetKeyCount().

Return type:

int

Returns:

The new index.

CCurve.FlushKeys(self, bUndo=False, SynchronizeKeys=False)

Remove all keys from this curve.

Parameters:
  • bUndo (bool) –

    New in version R18.020.

    If True this action will be undoable.

    Note

    The caller has to to manage start/end of undo actions with BaseDocument.StartUndo()/EndUndo().

  • SynchronizeKeys (bool) –

    New in version R18.020.

    If True the routine is called on other components of the vector (if valid). Curve must be part of a Track.

CCurve.SortKeysByTime(self)

Private. Should not be used.

CCurve.SetKeyDirty(self)

Set keys to dirty. Equivalent to SetDirty(DIRTY_CHILDREN).

CCurve.GetTrack(self)

Get the track of this curve.

Return type:c4d.CTrack
Returns:The track of this curve.
CCurve.GetValue(self, time, fps)

Get the value calculated at time, taking into account things like timecurves.

Parameters:
  • time (c4d.BaseTime) – The time to calculate the value at.
  • fps (int) –

    Deprecated since version R17.048: The number of frames per second.

Return type:

float

Returns:

The calculated value.

CCurve.SetKeyDefault(self, doc, kidx)

Set the defaults for key kidx for the curve.

Note

This includes lock, mute, clamp, break, auto properties, interpolation and tangents.
This way you can set up a value and complete the missing properties with the defaults.
Parameters:
CCurve.GetStartTime(self)

Returns the start time of the curve.

New in version R19.

Return type:c4d.BaseTime
Returns:The start time of the curve.
CCurve.GetEndTime(self)

Returns the end time of the curve.

New in version R19.

Return type:c4d.BaseTime
Returns:The end time of the curve.
CCurve.FindNextUnmuted(self, index)

Returns the next unmuted key.

New in version R19.

Parameters:index (intcl) – The key index to start the search from: 0 <= idx < GetKeyCount()
Return type:tuple(c4d.CKey, int)
Returns:The next unmuted key and its index, or None if there is no next unmuted key.
CCurve.FindPrevUnmuted(self, index)

Returns the previous unmuted key.

New in version R19.

Parameters:index (int) – The key index to start the search from: 0 <= idx < GetKeyCount()
Return type:tuple(c4d.CKey, int)
Returns:The previous unmuted key and its index, or None if there is no previous unmuted key.