CCurve Class Reference

#include <c4d_ccurve.h>

Inheritance diagram for CCurve:

Public Types

typedef BaseList2D SUPER
 
- Public Types inherited from BaseList2D
typedef GeListNode SUPER
 
- Public Types inherited from GeListNode
typedef PrivateChunk SUPER
 

Public Member Functions

virtual Bool IsInstanceOf (cineware::Int32 id) const
 
- Public Member Functions inherited from BaseList2D
 BaseList2D ()
 
virtual ~BaseList2D ()
 
BaseList2DGetNext ()
 
BaseList2DGetPred ()
 
NodeDataGetNodeData ()
 
void SetNodeData (NodeData *data)
 
void SetBit (Int32 mask)
 
Bool GetBit (Int32 mask)
 
void DelBit (Int32 mask)
 
void ToggleBit (Int32 mask)
 
Int32 GetAllBits ()
 
void SetAllBits (Int32 bits)
 
BaseContainer GetData ()
 
BaseContainerGetDataInstance ()
 
BaseContainerGetDataInstanceRef ()
 
const StringGetName ()
 
void SetName (const String &new_name)
 
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
 
BaseShaderGetFirstShader ()
 
Bool InsertShader (BaseShader *shader, BaseShader *pred=nullptr)
 
Bool InsertShaderLast (BaseShader *shader)
 
RootCTrackGetCTrackRoot ()
 
CTrackGetFirstCTrack ()
 
CTrackFindCTrack (const DescID &id)
 
Bool AppendCTrack (CTrack *t)
 
void InsertTrackSorted (CTrack *track)
 
virtual Int32 GetType () const
 
virtual Int32 GetDiskType () const
 
LayerObjectGetLayerObject ()
 
void SetLayerObject (LayerObject *layer)
 
const LayerDataGetLayerData (BaseDocument *doc, Bool rawdata=false)
 
Bool SetLayerData (BaseDocument *doc, const LayerData &data)
 
virtual BaseList2DGetClone (COPYFLAGS flags, AliasTrans *trans)
 
DynamicDescriptionGetDynamicDescription ()
 
virtual Bool IsBaseList ()
 
Bool SetDescIDState (const DescID &id, DESCIDSTATE descidstate)
 
DESCIDSTATE GetDescIDState (const DescID &id, Bool tolerant) const
 
RootPluginNodeGetOverrideRoot ()
 
BaseOverrideGetFirstOverride ()
 
virtual Bool TranslateDescID (const DescID &id, DescID &res_id, GeListNode *&res_at)
 
- Public Member Functions inherited from GeListNode
 GeListNode ()
 
 ~GeListNode ()
 
virtual Bool GetNBit (Int32 bit) const
 
virtual Bool ChangeNBit (NBIT bit, NBITCONTROL bitmode)
 
BaseDocumentGetDocument ()
 
virtual Int32 GetInfo ()
 
GeListNodeGetPred ()
 
GeListNodeGetNext ()
 
GeListNodeGetUp ()
 
GeListNodeGetDown ()
 
GeListNodeGetDownLast ()
 
void InsertBefore (GeListNode *op)
 
void InsertAfter (GeListNode *op)
 
void Remove ()
 
void InsertUnder (GeListNode *op)
 
void InsertUnderLast (GeListNode *op)
 
RootList2DGetListHead ()
 
Int32 GetNodeID (Int32 index=0) const
 
- Public Member Functions inherited from PrivateChunk
 PrivateChunk ()
 
Bool ReadChunk (HyperFile *hf, Bool keepin=false, Bool noheader=false)
 
virtual Bool IsListHead ()
 
Bool ReadObject (HyperFile *hf, Bool readheader)
 
Bool WriteObject (HyperFile *hf, Int32 type)
 
Bool CopyTo (PrivateChunk *dest, COPYFLAGS flags, AliasTrans *trans)
 
Bool GetParameter (Int32 id, GeData &data)
 
Bool SetParameter (Int32 id, const GeData &data)
 
Bool GetParameter (const DescID &id, GeData &data)
 
Bool SetParameter (const DescID &id, const GeData &data)
 
virtual Int32 GetChunkLevel ()
 
- Public Member Functions inherited from GeTempPublicNode2D< PrivateChunk >
PrivateChunkGetNext () const
 
PrivateChunkGetPrev () const
 
void InsertBefore (PrivateChunk *n)
 
void InsertAfter (PrivateChunk *n)
 
void Remove ()
 

Protected Member Functions

