c4d.CCurve

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

Inheritance

Members

CCurve.GetKeyCount()

Returns the count of CKey

Return type:int
Returns:The count.
CCurve.GetKey(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(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(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. 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(time, bUndo, SynchronizeKeys=False)

New in version R18.020.

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

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

Private. Should not be used.

CCurve.SetKeyDirty()

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

CCurve.GetTrack()

Get the track of this curve.

Return type:c4d.CTrack
Returns:The track of this curve.
CCurve.GetValue(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(doc, kidx)

Set the defaults for key kidx for the curve. 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()

New in version R19.

Returns the start time of the curve.

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

New in version R19.

Returns the end time of the curve.

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

New in version R19.

Returns the next unmuted key.

Parameters:index (int) – 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(index)

New in version R19.

Returns the previous unmuted key.

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.