CAMorph Class Reference

#include <lib_ca.h>

Detailed Description

CAMorph class contains the data for each morph. It has to be retrieved from the CAPoseMorphTag.

See also
CAMorphNode for an example.

Public Member Functions

Bool IsPostDeform ()
 

Private Member Functions

 CAMorph ()
 
 ~CAMorph ()
 

Name

String GetName ()
 
void SetName (const String &name)
 

Miscellaneous

Int32 GetID ()
 
Bool CopyFrom (CAMorph *src, AliasTrans *trn, CAMORPH_COPY_FLAGS flags)
 

Morph Node

CAMorphNodeFind (CAPoseMorphTag *tag, BaseList2D *bl)
 
Int32 GetNodeIndex (CAMorphNode *node)
 
Int32 FindIndex (CAPoseMorphTag *tag, BaseList2D *bl)
 
CAMorphNodeFindFromIndex (CAPoseMorphTag *tag, Int32 index)
 
CAMorphNodeGetFirst ()
 

Morph

Bool SetMode (BaseDocument *doc, CAPoseMorphTag *tag, CAMORPH_MODE_FLAGS flags, CAMORPH_MODE mode)
 
Bool Store (BaseDocument *doc, CAPoseMorphTag *tag, CAMORPH_DATA_FLAGS flags)
 
Bool Apply (BaseDocument *doc, CAPoseMorphTag *tag, CAMORPH_DATA_FLAGS flags)
 

Target

BaseList2DGetTarget (BaseDocument *doc)
 
void SetTarget (CAPoseMorphTag *tag, BaseDocument *doc, BaseList2D *bl)
 

Strength

void SetStrength (Float strength)
 
Float GetStrength ()
 

Constructor & Destructor Documentation

◆ CAMorph()

CAMorph ( )
private

◆ ~CAMorph()

~CAMorph ( )
private

Member Function Documentation

◆ GetName()

String GetName ( )

Retrieves the name of the morph.

Returns
The name of the morph.

◆ SetName()

void SetName ( const String name)

Sets the name of the morph.

Parameters
[in]nameThe new name of the morph.

◆ GetID()

Int32 GetID ( )

Retrieves the internal ID of the morph. Each morph has an ID. This ensures that removed morphs do not affect the DescID for the sliders.

Returns
The internal ID of the morph.

◆ CopyFrom()

Bool CopyFrom ( CAMorph src,
AliasTrans trn,
CAMORPH_COPY_FLAGS  flags 
)

Copies morph data from src.

Parameters
[in]srcThe source morph.
[in]trnAn alias translator for the operation. Can be nullptr. The caller owns the pointed alias translator.
[in]flagsThe flags: CAMORPH_COPY_FLAGS
Returns
true if successful, otherwise false.

◆ Find()

CAMorphNode* Find ( CAPoseMorphTag tag,
BaseList2D bl 
)

Retrieves the morph node for the object specified by bl.

Note
A single morph can be applied to a hierarchy of objects, each has a representation in the morph as a CAMorphNode.
Parameters
[in]tagThe morph tag containing the morph node.
[in]blThe object connected to the morph node.
Returns
The morph node for the specified object. The tag owns the pointed morph node.

◆ GetNodeIndex()

Int32 GetNodeIndex ( CAMorphNode node)

Retrieves the index of the specified morph node. Each morph node can be accessed through their indices.

Parameters
[in]nodeThe morph node to request the index.
Returns
The morph node index.

◆ FindIndex()

Int32 FindIndex ( CAPoseMorphTag tag,
BaseList2D bl 
)

Retrieves the index of the morph node for the object specified by bl.

Note
A single morph can be applied to a hierarchy of objects, each has a representation in the morph as a CAMorphNode.
Parameters
[in]tagThe morph tag containing the morph node.
[in]blThe object connected to the morph node.
Returns
The index of the morph node of the specified object.

◆ FindFromIndex()

CAMorphNode* FindFromIndex ( CAPoseMorphTag tag,
Int32  index 
)

