KFCurveNode
#include<kfcurvenode.h>

List of all members.

Detailed Description

This class provides the structure to build a curve node hierarchy.

It is a composite class that contains curve node tree management services in itself. Cyclic graphs are forbidden in a curve node hierarchy.

The content of a curve node is in its function curve, which is an instance of classKFCurve. A function curve can't be shared among curve nodes.

Definition at line373of filekfcurvenode.h.


Constructors and Destructor

 KFCurveNode(char *pNodeName, char *pTimeWarpName, HKDataType pDataType, int pLayerType=KFCL_NOLAYER, int pLayerID=0)
 Constructor.
 KFCurveNode(HKFCurveNodepTemplateCurveNode)
 Template constructor.
virtual ~KFCurveNode()
 Destructor.

FCurve Creation

bool FCurveCreated()
 Test to know if the FCurve is created.

Cloning and Copy Functions

HKFCurveNode Clone(bool pKeepAttached)
 Return a duplicate of this node.
HKFCurveNode CloneTemplate(bool pKeepAttached=false, bool pCloneFCurves=false, bool pCreateCurves=false, int pLayerID=-1)
 Return a duplicate of this node.
void CopyFrom(HKFCurveNodepSource, bool pTransferCurve=false)
 Copy the function curve contained in the given curve node.
HKFCurveNode Copy(KTimepStart=KTIME_MINUS_INFINITE,KTimepStop=KTIME_INFINITE)
 Create a copy of the current curve node.

Node Identification

char * GetName()
 Retrieve the node's name.
char * GetTimeWarpName()
 Retrieve the node's timewrap name.
char * GetTypeName()
 Retrieve the node type name.

Function Curve Management

HKFCurve FCurveGet()
 Get pointer to the node's function curve.
KFCurveFCurveSet(KFCurve*pCurve, bool pDestroyOldCurve=false)
 Set the function curve of this curve node.
void FCurveReplace(KFCurve*pCurve)
 Replace the function curve of this curve node.
bool GetTransformCurves(KFCurve*pT[3],KFCurve*pR[3],KFCurve*pS[3])
 Return translation, rotation and scaling curves of the children of this curve node.

Curve Node Management

virtual void Clear()
 Clear this node.
virtual int Add(HKFCurveNodepCurveNode)
 Add a child curve node to this node.
virtual void Remove(int pIndex)
 Remove a child curve node by index.
virtual void Delete(int pIndex)
 Remove and delete a child curve node by index.
virtual int GetCount()
 Get children curve nodes count.
virtualHKFCurveNode Get(int pIndex)
 Get pointer to child curve node by index.
virtual bool IsChild(KFCurveNode*pCurveNode, bool pRecursive=false)
 Ask if a given curve node is a child of the current curve node.
virtual int Find(char *pName)
 Get index of child curve node by name.
virtual int Find(HKFCurveNodepNode)
 Get index of child curve node by pointer.
HKFCurveNode FindRecursive(char *pName)
 Recursively find the first child curve node by name.
HKFCurveNode FindOrCreate(char *pName, bool pFindOrCreateCurve=true)
 Find a child node by name or create it if it can not be found.
virtual void SetParent(HKFCurveNodepParent)
 Set the parent curve node.
virtualHKFCurveNode GetParent()
 Get the parent curve node.

Key Management

int KeyGetCount(bool pRecursiveInLayers=false)
 Get the number of animation keys.
void KeyGetCount(int&pCurveCount, int&pTotalCount, int&pMinCount, int&pMaxCount)
 Get the number of animation keys.
void GetCurveWithFirstKey(KFCurve*&lCurveWithFirstKey, bool *pCurveMask, bool pRecursiveInLayers)
 Get the number of animation keys.
void GetCurveWithLastKey(KFCurve*&lCurveWithLastKey, bool *pCurveMask, bool pRecursiveInLayers)
 Get the number of animation keys.
KTime GetFirstKeyTime(bool *pCurveMask=NULL, bool pRecursiveInLayers=false)
 Get the number of animation keys.
KTime GetLastKeyTime(bool *pCurveMask=NULL, bool pRecursiveInLayers=false)
 Get the number of animation keys.
double * KeyAdd(KTimepTime, double *pValue)
 Recursively add a set of keys in the curve node tree.
double * KeyAppend(KTimepTime, double *pValue, bool pCheckForContinuousRotation=false)
 Recursively append a set of keys in the curve node tree.
