CCurve Class Reference

#include <c4d_canimation.h>

Inheritance diagram for CCurve:

Detailed Description

Represents the animation curve.
Belongs to a track and contains keys.

Note
Cannot be allocated.

Private Member Functions

 CCurve ()
 
 ~CCurve ()
 
const CCurveoperator= (const CCurve &seq)
 

Key

Int32 GetKeyCount () const
 
const CKeyGetKey (Int32 index) const
 
CKeyGetKey (Int32 index)
 
const CKeyFindKey (const BaseTime &time, Int32 *idx=nullptr, FINDANIM match=FINDANIM::EXACT) const
 
CKeyFindKey (const BaseTime &time, Int32 *idx=nullptr, FINDANIM match=FINDANIM::EXACT)
 
CKeyAddKey (const BaseTime &time, Int32 *nidx=nullptr, Bool bUndo=false, Bool SynchronizeKeys=false)
 
CKeyAddKeyAdaptTangent (const BaseTime &time, Bool bUndo, Int32 *nidx=nullptr, Bool SynchronizeKeys=false)
 
Bool InsertKey (CKey *ckey, Bool bUndo=false, Bool SynchronizeKeys=false)
 
Bool DelKey (Int32 index, Bool bUndo=false, Bool SynchronizeKeys=false)
 
Int32 MoveKey (const BaseTime &time, Int32 idx, CCurve *dseq=nullptr, Bool bUndo=false, Bool SynchronizeKeys=false)
 
void FlushKeys (Bool bUndo=false, Bool SynchronizeKeys=false)
 

Calculation

Float64 CalcHermite (Float64 time, Float64 t1, Float64 t2, Float64 val1, Float64 val2, Float64 tan1_val, Float64 tan2_val, Float64 tan1_t, Float64 tan2_t, Bool deriv) const
 
void CalcSoftTangents (Int32 kidx, Float *vl, Float *vr, BaseTime *tl, BaseTime *tr)
 
void GetTangents (Int32 kidx, Float64 *vl, Float64 *vr, Float64 *tl, Float64 *tr)
 
void AdjustTangentLength (Float64 keyTime1, Float64 keyTime2, Float64 &tan1_val, Float64 &tan2_val, Float64 &tan1Time, Float64 &tan2Time, Bool applyHermiteFactor) const
 
void AdjustTangentAutoWeight (Int32 keyIndex)
 
Float GetValue (const BaseTime &time) const
 

Miscellaneous

CTrackGetTrack () const
 
void SetKeyDefault (BaseDocument *doc, Int32 kidx)
 
void SetKeyDirty ()
 
void SortKeysByTime (Bool bUndo=false, Bool SynchronizeKeys=false)
 

Start/End Time

BaseTime GetStartTime () const
 
BaseTime GetEndTime () const
 

Unmuted

const CKeyFindNextUnmuted (Int32 idx, Int32 *ret_idx=nullptr) const
 
CKeyFindNextUnmuted (Int32 idx, Int32 *ret_idx=nullptr)
 
const CKeyFindPrevUnmuted (Int32 idx, Int32 *ret_idx=nullptr) const
 
CKeyFindPrevUnmuted (Int32 idx, Int32 *ret_idx=nullptr)
 

Additional Inherited Members

- Public Member Functions inherited from BaseList2D
void SetBit (Int32 mask)
 
Bool GetBit (Int32 mask) const
 
void DelBit (Int32 mask)
 
void ToggleBit (Int32 mask)
 
Int32 GetAllBits () const
 
void SetAllBits (Int32 bits)
 
void SetBitEx (Int32 mask, Int32 flags)
 
const CharGetViewportRenderId (VIEWPORT_RENDER_ID typeId) const
 
BaseList2DGetNext ()
 
BaseList2DGetPred ()
 
BaseContainer GetData ()
 
void SetData (const BaseContainer &bc, Bool add=true)
 
const BaseContainerGetDataInstance () const
 
BaseContainerGetDataInstance ()
 
const BaseContainerGetDataInstanceRef () const
 
BaseContainerGetDataInstanceRef ()
 
