CAPoseMorphTag Manual

内容表

关于

The CAPoseMorphTag class represents a pose morph tag. Such a tag stores multiple morphs that can be applied to the host object (and it's child objects) to modify and animate it. The class is defined in the lib_ca.h header file.

CAPoseMorphTag objects are an instance of Tposemorph .

// This example creates a cube with a CAPoseMorphTag. // A base morph and an additional morph are added to the tag.

// create cube

BaseObject * const cube = BaseObject::Alloc ( Ocube ); if (cube == nullptr ) return maxon::OutOfMemoryError( MAXON_SOURCE_LOCATION );
doc-> InsertObject (cube, nullptr , nullptr );

// create morph tag CAPoseMorphTag * const poseMorphTag = CAPoseMorphTag::Alloc (); if (poseMorphTag == nullptr ) return maxon::OutOfMemoryError( MAXON_SOURCE_LOCATION ); cube-> InsertTag (poseMorphTag); poseMorphTag-> InitMorphs ();

// configure tag poseMorphTag-> SetParameter ( ID_CA_POSE_PARAM , true , DESCFLAGS_SET::NONE );

// edit morphs poseMorphTag-> ExitEdit (doc, true );

// add base morph CAMorph * const baseMorph = poseMorphTag-> AddMorph (); if (baseMorph == nullptr ) return maxon::OutOfMemoryError( MAXON_SOURCE_LOCATION ); baseMorph-> Store (doc, poseMorphTag, CAMORPH_DATA_FLAGS::ASTAG );

// modify cube cube-> SetParameter ( PRIM_CUBE_LEN , 向量 (200, 400, 200), DESCFLAGS_SET::NONE );

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

// store current state in morph morph-> SetName ( "Scaled Size" ); morph-> Store (doc, poseMorphTag, CAMORPH_DATA_FLAGS::ASTAG ); poseMorphTag-> UpdateMorphs ();

// switch to "Animate" mode poseMorphTag-> SetParameter ( ID_CA_POSE_MODE , ID_CA_POSE_MODE_ANIMATE , DESCFLAGS_SET::NONE );

// set strength const DescID sliderID = poseMorphTag-> GetMorphID (1); poseMorphTag-> SetParameter (sliderID, 0.5, DESCFLAGS_SET::NONE );

Access

A CAPoseMorphTag tag can be accessed like any other tag, see BaseTag and VariableTag Manual .

// This example accesses the selected pose morph tag and // prints the names of all it's morphs.

// get tag BaseTag * const tag = doc-> GetActiveTag (); if (tag == nullptr || !tag-> IsInstanceOf ( Tposemorph )) return maxon::IllegalArgumentError( MAXON_SOURCE_LOCATION ); CAPoseMorphTag * const poseMorphTag = static_cast< CAPoseMorphTag * > (tag);

// 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 ) { // print morph name ApplicationOutput ( "Morph: " + morph-> GetName ()); } }

Allocation/Deallocation

CAPoseMorphTag instances are created with the usual tools, see Entity Creation and Destruction Manual (Classic) .

// This example creates a new CAPoseMorphTag // and adds it to the given polygon object. CAPoseMorphTag * const poseMorphTag = CAPoseMorphTag::Alloc (); if (poseMorphTag == nullptr ) return maxon::OutOfMemoryError( MAXON_SOURCE_LOCATION ); polyObject-> InsertTag (poseMorphTag);

After creation, the tag must be initialized.

特性

The parameters of CAPoseMorphTag can be edited with C4DAtom::SetParameter() and C4DAtom::GetParameter() . The parameter IDs are defined in tcaposemorph.h .

注意
Several settings of the active morph must be set on the morph tag using C4DAtom::SetParameter() .
// This example enables "Points", adds a new morph and // switches to "Animate" mode.

// mix points poseMorphTag-> SetParameter ( ID_CA_POSE_POINTS , true , DESCFLAGS_SET::NONE );

// add new morph CAMorph * const morph = poseMorphTag-> AddMorph (); if (morph == nullptr ) return maxon::OutOfMemoryError( MAXON_SOURCE_LOCATION ); morph-> SetName ( "New Morph" );

// set morph as the active morph const Int32 index = poseMorphTag-> GetMorphIndex (morph); poseMorphTag-> SetActiveMorphIndex (index);

// update poseMorphTag-> UpdateMorphs (doc);

// enable "Post Deformers" for the active morph poseMorphTag-> SetParameter ( ID_CA_POSE_MIXING_DEFORMED , true , DESCFLAGS_SET::NONE );

// switch to animate mode poseMorphTag-> SetParameter ( ID_CA_POSE_MODE , ID_CA_POSE_MODE_ANIMATE , DESCFLAGS_SET::NONE );

Morphs

Any change to the morph data must be encompassed by the following functions:

The stored morphs are accessed with:

另请参阅 CAMorph Manual .

// This example lists the names and strengths // of all morphs in the given tag. 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 ());

// ignore base morph if (i != 0) { // print current strength of the morph const DescID id = poseMorphTag-> GetMorphID (i); GeData data; poseMorphTag-> GetParameter ( id , data, DESCFLAGS_GET::NONE ); const Float strength = data. GetFloat (); ApplicationOutput ( "Strength: " + String::FloatToString (strength)); } }

// This example deletes the currently selected morph. poseMorphTag-> ExitEdit (doc, true );

// delete active morph const Int32 activeIndex = poseMorphTag-> GetActiveMorphIndex (); poseMorphTag-> RemoveMorph (activeIndex); poseMorphTag-> UpdateMorphs ();

PSD

Several Pose Space Deformation related settings can be edited with these functions:

另请参阅 CAReferencePSD Manual .

// This example changes the PSD display settings on the given pose morph tag. CAPoseMorphTag * const poseMorphTag = static_cast< CAPoseMorphTag * > (tag); if (poseMorphTag) { // enable color poseMorphTag-> SetPSDFeedbackColorEnabled ( true ); // set color to red poseMorphTag-> SetPSDFeedbackColor ( 向量 (1.0, 0.0, 0.0)); }

模式

A CAPoseMorphTag can either be in "edit" or "animate" mode:

注意
To change the mode use C4DAtom::SetParameter() with DescID ID_CA_POSE_MODE .

延伸阅读

String::FloatToString
static String FloatToString(Float32 v, Int32 vvk=-1, Int32 nnk=-3)
定义: c4d_string.h:529
CAPoseMorphTag::Alloc
static CAPoseMorphTag * Alloc()
定义: lib_ca.h:1631
CAMORPH_DATA_FLAGS::ASTAG
@ ASTAG
CAMorph::Store
Bool Store(BaseDocument *doc, CAPoseMorphTag *tag, CAMORPH_DATA_FLAGS flags)
ID_CA_POSE_MODE
@ ID_CA_POSE_MODE
定义: tcaposemorph.h:18
CAMorph::GetName
String GetName()
BaseDocument::InsertObject
void InsertObject(BaseObject *op, BaseObject *parent, BaseObject *pred, Bool checknames=false)
CAPoseMorphTag
定义: lib_ca.h:1617
CAPoseMorphTag::InitMorphs
void InitMorphs()
BaseObject
定义: c4d_baseobject.h:224
CAPoseMorphTag::SetActiveMorphIndex
void SetActiveMorphIndex(Int32 index)
DescID
定义: lib_description.h:327
CAPoseMorphTag::GetMorphCount
Int32 GetMorphCount()
Float
maxon::Float Float
定义: ge_sys_math.h:64
BaseTag
定义: c4d_basetag.h:46
CAPoseMorphTag::AddMorph
CAMorph * AddMorph()
Ocube
#define Ocube
Cube.
定义: ge_prepass.h:1040
MAXON_SOURCE_LOCATION
#define MAXON_SOURCE_LOCATION
定义: memoryallocationbase.h:66
BaseDocument::GetActiveTag
BaseTag * GetActiveTag(void)
CAPoseMorphTag::GetActiveMorphIndex
Int32 GetActiveMorphIndex()
DESCFLAGS_SET::NONE
@ NONE
None.
CAPoseMorphTag::RemoveMorph
void RemoveMorph(Int32 index)
CAPoseMorphTag::GetMorphID
DescID GetMorphID(Int32 index)
CAPoseMorphTag::UpdateMorphs
void UpdateMorphs(BaseDocument *doc=nullptr)
C4DAtom::SetParameter
Bool SetParameter(const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
Tposemorph
#define Tposemorph
Pose morph.
定义: ge_prepass.h:1277
CAPoseMorphTag::ExitEdit
Bool ExitEdit(BaseDocument *doc, Bool noapply)
ID_CA_POSE_PARAM
@ ID_CA_POSE_PARAM
定义: tcaposemorph.h:30
CAPoseMorphTag::GetMorphIndex
Int32 GetMorphIndex(CAMorph *morph)
CAMorph
定义: lib_ca.h:1428
PRIM_CUBE_LEN
@ PRIM_CUBE_LEN
定义: ocube.h:6
ID_CA_POSE_POINTS
@ ID_CA_POSE_POINTS
定义: tcaposemorph.h:34
GeData
定义: c4d_gedata.h:82
ID_CA_POSE_MODE_ANIMATE
@ ID_CA_POSE_MODE_ANIMATE
定义: tcaposemorph.h:86
Int32
maxon::Int32 Int32
定义: ge_sys_math.h:58
ApplicationOutput
#define ApplicationOutput(formatString,...)
定义: debugdiagnostics.h:207
向量
maxon::Vec3< maxon::Float64, 1 > Vector
定义: ge_math.h:145
BaseObject::Alloc
static BaseObject * Alloc(Int32 type)
CAMorph::SetName
void SetName(const String &name)
DESCFLAGS_GET::NONE
@ NONE
None.
CAPoseMorphTag::SetPSDFeedbackColor
Bool SetPSDFeedbackColor(const Vector &color)
C4DAtom::IsInstanceOf
Bool IsInstanceOf(Int32 id) const
定义: c4d_baselist.h:1373
CAPoseMorphTag::SetPSDFeedbackColorEnabled
Bool SetPSDFeedbackColorEnabled(Bool active)
CAPoseMorphTag::GetMorph
CAMorph * GetMorph(Int32 index)
ID_CA_POSE_MIXING_DEFORMED
@ ID_CA_POSE_MIXING_DEFORMED
定义: tcaposemorph.h:42
C4DAtom::GetParameter
Bool GetParameter(const DescID &id, GeData &t_data, DESCFLAGS_GET flags)
BaseObject::InsertTag
void InsertTag(BaseTag *tp, BaseTag *pred=nullptr)
GeData::GetFloat
Float GetFloat(void) const
定义: c4d_gedata.h:439

Copyright  © 2014-2025 乐数软件    

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