bool GetAnimationInterval(KTime&pStart,KTime&pStop)
 Find out start and stop time of the animation for a curve node and recursively in its children.
void GetTimeSpan(KTime&pStart,KTime&pStop)
 Find out start and stop time of the animation for a curve node and recursively in it's children.
int IsKey(KTime&pTime, int *pLast, bool *pCurveMask=NULL, double pKeyIndexTolerance=0.0, double pMin=-K_DOUBLE_MAX, double pMax=K_DOUBLE_MAX)
 Recursively check if keys exist at a given time in the curve node tree.
bool DeleteKey(KTime&pTime, bool *pCurveMask=NULL, double pKeyIndexTolerance=0.0)
 Recursively delete keys at a given time in the curve node tree.
KTime GetNextKeyTime(KTimepTime, bool *pCurveMask=NULL, bool pRecursiveInLayers=false)
 Recursively find the closest later time at which a key can be found compared to a given time.
KTime GetPrevKeyTime(KTimepTime, bool *pCurveMask=NULL)
 Recursively find the closest ealier time at which a key can be found compared to a given time.
double * Evaluate(double *pValue,KTimepTime, kFCurveIndex *pLast=NULL)
 Recursively evaluate the curve node tree.
double * GetValue(double *pValue)
 Recursively get the default values of the curve node tree.
double * SetValue(double *pValue)
 Recursively set the default values of the curve node tree.
void Delete(KTimepStart=KTIME_MINUS_INFINITE,KTimepStop=KTIME_INFINITE)
 Delete all the keys found within a given time range.
void Replace(HKFCurveNodepSource,KTimepStart=KTIME_MINUS_INFINITE,KTimepStop=KTIME_INFINITE, bool pUseGivenSpan=false, bool pKeyStartEndOnNoKey=true,KTimepTimeSpanOffset=KTIME_ZERO)
 Replace all the keys found within a given time range.

Constructor&Destructor Documentation

KFCurveNode(char * pNodeName,
char * pTimeWarpName,
HKDataType pDataType,
int pLayerType=KFCL_NOLAYER,
int pLayerID=0 
)

Constructor.

Parameters:
pNodeName Curve node name.
pTimeWarpName Curve node.
pDataType Curve node type.
pLayerType LayerType.
pLayerID LayerID.
Remarks:
No function curve is created in the new curve node.

KFCurveNode(HKFCurveNode pTemplateCurveNode ) 

Template constructor.

Parameters:
pTemplateCurveNode Template curve node.
Remarks:
This is not a copy constructor. This constructor makes the created curve node share a structure that defines the node name, node display name and node type name. No function curve is created or copied in the new curve node.

virtual ~KFCurveNode( ) [virtual]

Destructor.

Member Function Documentation

bool FCurveCreated( ) 

Test to know if the FCurve is created.

This function is called recursively for all children curve nodes. It returns false as soon as one child does not have its FCurve.

HKFCurveNodeClone(bool pKeepAttached ) 

Return a duplicate of this node.

This function is called recursively for all children curve nodes. The function curve is copied in the new curve node.

Parameters:
pKeepAttached Iftrue, the created object will share a structure that defines the node name, node display name and node type name. Otherwise, this structure is copied.
Remarks:
This function is equal to a call toKFCurveNode::CloneTemplate()with parameterpCloneFCurvesset totrue.
Returns:
A partial or complete copy of the current object.

HKFCurveNodeCloneTemplate(bool pKeepAttached=false,
bool pCloneFCurves=false,
bool pCreateCurves=false,
int pLayerID=-1 
)

Return a duplicate of this node.

This function is called recursively for all children curve nodes.

Parameters:
pKeepAttached Iftrue, the created object will share a structure that defines the node name, node display name and node type name. Otherwise, this structure is copied.
pCloneFCurves Iftrueand the current curve node has a function curve, the function curve is copied in the new curve node.
pCreateCurves Iftrue,pCloneFCurveis set tofalseand the current curve node has a function curve, an empty function curve is created in the new curve node.
pLayerID LayerID.
Returns:
A partial or complete copy of the current object.

void CopyFrom(HKFCurveNode pSource,
bool pTransferCurve=false 
)

Copy the function curve contained in the given curve node.

Parameters:
pSource Given curve node to copy the function curve from.
pTransferCurve Iftrue, curve data is transferred instead of being copied.
Remarks:
This function is called recursively. The first child curve node ofpSourceis copied in the first child curve node of the current object and so on.