String GetName () const
 
void SetName (const maxon::String &name)
 
String GetBubbleHelp ()
 
Bool TransferGoal (BaseList2D *dst, Bool undolink)
 
Bool TransferMarker (BaseList2D *dst) const
 
Bool Scale (Float scale)
 
Bool Edit ()
 
void GetIcon (IconData *dat)
 
GeListHeadGetNLARoot ()
 
BaseList2DAnimationLayerRemap (BaseObject **layer=nullptr)
 
String GetTypeName ()
 
BaseList2DGetMain () const
 
void InsertTrackSorted (CTrack *track)
 
Bool AddEventNotification (BaseList2D *bl, NOTIFY_EVENT eventid, NOTIFY_EVENT_FLAG flags, const BaseContainer *data)
 
Bool RemoveEventNotification (BaseDocument *doc, BaseList2D *bl, NOTIFY_EVENT eventid)
 
Bool FindEventNotification (BaseDocument *doc, BaseList2D *bl, NOTIFY_EVENT eventid)
 
Bool SetDescIDState (const DescID &id, DESCIDSTATE descidstate)
 
DESCIDSTATE GetDescIDState (const DescID &id, Bool tolerant) const
 
GeListHeadGetOverrideRoot ()
 
BaseOverrideGetFirstOverride ()
 
GeListHeadGetShaderRepositoryRoot ()
 
GeListHeadGetHiddenShaderRoot ()
 
maxon::NimbusForwardRef GetNimbusRef (const maxon::Id &spaceId) const
 
maxon::Result< maxon::NimbusForwardRefPrivateGetOrCreateNimbusRef (const maxon::Id &spaceId)
 
void RemoveNimbusRef (const maxon::Id &spaceId)
 
maxon::Result< maxon::HashMap< maxon::Id, maxon::NimbusForwardRef > > GetAllNimbusRefs () const
 
Bool IsNodeBased () const
 
void GetMarkerStampEx (UInt32 *l1, UInt32 *l2)
 
const GeMarkerGetMarker () const
 
void SetMarker (const GeMarker &m)
 
Bool AddUniqueID (Int32 appid, const Char *const mem, Int bytes)
 
Bool FindUniqueID (Int32 appid, const Char *&mem, Int &bytes) const
 
Int32 GetUniqueIDCount () const
 
Bool GetUniqueIDIndex (Int32 idx, Int32 &id, const Char *&mem, Int &bytes) const
 
Bool SetAnimatedParameter (CTrack *track, const DescID &id, const GeData &t_data1, const GeData &t_data2, Float mix, DESCFLAGS_SET flags)
 
Bool GetAnimatedParameter (const DescID &id, GeData &t_data1, GeData &t_data2, Float &mix, DESCFLAGS_GET flags)
 
BaseShaderGetFirstShader () const
 
void InsertShader (BaseShader *shader, BaseShader *pred=nullptr)
 
void ClearKeyframeSelection ()
 
Bool FindKeyframeSelection (const DescID &id)
 
Bool SetKeyframeSelection (const DescID &id, Bool selection)
 
Bool KeyframeSelectionContent ()
 
LayerObjectGetLayerObject (BaseDocument *doc)
 
Bool SetLayerObject (LayerObject *layer)
 
const LayerDataGetLayerData (BaseDocument *doc, Bool rawdata=false)
 
Bool SetLayerData (BaseDocument *doc, const LayerData &data)
 
GeListHeadGetCTrackRoot ()
 
CTrackGetFirstCTrack ()
 
CTrackFindCTrack (const DescID &id)
 
- Public Member Functions inherited from GeListNode
GeListNodeGetNext ()
 
GeListNodeGetPred ()
 
GeListNodeGetDown ()
 
GeListNodeGetUp ()
 
GeListNodeGetDownLast ()
 
void InsertBefore (GeListNode *bl)
 
void InsertAfter (GeListNode *bl)
 
void InsertUnder (GeListNode *bl)
 
void InsertUnderLast (GeListNode *bl)
 
void Remove ()
 