void CalcRemoveOvershoot (Int32 kidx, Float *vl, Float *vr, BaseTime *tl, BaseTime *tr) const
 
void AdjustTangentAutoWeight (Int32 keyIndex)
 
void CalcAutoWeight (Int32 kidx, Float *vl, Float *vr, BaseTime *tl, BaseTime *tr) const
 
- Protected Member Functions inherited from BaseList2D
void SetID (Int32 id)
 
virtual Bool GetDParameter (const DescID &id, GeData &data)
 
virtual Bool SetDParameter (const DescID &id, const GeData &data)
 
virtual Int32 GetInstanceType () const
 

Private Member Functions

 CCurve ()
 
 ~CCurve ()
 
const CCurveoperator= (const CCurve &seq)
 
Bool _LoadKeysHack ()
 
Float64 GetPercent (Float64 prevValue, Float64 nextValue) const
 
CKeyInsertKeyI (CKey *ckey, Int32 *idx)
 
virtual void InsertBefore (GeListNode *op)
 
virtual void InsertAfter (GeListNode *op)
 
virtual void Remove ()
 
virtual void InsertUnder (GeListNode *op)
 
virtual void InsertUnderLast (GeListNode *op)
 
virtual void FlushChilds ()
 

Private Attributes

GeTempDynArray< CKeym_keys
 
RootCKey m_root_key
 
CTrack_parentTrack
 

Friends

class CKey
 
class CTrack
 

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 synchronizeKeys=false)
 
CKeyAddKeyAdaptTangent (const BaseTime &time, Int32 *nidx=nullptr, Bool synchronizeKeys=false)
 
Bool InsertKey (const CKey *ckey, Bool synchronizeKeys=false)
 
Bool DelKey (Int32 index, Bool synchronizeKeys=false)
 
Int32 MoveKey (const BaseTime &time, Int32 idx, CCurve *dseq=nullptr, Bool synchronizeKeys=false)
 
void FlushKeys (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) const
 
void GetTangents (Int32 kidx, Float64 *vl, Float64 *vr, Float64 *tl, Float64 *tr) const
 
Float GetValue (const BaseTime &time) const
 

Miscellaneous

CTrackGetTrack ()
 
void SetKeyDefault (BaseDocument *doc, Int32 kidx)
 

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)
 

Private

virtual Bool CopyToX (PrivateChunk *dst, COPYFLAGS flags, AliasTrans *trans)
 
virtual Bool HandleSubChunk (HyperFile *hf, Int32 id, Int32 level)
 
virtual Bool Write (HyperFile *hf)
 
Float GetValueCached (const BaseTime &time, Float64 _time, GetValueCache *cache) const
 
void FlushKeysI ()
 

Additional Inherited Members

- Protected Attributes inherited from BaseList2D
Int32 m_id
 
RootShader mp_rootshader
 
RootShader mp_rootshader_hidden
 
RootShader root_shader_repository
 
Int32 l_bitfeld
 
RootCTrack mp_rootctrack
 
RootPluginNode root_override
 
NotifyListnotify_events
 
DescIdStorekeyframestore
 
DescIdStorepropstore
 
BaseContainer m_bc
 
NodeDatam_data
 
- Protected Attributes inherited from GeListNode
GeAliasGoal m_xgoal
 
UInt32 m_bits [4]
 
RootList2Dt_rootlist_parent
 
RootList2Dm_children
 
BaseDocumentparent_doc
 
void * unknownData
 
Int unknownDataSize
 
Int32 unknownDataLevel
 
Int32 pluginID
 

Detailed Description

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

Note
Cannot be allocated.

Member Typedef Documentation

◆ SUPER

typedef BaseList2D SUPER

Constructor & Destructor Documentation

◆ CCurve()

CCurve ( )
private

◆ ~CCurve()

~CCurve ( )
private

Member Function Documentation

◆ IsInstanceOf()

virtual Bool IsInstanceOf ( cineware::Int32  id) const
virtual

Reimplemented from BaseList2D.

◆ 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: FINDANIM
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  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]synchronizeKeysIf true the routine is called on other components of the vector (if valid). Curve must be part of a Track. Since 18.002
Returns
The added key. The curve owns the pointed key.

◆ AddKeyAdaptTangent()

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

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

Since
17.008 Removed parameter 'bUndo'.
Parameters
[in]timeThe time to add the key at.
[out]nidxAssigned the new key index.
[in]synchronizeKeysIf true the routine is called on other components of the vector (if valid). Curve must be part of a Track. Since 18.002
Returns
The added key, or nullptr if it failed.

◆ InsertKey()