HKFCurveNodeCopy(KTime pStart=KTIME_MINUS_INFINITE,
KTime pStop=KTIME_INFINITE 
)

Create a copy of the current curve node.

The structure defining the node name, node display name and node type name is copied, not shared. Only the animation keys in a given time range are copied.

Parameters:
pStart Start time for range of animation keys copied.
pStop Stop time for range of animation keys copied.
Returns:
A partial or complete copy of the current object.

char* GetName( ) 

Retrieve the node's name.

char* GetTimeWarpName( ) 

Retrieve the node's timewrap name.

char* GetTypeName( ) 

Retrieve the node type name.

HKFCurveFCurveGet( ) 

Get pointer to the node's function curve.

Returns:
Pointer to the curve orNULLpointer if there's none.

KFCurve* FCurveSet(KFCurvepCurve,
bool pDestroyOldCurve=false 
)

Set the function curve of this curve node.

Parameters:
pCurve New function curve.
pDestroyOldCurve Set totrueto delete the function curve already contained in the curve node.
Returns:
Function curve previously contained in the curve node if there was any and if parameterpDestroyOldCurveis set tofalse. Otherwise,NULLis returned.

void FCurveReplace(KFCurvepCurve ) 

Replace the function curve of this curve node.

Previous function curve is automatically destroyed.

Parameters:
pCurve New function curve.
Remarks:
This function is equal to a call toKFCurveNode::FCurveSet()with parameterpDestroyOldCurveset totrue.

bool GetTransformCurves(KFCurvepT[3],
KFCurvepR[3],
KFCurvepS[3] 
)

Return translation, rotation and scaling curves of the children of this curve node.

This function is meant to be called on the rootKFCurveNodeobject found in classKFbxTakeNode.

Parameters:
pT Array to receive X, Y and Z translation function curves.
pR Array to receive X, Y and Z rotation function curves.
pS Array to receive X, Y and Z scaling function curves.
Returns:
trueif all function curves have been found,falseotherwise.

virtual void Clear( ) [virtual]

Clear this node.

Delete the function curve and all the children curve nodes.

virtual int Add(HKFCurveNode pCurveNode ) [virtual]

Add a child curve node to this node.

virtual void Remove(int pIndex ) [virtual]

Remove a child curve node by index.

Parameters:
pIndex Index of child curve node to be removed.

virtual void Delete(int pIndex ) [virtual]

Remove and delete a child curve node by index.

Parameters:
pIndex Index of child curve node to be deleted.

virtual int GetCount( ) [virtual]

Get children curve nodes count.

virtualHKFCurveNodeGet(int pIndex ) [virtual]

Get pointer to child curve node by index.

Parameters:
pIndex Index of child curve node.
Returns:
Pointer to child curve node orNULLis index is out of bounds.

virtual bool IsChild(KFCurveNodepCurveNode,
bool pRecursive=false 
)[virtual]

Ask if a given curve node is a child of the current curve node.

Parameters:
pCurveNode Curve node searched.
pRecursive Set totrueto search recursively. Set tofalseto search only in the immediate children curve nodes.
Returns:
trueif the curve node searched is found,falseotherwise.

virtual int Find(char * pName ) [virtual]

Get index of child curve node by name.

Parameters:
pName Name of searched child curve node.
Returns:
Index or -1 if a child curve node with this name could not be found.
Remarks:
This function is not recursive.

virtual int Find(HKFCurveNode pNode ) [virtual]

Get index of child curve node by pointer.

Parameters:
pNode Pointer to searched child curve node.
Returns:
Index or -1 if a child curve node with this pointer could not be found.
Remarks:
This function is not recursive.

HKFCurveNodeFindRecursive(char * pName ) 

Recursively find the first child curve node by name.

Parameters:
pName Name of searched child curve node.
Returns:
Pointer to child curve node orNULLif this name could not be found.

HKFCurveNodeFindOrCreate(char * pName,
bool pFindOrCreateCurve=true 
)

Find a child node by name or create it if it can not be found.

Parameters:
pName Name of child node to find.
pFindOrCreateCurve Iftrueand the function curve does not exist, create one in the curve node found or created.
Remarks:
This function is not recursive.

virtual void SetParent(HKFCurveNode pParent ) [inline, virtual]

Set the parent curve node.

Definition at line617of filekfcurvenode.h.

virtualHKFCurveNodeGetParent( ) [inline, virtual]

Get the parent curve node.