GeListHeadGetListHead ()
 
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 ()
 
BaseDocumentGetDocument ()
 
Int32 GetBranchInfo (BranchInfo *info, Int32 max, GETBRANCHINFO flags)
 
Bool IsDocumentRelated ()
 
Int32 GetInfo () const
 
Bool GetNBit (NBIT bit) const
 
UInt32 GetNBitMask (Int32 index) const
 
Bool ChangeNBit (NBIT bit, NBITCONTROL bitmode)
 
- 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)
 
Bool CopyTo (C4DAtom *dst, COPYFLAGS flags, AliasTrans *trn)
 
Bool Read (HyperFile *hf, Int32 id, Int32 level)
 
Bool Write (HyperFile *hf)
 
Bool ReadObject (HyperFile *hf, Bool readheader)
 
Bool WriteObject (HyperFile *hf)
 
Bool GetDescription (Description *description, DESCFLAGS_DESC flags)
 
Bool GetParameter (const DescID &id, GeData &t_data, DESCFLAGS_GET flags)
 
Bool SetParameter (const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
 
DynamicDescriptionGetDynamicDescription ()
 
Bool GetEnabling (const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc)
 
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)
 
- Static Public Member Functions inherited from BaseList2D
static BaseList2DAlloc (Int32 type)
 
static void Free (BaseList2D *&bl)
 
- Static Public Attributes inherited from BaseList2D
static const Int32 SETBIT_FLAG_NODIRTY
 
static const Int32 SETBIT_FLAG_REMOVE
 

Constructor & Destructor Documentation

◆ CCurve()

CCurve ( )
private

◆ ~CCurve()

~CCurve ( )
private

Member Function Documentation

◆ operator=()

const CCurve& operator= ( const CCurve seq)
private

◆ GetKeyCount()

Int32 GetKeyCount ( ) const

Gets the number of keys in the curve.

Returns
The number of keys.

◆ GetKey() [1/2]

const CKey* GetKey ( Int32  index) const

Gets the const key at index in the curve.

Parameters
[in]indexThe key index: 0 <= index < GetKeyCount()
Returns
The const key, or nullptr. The curve owns the pointed key.

◆ GetKey() [2/2]

CKey* GetKey ( Int32  index)

Gets the key at index in the curve.

Parameters
[in]indexThe key index: 0 <= index < GetKeyCount()
Returns
The key, or nullptr. The curve owns the pointed key.

◆ FindKey() [1/2]

const CKey* FindKey ( const BaseTime time,
Int32 idx = nullptr,
FINDANIM  match = FINDANIM::EXACT 
) const

Finds the const key at the given time.

Parameters
[in]timeThe time to find the key at.
[out]idxAssigned the index of the found key.
[in]matchThe search method.
Returns
The found const key, or nullptr. The curve owns the pointed key.

◆ FindKey() [2/2]

CKey* FindKey ( const BaseTime time,
Int32 idx = nullptr,
FINDANIM  match = FINDANIM::EXACT 
)

Finds the key at the given time.

Parameters
[in]timeThe time to find the key at.
[out]idxAssigned the index of the found key.
[in]matchThe search method: FINDANIM
Returns
The found key, or nullptr. The curve owns the pointed key.

◆ AddKey()

CKey* AddKey ( const BaseTime time,
Int32 nidx = nullptr,
Bool  bUndo = false,
Bool  SynchronizeKeys = false 
)

Adds a key to the curve.

Parameters
[in]timeThe time to add the key at.
[out]nidxAssigned the index of the added key.
[in]bUndoIf true this action will be undoable.
[in]SynchronizeKeysSince R18. If true the routine is called on other components of the vector (if valid). Curve must be part of a Track.
Returns
The added key. The curve owns the pointed key.

◆ AddKeyAdaptTangent()

CKey* AddKeyAdaptTangent ( const BaseTime time,
Bool  bUndo,
Int32 nidx = nullptr,
Bool  SynchronizeKeys = false 
)

Adds a key to the curve but retains the curve's current curvature.

