CAMorph Manual

内容表

关于

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 ,见 CAPoseMorphTag Manual .

// This example loops through all morphs of the given // CAPoseMorphTag and prints the morph name.
const Int32 morphCount = poseMorphTag->GetMorphCount();
for ( Int32 i = 0; i < morphCount; ++i) { CAMorph * const morph = poseMorphTag->GetMorph(i); if (morph == nullptr ) return maxon::UnexpectedError( MAXON_SOURCE_LOCATION );

// print morph name ApplicationOutput ( "Morph: " + morph-> GetName ()); }

Allocation/Deallocation

CAMorph elements are created and deleted using the parent CAPoseMorphTag ,见 CAPoseMorphTag Manual .

// This example adds a new morph to the given CAPoseMorphTag. poseMorphTag->ExitEdit(doc, false ); CAMorph * const morph = poseMorphTag->AddMorph(); if (morph == nullptr ) return maxon::OutOfMemoryError( MAXON_SOURCE_LOCATION ); morph-> SetName ( "New Morph" ); poseMorphTag->UpdateMorphs();

拷贝

The data stored in one CAMorph can be copied from a CAMorph to another CAMorph :

// This example copies the currently active morph // and makes the copy the new active morph. poseMorphTag->ExitEdit(doc, false );

// get active morph const Int32 activeIndex = poseMorphTag->GetActiveMorphIndex(); CAMorph * const activeMorph = poseMorphTag->GetMorph(activeIndex); if (activeMorph == nullptr ) return maxon::UnexpectedError( MAXON_SOURCE_LOCATION );

// create new morph CAMorph * const morph = poseMorphTag->AddMorph(); if (morph == nullptr ) return maxon::OutOfMemoryError( MAXON_SOURCE_LOCATION );

// copy morph morph-> CopyFrom (activeMorph, nullptr , CAMORPH_COPY_FLAGS::NONE ); const String newName = activeMorph-> GetName () + " Copy" ; morph-> SetName (newName);

// set new morph as active morph const Int32 newIndex = poseMorphTag->GetMorphIndex(morph); poseMorphTag->SetActiveMorphIndex(newIndex); poseMorphTag->UpdateMorphs();

特性

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 特性 .

名称

Every CAMorph has a name:

ID

Every CAMorph has an internal ID:

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:

CAMorphNode

The actual morph data is stored internally in CAMorphNode elements. See CAMorphNode Manual .

模式

To edit or access data stored in a CAMorph one must switch the morph to a certain mode:

Valid flags are:

The data modes are:

// This example accesses the morph data of the // first morph of the given CAPoseMorphTag. poseMorphTag->ExitEdit(doc, false );

// get active morph const Int32 activeIndex = poseMorphTag->GetActiveMorphIndex(); CAMorph * const morph = poseMorphTag->GetMorph(activeIndex); if (morph == nullptr ) return maxon::UnexpectedError( MAXON_SOURCE_LOCATION ); CAMorphNode * const mnode = morph-> GetFirst (); if (mnode == nullptr ) return maxon::UnexpectedError( MAXON_SOURCE_LOCATION );

// expand data to access it const CAMORPH_MODE_FLAGS expandFlags = CAMORPH_MODE_FLAGS::ALL | CAMORPH_MODE_FLAGS::EXPAND ; morph-> SetMode (doc, poseMorphTag, expandFlags, CAMORPH_MODE::ABS );

// check stored data if (mnode-> GetInfo () & CAMORPH_DATA_FLAGS::POINTS ) { // access point data const Int32 pointCount = mnode-> GetPointCount (); for ( Int32 i = 0; i < pointCount; ++i) { const 向量 point = mnode-> GetPoint (i); ApplicationOutput ( "Point: " + String::VectorToString (point)); } }

// collapse data const CAMORPH_MODE_FLAGS collapseFlags = CAMORPH_MODE_FLAGS::ALL | CAMORPH_MODE_FLAGS::COLLAPSE ; morph-> SetMode (doc, poseMorphTag, collapseFlags, CAMORPH_MODE::AUTO ); poseMorphTag->UpdateMorphs();

目标

A CAMorph can use an object as a reference:

// This example creates a new morph and uses // the given BaseObject as the target object. poseMorphTag->ExitEdit(doc, false );

// create new morph CAMorph * const morph = poseMorphTag->AddMorph(); if (morph == nullptr ) return maxon::OutOfMemoryError( MAXON_SOURCE_LOCATION );

// set given object as target morph-> SetTarget (poseMorphTag, doc, targetObject);

// set new morph as active morph const Int32 newIndex = poseMorphTag->GetMorphIndex(morph); poseMorphTag->SetActiveMorphIndex(newIndex); poseMorphTag->UpdateMorphs(); const Int32 index = poseMorphTag->GetMorphIndex(morph); poseMorphTag->SetActiveMorphIndex(index); poseMorphTag->SetParameter( ID_CA_POSE_MIXING , ID_CA_POSE_MIXING_ABS , DESCFLAGS_SET::NONE );

强度

The strength of a CAMorph controls how strongly it is applied to the host object.

// This example loops through all morphs and sets the strength // of the currently active morph to 100%, all other morphs to 0%. poseMorphTag->ExitEdit(doc, false );

// get index of active morph const Int32 activeMorphIndex = poseMorphTag->GetActiveMorphIndex();

// loop through all morphs const Int32 morphCount = poseMorphTag->GetMorphCount(); for ( Int32 i = 0; i < morphCount; ++i) { CAMorph * const morph = poseMorphTag->GetMorph(i); if (morph == nullptr ) return maxon::UnexpectedError( MAXON_SOURCE_LOCATION );

// set morph strength if (activeMorphIndex != i) morph-> SetStrength (0.0); else morph-> SetStrength (1.0); } poseMorphTag->UpdateMorphs(doc);

对象

The data stored in a CAMorph can be read from the host object and applied back to the host 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() ,见 CAMorphNode Manual .

// This example accesses the first (not base pose) morph // and applies it to the host object. poseMorphTag->ExitEdit(doc, false );

// get first morph CAMorph * const morph = poseMorphTag->GetMorph(1); if (morph) { morph-> 应用 (doc, poseMorphTag, CAMORPH_DATA_FLAGS::ALL ); }

延伸阅读

CAMorph::GetFirst
CAMorphNode * GetFirst()
CAMorph::GetName
String GetName()
CAMORPH_COPY_FLAGS::NONE
@ NONE
None.
CAMORPH_MODE::AUTO
@ AUTO
Auto mode. Used to collapse the data automatically into their correct mode.
CAMorphNode::GetPointCount
Int32 GetPointCount()
CAMorph::CopyFrom
Bool CopyFrom(CAMorph *src, AliasTrans *trn, CAMORPH_COPY_FLAGS flags)
MAXON_SOURCE_LOCATION
#define MAXON_SOURCE_LOCATION
定义: memoryallocationbase.h:66
CAMorphNode::GetPoint
Vector GetPoint(Int32 index)
DESCFLAGS_SET::NONE
@ NONE
None.
CAMORPH_DATA_FLAGS::ALL
@ ALL
All data morphing.
CAMorph::SetTarget
void SetTarget(CAPoseMorphTag *tag, BaseDocument *doc, BaseList2D *bl)
String
定义: c4d_string.h:38
CAMorph::SetMode
Bool SetMode(BaseDocument *doc, CAPoseMorphTag *tag, CAMORPH_MODE_FLAGS flags, CAMORPH_MODE mode)
maxon::Vec3< maxon::Float64, 1 >
CAMORPH_DATA_FLAGS::POINTS
@ POINTS
Points morphing.
ID_CA_POSE_MIXING
@ ID_CA_POSE_MIXING
定义: tcaposemorph.h:26
CAMorph
定义: lib_ca.h:1428
CAMorphNode::GetInfo
CAMORPH_DATA_FLAGS GetInfo()
CAMorphNode
定义: lib_ca.h:1070
Int32
maxon::Int32 Int32
定义: ge_sys_math.h:58
ApplicationOutput
#define ApplicationOutput(formatString,...)
定义: debugdiagnostics.h:207
CAMORPH_MODE_FLAGS::ALL
@ ALL
Expand or collapse all data.
CAMorph::SetName
void SetName(const String &name)
ID_CA_POSE_MIXING_ABS
@ ID_CA_POSE_MIXING_ABS
定义: tcaposemorph.h:88
CAMORPH_MODE_FLAGS
CAMORPH_MODE_FLAGS
定义: lib_ca.h:849
String::VectorToString
static String VectorToString(const Vector32 &v, Int32 nnk=-1)
定义: c4d_string.h:571
CAMORPH_MODE::ABS
@ ABS
Absolute morph data.
CAMorph::SetStrength
void SetStrength(Float strength)
CAMORPH_MODE_FLAGS::EXPAND
@ EXPAND
Expand data. Needs to be passed before accessing any data.
CAMORPH_MODE_FLAGS::COLLAPSE
@ COLLAPSE
Collapse data. Needs to be passed to collapse the expanded data, for instance after data access.
CAMorph::Apply
Bool Apply(BaseDocument *doc, CAPoseMorphTag *tag, CAMORPH_DATA_FLAGS flags)

Copyright  © 2014-2025 乐数软件    

工业和信息化部: 粤ICP备14079481号-1