Returns:
Pointer to the parent curve node orNULLif there is none.

Definition at line622of filekfcurvenode.h.

int KeyGetCount(bool pRecursiveInLayers=false ) 

Get the number of animation keys.

Return the total number of keys contained in the function curves included in the current node and its children curve nodes.

void KeyGetCount(int& pCurveCount,
int& pTotalCount,
int& pMinCount,
int& pMaxCount 
)

Get the number of animation keys.

Parameters:
pCurveCount returns the number of fcurves held by this node
pTotalCount returns the number of keys on all the fcurves held by this node
pMinCount returns the minimum number of keys on an fcurve held by this node
pMaxCount returns the maximum number of keys on an fcurve held by this node

void GetCurveWithFirstKey(KFCurve*& lCurveWithFirstKey,
bool * pCurveMask,
bool pRecursiveInLayers 
)

Get the number of animation keys.

Return the total number of keys contained in the function curves included in the current node and its children curve nodes.

void GetCurveWithLastKey(KFCurve*& lCurveWithLastKey,
bool * pCurveMask,
bool pRecursiveInLayers 
)

Get the number of animation keys.

Return the total number of keys contained in the function curves included in the current node and its children curve nodes.

KTimeGetFirstKeyTime(bool * pCurveMask=NULL,
bool pRecursiveInLayers=false 
)

Get the number of animation keys.

Return the total number of keys contained in the function curves included in the current node and its children curve nodes.

KTimeGetLastKeyTime(bool * pCurveMask=NULL,
bool pRecursiveInLayers=false 
)

Get the number of animation keys.

Return the total number of keys contained in the function curves included in the current node and its children curve nodes.

double* KeyAdd(KTime pTime,
double * pValue 
)

Recursively add a set of keys in the curve node tree.

Depth first key adding in the function curves included in the current node and its children curve nodes.

Parameters:
pTime Time to add the keys.
pValue Array containing all the key values. This array must contain as many elements as the number of function curves included in the current node and its children curve nodes.
Returns:
Value of parameterpValueadded with an offset equal to the number of affected function curves timessizeof(kDouble).

double* KeyAppend(KTime pTime,
double * pValue,
bool pCheckForContinuousRotation=false 
)

Recursively append a set of keys in the curve node tree.

Depth first key appending in the function curves included in the current node and its children curve nodes.

Parameters:
pTime Time set in the appended keys. Make sure this time has a greater value than any of the last keys in the affected function curves.
pValue Array containing all the key values. This array must contain as many elements as the number of function curves included in the current node and its children curve nodes.
pCheckForContinuousRotation Flag, when set to true we will check for continuous rotation values. This is like an unroll filter on the fly. Relevant only for rotation fcurve nodes.
Returns:
Value of parameterpValueadded with an offset equal to the number of function curves affected timessizeof(kDouble).

bool GetAnimationInterval(KTimepStart,
KTimepStop 
)

Find out start and stop time of the animation for a curve node and recursively in its children.

Parameters:
pStart Reference to store start time.pStartis overwritten only if the start time found is lower thanpStartvalue. Initialize to KTIME_INFINITE to make sure the start time is overwritten in any case.
pStop Reference to store end time.pStopis overwritten only if the stop time found is higher thanpStopvalue. Initialize to KTIME_MINUS_INFINITE to make sure the stop time is overwritten in any case.
Returns:
trueif at least one key has been found in all the function curves scanned.

void GetTimeSpan(KTimepStart,
KTimepStop 
)

Find out start and stop time of the animation for a curve node and recursively in it's children.

Parameters:
pStart Reference to receive the smaller key time, set to KTIME_INFINITE if no key could be found.
pStop Reference to receive the larger key time, set to KTIME_MINUS_INFINITE if no key could be found.

int IsKey(KTimepTime,
int * pLast,
bool * pCurveMask=NULL,
double pKeyIndexTolerance=0.0,
double pMin=-K_DOUBLE_MAX,
double pMax=K_DOUBLE_MAX 
)

Recursively check if keys exist at a given time in the curve node tree.

Check if a key exists at the given time in the function curves included in the current node and its children curve nodes.

Parameters:
pTime Given time to check key occurence.
pLast Function curve index to speed up search. If this function is called in a loop, initialize this value to 0 and let it be updated by each call.
pCurveMask allows you to use only specific children in the CurveNode. NULL means all of them.
pKeyIndexTolerance allows the test to be less strict when matching the time with a key index.
pMin Minimal Value to Consider the Key.
pMax Maximal Value to Consider the Key.
Returns:
ISKEY_NONEif no function curve has a key at the given time,ISKEY_SOMEif some function curves have a key at the given time orISKEY_ALLif all function curves have a key at the given time.