Parameters
[in]timeThe time to add the key at.
[in]bUndoIf true this action will be undoable.
[out]nidxAssigned the new key index.
[in]SynchronizeKeysSince R18. If true the routine is called on other components of the vector (if valid). Curve must be part of a Track.
Returns
The added key, or nullptr if it failed.

◆ InsertKey()

Bool InsertKey ( CKey ckey,
Bool  bUndo = false,
Bool  SynchronizeKeys = false 
)

Inserts a key into the curve.

Parameters
[in]ckeyThe key to insert. The curve takes over the ownership of the pointed key.
[in]bUndoIf true this action will be undoable.
[in]SynchronizeKeysSince R18. If true the routine is called on other components of the vector (if valid). Curve must be part of a Track.
Returns
true if the key was inserted, otherwise false.

◆ DelKey()

Bool DelKey ( Int32  index,
Bool  bUndo = false,
Bool  SynchronizeKeys = false 
)

Deletes a key from the curve.

Parameters
[in]indexThe index of the key to delete: 0 <= index < GetKeyCount()
[in]bUndoIf true this action will be undoable.
[in]SynchronizeKeysSince R18. If true the routine is called on other components of the vector (if valid). Curve must be part of a Track.
Returns
true if the key was deleted, otherwise false.

◆ MoveKey()

Int32 MoveKey ( const BaseTime time,
Int32  idx,
CCurve dseq = nullptr,
Bool  bUndo = false,
Bool  SynchronizeKeys = false 
)

Moves a key in the curve.

Parameters
[in]timeThe time to move the key to.
[in]idxThe index of the key to move: 0 <= index < GetKeyCount()
[in]dseqAn optional destination curve to move the key to.
[in]bUndoIf true this action will be undoable.
[in]SynchronizeKeysSince R18. If true the routine is called on other components of the vector (if valid). Curve must be part of a Track.
Returns
The new index of the moved key.

◆ FlushKeys()

void FlushKeys ( Bool  bUndo = false,
Bool  SynchronizeKeys = false 
)

Removes all keys from the curve.

Parameters
[in]bUndoIf true this action will be undoable.
[in]SynchronizeKeysSince R18. If true the routine is called on other components of the vector (if valid). Curve must be part of a Track.

◆ CalcHermite()

Float64 CalcHermite ( Float64  time,
Float64  t1,
Float64  t2,
Float64  val1,
Float64  val2,
Float64  tan1_val,
Float64  tan2_val,
Float64  tan1_t,
Float64  tan2_t,
Bool  deriv 
) const

Calculates the Hermite spline between two sets of key values.

Note
Does not take into account any modes (like zero length), so this method should normally not be used. Call GetTangents() instead.
Warning
Only valid for 'Spline' interpolation curves.
Parameters
[in]timeThe time to evaluate.
[in]t1The first time.
[in]t2The second time.
[in]val1The first value.
[in]val2The second value.
[in]tan1_valThe first tangent value.
[in]tan2_valThe second tangent value.
[in]tan1_tThe first tangent time.
[in]tan2_tThe second tangent time.
[in]derivIf true the derivative is calculated instead of the value.
Returns
The spline value at the given coordinates/parameters.

◆ CalcSoftTangents()

void CalcSoftTangents ( Int32  kidx,
Float vl,
Float vr,
BaseTime tl,
BaseTime tr 
)

Calculates the soft tangents (i.e. auto interpolation) around a key.

Parameters
[in]kidxThe key index: 0 <= kidx < GetKeyCount()
[out]vlAssigned the left value.
[out]vrAssigned the right value.
[out]tlAssigned the left time.
[out]trAssigned the right time.

◆ GetTangents()

void GetTangents ( Int32  kidx,
Float64 vl,
Float64 vr,
Float64 tl,
Float64 tr 
)

Computes the tangents of a key, taking into account all options like zero slope, link slope etc.

Parameters
[in]kidxThe key index: 0 <= kidx < GetKeyCount()
[out]vlAssigned the left value.
[out]vrAssigned the right value.
[out]tlAssigned the left time.
[out]trAssigned the right time.

◆ AdjustTangentLength()