Bool InsertKey ( const CKey ckey,
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]synchronizeKeysIf true the routine is called on other components of the vector (if valid). Curve must be part of a Track. Since 18.002
Returns
true if the key was inserted, otherwise false.

◆ DelKey()

Bool DelKey ( Int32  index,
Bool  synchronizeKeys = false 
)

Deletes a key from the curve.

Parameters
[in]indexThe index of the key to delete: 0 <= index < GetKeyCount()
[in]synchronizeKeysIf true the routine is called on other components of the vector (if valid). Curve must be part of a Track. Since 18.002
Returns
true if the key was deleted, otherwise false.

◆ MoveKey()

Int32 MoveKey ( const BaseTime time,
Int32  idx,
CCurve dseq = nullptr,
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]synchronizeKeysIf true the routine is called on other components of the vector (if valid). Curve must be part of a Track. Since 18.002
Returns
The new index of the moved key.

◆ FlushKeys()

void FlushKeys ( Bool  synchronizeKeys = false)

Removes all keys from the curve.

Parameters
[in]synchronizeKeysIf true the routine is called on other components of the vector (if valid). Curve must be part of a Track. Since 18.002

◆ 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 
) const

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 
) const

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.

◆ GetValue()

Float GetValue ( const BaseTime time) const

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

Since
17.008 Removed parameter 'fps'.
Parameters
[in]timeThe time to calculate the value at.
Returns
The calculated value.

◆ GetTrack()

CTrack* GetTrack ( )

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.

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

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

Parameters
[in]idxThe key index to start the search from: 0 <= idx < GetKeyCount()
[out]ret_idxAssigned the found key index.
Returns
The next unmuted key, 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 the search from: 0 <= idx < GetKeyCount()
[out]ret_idxAssigned the found key index.
Returns
The next unmuted key, 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).

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

◆ FindPrevUnmuted() [2/2]

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

Finds the previous unmuted key (writable).

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

◆ CopyToX()

virtual Bool CopyToX ( PrivateChunk dst,
COPYFLAGS  flags,
AliasTrans trans 
)
virtual

Private.

Reimplemented from BaseList2D.

◆ HandleSubChunk()

virtual Bool HandleSubChunk ( HyperFile hf,
Int32  id,
Int32  level 
)
virtual

Private.

Reimplemented from BaseList2D.

◆ Write()

virtual Bool Write ( HyperFile hf)
virtual

Private.

Reimplemented from BaseList2D.

◆ GetValueCached()

Float GetValueCached ( const BaseTime time,
Float64  _time,
GetValueCache cache 
) const

Private.

◆ FlushKeysI()

void FlushKeysI ( )

Private.

◆ CalcRemoveOvershoot()

void CalcRemoveOvershoot ( Int32  kidx,
Float vl,
Float vr,
BaseTime tl,
BaseTime tr 
) const
protected

◆ AdjustTangentAutoWeight()

void AdjustTangentAutoWeight ( Int32  keyIndex)
protected

◆ CalcAutoWeight()

void CalcAutoWeight ( Int32  kidx,
Float vl,
Float vr,
BaseTime tl,
BaseTime tr 
) const
protected

◆ operator=()

const CCurve& operator= ( const CCurve seq)
private

◆ _LoadKeysHack()

Bool _LoadKeysHack ( )
private

◆ GetPercent()

Float64 GetPercent ( Float64  prevValue,
Float64  nextValue 
) const
private

◆ InsertKeyI()

CKey* InsertKeyI ( CKey ckey,
Int32 idx 
)
private

◆ InsertBefore()

virtual void InsertBefore ( GeListNode op)
privatevirtual

◆ InsertAfter()

virtual void InsertAfter ( GeListNode op)
privatevirtual

◆ Remove()

virtual void Remove ( )
privatevirtual

Removes the node from its list.

Warning
When a base list is removed the owner become responsible for freeing it or passing its ownership to another list.

Reimplemented from BaseList2D.

◆ InsertUnder()

virtual void InsertUnder ( GeListNode op)
privatevirtual

◆ InsertUnderLast()

virtual void InsertUnderLast ( GeListNode op)
privatevirtual

◆ FlushChilds()

virtual void FlushChilds ( )
privatevirtual

Friends And Related Function Documentation

◆ CKey

friend class CKey
friend

◆ CTrack

friend class CTrack
friend

Member Data Documentation

◆ m_keys

GeTempDynArray<CKey> m_keys
private

◆ m_root_key

RootCKey m_root_key
private

◆ _parentTrack

CTrack* _parentTrack
private