About
A CAMorph represents a morph of a CAPoseMorphTag. It allows access to the internally stored data and can apply this data to the host object. The class is defined in the lib_ca.h
header file.
Access
CAMorph elements are stored in a CAPoseMorphTag, see CAPoseMorphTag Manual.
const Int32 morphCount = poseMorphTag->GetMorphCount();
{
CAMorph*
const morph = poseMorphTag->GetMorph(
i);
if (morph == nullptr)
}
Py_ssize_t i
Definition: abstract.h:645
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
maxon::Int32 Int32
Definition: ge_sys_math.h:51
Allocation/Deallocation
CAMorph elements are created and deleted using the parent CAPoseMorphTag, see CAPoseMorphTag Manual.
poseMorphTag->ExitEdit(
doc,
false);
CAMorph* const morph = poseMorphTag->AddMorph();
if (morph == nullptr)
morph->SetName("New Morph");
poseMorphTag->UpdateMorphs();
const char * doc
Definition: pyerrors.h:226
Copy
The data stored in one CAMorph can be copied from a CAMorph to another CAMorph:
- CAMorph::CopyFrom(): Copies the data from the given source CAMorph.
poseMorphTag->ExitEdit(
doc,
false);
const Int32 activeIndex = poseMorphTag->GetActiveMorphIndex();
CAMorph* const activeMorph = poseMorphTag->GetMorph(activeIndex);
if (activeMorph == nullptr)
CAMorph* const morph = poseMorphTag->AddMorph();
if (morph == nullptr)
const String newName = activeMorph->GetName() + " Copy";
morph->SetName(newName);
const Int32 newIndex = poseMorphTag->GetMorphIndex(morph);
poseMorphTag->SetActiveMorphIndex(newIndex);
poseMorphTag->UpdateMorphs();
NONE
Definition: asset_browser.h:1
Properties
The internal data and several properties of a CAMorph can be edited through dedicated functions. But some properties can only be edited through the parent CAPoseMorphTag when the morph is selected. See Properties.
Name
Every CAMorph has a name:
- CAMorph::GetName(): Returns the name of the morph.
- CAMorph::SetName(): Sets the name of the morph.
ID
Every CAMorph has an internal ID:
- CAMorph::GetID(): Returns the internal ID of the morph.
Post Morph
A morph can be applied as a post-deform morph (ID_CA_POSE_MIXING_DEFORMED). If this is the case can be checked with:
- CAMorph::IsPostDeform(): Returns true if the morph is in post-deform mode.
CAMorphNode
The actual morph data is stored internally in CAMorphNode elements. See CAMorphNode Manual.
- CAMorph::Find(): Returns the CAMorphNode for the given BaseList2D element.
- CAMorph::GetNodeIndex(): Returns the index of the given CAMorphNode.
- CAMorph::FindIndex(): Returns the index of the CAMorphNode for the given BaseList2D element.
- CAMorph::FindFromIndex(): Returns the CAMorphNode for the given index.
- CAMorph::GetFirst(): Returns the first stored CAMorphNode.
Mode
To edit or access data stored in a CAMorph one must switch the morph to a certain mode:
- CAMorph::SetMode(): Sets the mode of the CAMorph.
Valid flags are:
The data modes are:
poseMorphTag->ExitEdit(
doc,
false);
const Int32 activeIndex = poseMorphTag->GetActiveMorphIndex();
CAMorph* const morph = poseMorphTag->GetMorph(activeIndex);
if (morph == nullptr)
CAMorphNode* const mnode = morph->GetFirst();
if (mnode == nullptr)
{
const Int32 pointCount = mnode->GetPointCount();
{
const Vector point = mnode->GetPoint(
i);
}
}
poseMorphTag->UpdateMorphs();
ALL
Filter for all types.
Definition: asset_browser.h:0
CAMORPH_MODE_FLAGS
Definition: lib_ca.h:849
AUTO
Definition: lib_birender.h:1
POINTS
Points morphing.
Definition: lib_ca.h:3
EXPAND
Expand data. Needs to be passed before accessing any data.
Definition: lib_ca.h:1
ABS
Absolute morph data.
Definition: lib_ca.h:0
COLLAPSE
Collapse data. Needs to be passed to collapse the expanded data, for instance after data access.
Definition: lib_ca.h:0
maxon::Vec3< maxon::Float64, 1 > Vector
Definition: ge_math.h:140
Target
A CAMorph can use an object as a reference:
- CAMorph::GetTarget(): Returns the target BaseList2D object.
- CAMorph::SetTarget(): Sets the given BaseList2D object as the target.
poseMorphTag->ExitEdit(
doc,
false);
CAMorph* const morph = poseMorphTag->AddMorph();
if (morph == nullptr)
morph->SetTarget(poseMorphTag,
doc, targetObject);
const Int32 newIndex = poseMorphTag->GetMorphIndex(morph);
poseMorphTag->SetActiveMorphIndex(newIndex);
poseMorphTag->UpdateMorphs();
const Int32 index = poseMorphTag->GetMorphIndex(morph);
poseMorphTag->SetActiveMorphIndex(
index);
Py_ssize_t * index
Definition: abstract.h:374
#define ConstDescID(...)
Definition: lib_description.h:592
@ ID_CA_POSE_MIXING
Definition: tcaposemorph.h:26
@ ID_CA_POSE_MIXING_ABS
Definition: tcaposemorph.h:89
Strength
The strength of a CAMorph controls how strongly it is applied to the host object.
- CAMorph::GetStrength(): Returns the strength of the morph.
- CAMorph::SetStrength(): Sets the strength of the morph.
poseMorphTag->ExitEdit(
doc,
false);
const Int32 activeMorphIndex = poseMorphTag->GetActiveMorphIndex();
const Int32 morphCount = poseMorphTag->GetMorphCount();
{
CAMorph*
const morph = poseMorphTag->GetMorph(
i);
if (morph == nullptr)
if (activeMorphIndex !=
i)
morph->SetStrength(0.0);
else
morph->SetStrength(1.0);
}
poseMorphTag->UpdateMorphs(
doc);
Object
The data stored in a CAMorph can be read from the host object and applied back to the host object:
- CAMorph::Store(): Stores the current object's state in the morph.
- CAMorph::Apply(): Applies the morph to the object.
The flags used to control what data is stored or applied are defined in ::CAMORPH_DATA_FLAGS. These flags are also used with CAMorphNode::GetInfo(), see CAMorphNode Manual.
poseMorphTag->ExitEdit(
doc,
false);
CAMorph* const morph = poseMorphTag->GetMorph(1);
if (morph)
{
}
Further Reading