void AdjustTangentLength ( Float64  keyTime1,
Float64  keyTime2,
Float64 tan1_val,
Float64 tan2_val,
Float64 tan1Time,
Float64 tan2Time,
Bool  applyHermiteFactor 
) const

Adjusts Tangent Length to avoid curve intersection

Parameters
[in]keyTime1First key Time value.
[in]keyTime2Second key Time value.
[in,out]tan1_valFirst key right tangent value.
[in,out]tan2_valSecond key left tangent value.
[in,out]tan1TimeFirst key right tangent time.
[in,out]tan2TimeSecond key left tangent time.
[in]applyHermiteFactorApply the Hermite factor to tangent.

◆ AdjustTangentAutoWeight()

void AdjustTangentAutoWeight ( Int32  keyIndex)

Adjusts Tangent Time and Value to reflect an auto-tangent (slope is preserved). Consider if broken tangent is active for weighted auto-tangent

Parameters
[in]keyIndexThe key index: 0 <= kidx < GetKeyCount()

◆ GetValue()

Float GetValue ( const BaseTime time) const

Gets the value calculated at time, taking into account things like time curves.

Parameters
[in]timeThe time to calculate the value at.
Returns
The calculated value.

◆ GetTrack()

CTrack* GetTrack ( ) const

Gets the track of the curve.

Returns
The track.

◆ SetKeyDefault()

void SetKeyDefault ( BaseDocument doc,
Int32  kidx 
)

Sets the defaults for key kidx of the curve.
This includes lock, mute, clamp, break, auto properties, interpolation and tangents.
This setup a value and complete the missing properties with the defaults.

Parameters
[in]docThe curve's document.
[in]kidxThe key index.

◆ SetKeyDirty()

void SetKeyDirty ( )

Sets keys dirty.

Note
Equivalent to SetDirty(DIRTYFLAGS::CHILDREN).

◆ SortKeysByTime()

void SortKeysByTime ( Bool  bUndo = false,
Bool  SynchronizeKeys = false 
)

Private.

◆ GetStartTime()

BaseTime GetStartTime ( ) const

Gets the start time of the curve.

Returns
The start time of the curve.

◆ GetEndTime()

BaseTime GetEndTime ( ) const

Gets the end time of the curve.

Returns
The end time of the curve.

◆ FindNextUnmuted() [1/2]

const CKey* FindNextUnmuted ( Int32  idx,
Int32 ret_idx = nullptr 
) const

Finds the next unmuted key (read-only). The key index passed as argument is included in the test.

Parameters
[in]idxThe key index to start (included) the search from: 0 <= idx < GetKeyCount()
[out]ret_idxAssigned the found key index.
Returns
The first unmuted key founded in the next direction, or nullptr if there is none.

◆ FindNextUnmuted() [2/2]

CKey* FindNextUnmuted ( Int32  idx,
Int32 ret_idx = nullptr 
)

Finds the next unmuted key (writable).

Parameters
[in]idxThe key index to start (included) the search from: 0 <= idx < GetKeyCount()
[out]ret_idxAssigned the found key index.
Returns
The first unmuted key founded in the next direction, or nullptr if there is none.

◆ FindPrevUnmuted() [1/2]

const CKey* FindPrevUnmuted ( Int32  idx,
Int32 ret_idx = nullptr 
) const

Finds the previous unmuted key (read-only). The key index passed as argument is included in the test.

Parameters
[in]idxThe key index to start (included) the search from: 0 <= idx < GetKeyCount()
[out]ret_idxAssigned the found key index.
Returns
The first unmuted key founded in the previous direction, or nullptr if there is none.

◆ FindPrevUnmuted() [2/2]

CKey* FindPrevUnmuted ( Int32  idx,
Int32 ret_idx = nullptr 
)

Finds the previous unmuted key (writable). The key index passed as argument is included in the test.

Parameters
[in]idxThe key index to start (included) the search from: 0 <= idx < GetKeyCount()
[out]ret_idxAssigned the found key index.
Returns
The first unmuted key founded in the previous direction, or nullptr if there is none.