Retrieves the morph node specified by index.

Note
A single morph can be applied to a hierarchy of objects, each has a representation in the morph as a CAMorphNode.
Parameters
[in]tagThe morph tag containing the morph node.
[in]indexThe index of the requested morph node.
Returns
The found morph node. The tag owns the pointed morph node.

◆ GetFirst()

CAMorphNode* GetFirst ( )

Retrieves the first node of the morph.

Returns
The first morph node. The tag owns the pointed morph node.

◆ SetMode()

Bool SetMode ( BaseDocument doc,
CAPoseMorphTag tag,
CAMORPH_MODE_FLAGS  flags,
CAMORPH_MODE  mode 
)

Changes the morph's mode.

Note
This is not the mode a user would change but data inside the morph. It must be restored to the original mode once changes are finished.
To change the morph tag's modes or parameters use C4DAtom::SetParameter().

Example: Point data could be stored as rotational or correctional and in a delta form (only differences from the base).
This can not be edited in this form so the data mode must be changed to relative (CAMORPH_MODE::REL) or absolute (CAMORPH_MODE::ABS) before editing and then restored to (CAMORPH_MODE::AUTO) when finished.
The flags must be passed as CAMORPH_MODE_FLAGS::EXPAND to expand the data from the delta form and then returned with CAMORPH_MODE_FLAGS::COLLAPSE when finished.
For example VAMP uses the following line to expand all data types to relative data:

It then does some changes and finally restores all types to collapsed (delta) form and to the users mode (AUTO):

data.sources[i]->SetMode(doc, data.s_morphtag, CAMORPH_MODE_FLAGS::ALL|CAMORPH_MODE_FLAGS::COLLAPSE,CAMORPH_MODE::AUTO);
Parameters
[in]docThe document containing the morph tag.
[in]tagThe morph tag containing the morph data.
[in]flagsThe flags: CAMORPH_MODE_FLAGS
[in]modeThe mode: CAMORPH_MODE
Returns
true if successful, otherwise false.

◆ Store()

Bool Store ( BaseDocument doc,
CAPoseMorphTag tag,
CAMORPH_DATA_FLAGS  flags 
)

Stores the current object's state into the morph.
The corresponding flags have to be set for the data. This should normally be CAMORPH_DATA_FLAGS::ASTAG if it is to be used by the user.

Parameters
[in]docThe document containing the morph tag.
[in]tagThe morph tag containing the morph data.
[in]flagsThe flags: CAMORPH_DATA_FLAGS
Returns
true if successful, otherwise false.

◆ Apply()

Bool Apply ( BaseDocument doc,
CAPoseMorphTag tag,
CAMORPH_DATA_FLAGS  flags 
)

Applies the morph to the object. The data to be applied is set with the flags.

Parameters
[in]docThe document containing the morph tag.
[in]tagThe morph tag containing the morph data.
[in]flagsThe flags: CAMORPH_DATA_FLAGS
Returns
true if successful, otherwise false.

◆ GetTarget()

BaseList2D* GetTarget ( BaseDocument doc)

Retrieves the target of the morph.

Parameters
[in]docThe document containing the morph tag.
Returns
The target of the morph. The tag owns the pointed object.

◆ SetTarget()

void SetTarget ( CAPoseMorphTag tag,
BaseDocument doc,
BaseList2D bl 
)

Sets the target of the morph.

Parameters
[in]tagThe morph tag containing the morph node.
[in]docThe document containing the morph tag.
[in]blThe new target of the morph.

◆ SetStrength()

void SetStrength ( Float  strength)

Sets the strength of the morph.

Parameters
[in]strengthThe new strength of the morph.

◆ GetStrength()

Float GetStrength ( )

Retrieves the strength of the morph.

Returns
The strength of the morph.

◆ IsPostDeform()

Bool IsPostDeform ( )

Retrieves if the morph is applied at PostDeform.

Returns
Morph is post-deform mode.