bool DeleteKey(KTimepTime,
bool * pCurveMask=NULL,
double pKeyIndexTolerance=0.0 
)

Recursively delete keys at a given time in the curve node tree.

Delete keys at the given time in the function curves included in the current node and its children curve nodes.

Parameters:
pTime Given time to delete keys.
pCurveMask allows you to use only specific children in the CurveNode. NULL means all of them.
pKeyIndexTolerance allows to be less strict when matching the time with a key index.
Returns:
trueif at least one key has been found at the given time and deleted.

KTimeGetNextKeyTime(KTime pTime,
bool * pCurveMask=NULL,
bool pRecursiveInLayers=false 
)

Recursively find the closest later time at which a key can be found compared to a given time.

Find the closest but later time at which a key can be found compared to a given time in the function curves included in the current node and its children curve nodes.

Parameters:
pTime Given time to search the next key time.
pCurveMask allows you to use only specific children in the CurveNode. NULL means all of them.
pRecursiveInLayers 
Returns:
Next key time or KTIME_INFINITE if there exists no key with a time larger than the given time.

KTimeGetPrevKeyTime(KTime pTime,
bool * pCurveMask=NULL 
)

Recursively find the closest ealier time at which a key can be found compared to a given time.

Find the closest earlier time at which a key can be found compared to a given time in the function curves included in the current node and its children curve nodes.

Parameters:
pTime Given time to search the previous key time.
pCurveMask allows you to use only specific children in the CurveNode. NULL means all of them.
Returns:
Previous key time or KTIME_MINUS_INFINITE if there exists no key with a time smaller than the given time.

double* Evaluate(double * pValue,
KTime pTime,
kFCurveIndex * pLast=NULL 
)

Recursively evaluate the curve node tree.

Depth first evaluation of the function curves included in the current node and its children curve nodes.

Parameters:
pValue Array to receive all the function curve evaluations. This array must be long enough to contain as many elements as the number of function curves included in the current node and its children curve nodes.
pTime Time of evaluation.
pLast Function curve index to speed up evaluation. If this function is called in a loop, initialize this value to 0 and let it be updated by each call.
Returns:
Value of parameterpValueadded with an offset equal to the number of function curves evaluated timessizeof(double).

double* GetValue(double * pValue ) 

Recursively get the default values of the curve node tree.

Depth first access to the default values of the function curves included in the current node and its children curve nodes.

Parameters:
pValue Array to receive all the function curve default values. This array must be long enough to contain as many elements as the number of function curves included in the current node and its children curve nodes.
Returns:
Value of parameterpValueadded with an offset equal to the number of function curves accessed timessizeof(double).

double* SetValue(double * pValue ) 

Recursively set the default values of the curve node tree.

Depth first setting of the default values of the function curves included in the current node and its children curve nodes.

Parameters:
pValue Array containing all the function curve default values. This array must contain as many elements as the number of function curves included in the current node and its children curve nodes.
Returns:
Value of parameterpValueadded with an offset equal to the number of function curves set timessizeof(double).

void Delete(KTime pStart=KTIME_MINUS_INFINITE,
KTime pStop=KTIME_INFINITE 
)

Delete all the keys found within a given time range.

Delete all the keys found within a given time range in the function curves included in the current node and its children curve nodes.

Parameters:
pStart Beginning of time range.
pStop End of time range.

void Replace(HKFCurveNode pSource,
KTime pStart=KTIME_MINUS_INFINITE,
KTime pStop=KTIME_INFINITE,
bool pUseGivenSpan=false,
bool pKeyStartEndOnNoKey=true,
KTime pTimeSpanOffset=KTIME_ZERO 
)

Replace all the keys found within a given time range.

Replace all the keys found within a given time range in the function curves included in the current node and its children curve nodes.

Parameters:
pSource Source node tree containing the replacement keys. The curve node tree belowpSourcemust be identical to the curve node tree below the current node.
pStart Beginning of time range.
pStop End of time range.
pUseGivenSpan false = original behavior where the time of the first and last key was used
pKeyStartEndOnNoKey Inserts a key at the beginning and at the end of the range if there is no key to insert.
pTimeSpanOffset