CAMorphNode Manual

内容表

关于

A CAMorphNode object stores the actual morph data for a corresponding BaseList2D object. It is stored in a CAPoseMorphTag ,见 CAPoseMorphTag Manual . The class is defined in the lib_ca.h header file.

Access

A CAMorphNode object is obtained from the host CAMorph 。见 CAMorph Manual .

// 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 CAMorphNode stores the data of the corresponding BaseList2D object. In "Hierarchy" mode of the host CAPoseMorphTag a CAMorph stores multiple CAMorphNode objects for all corresponding objects in the object tree.

// This example function iterates over the CAMorphNode tree of the // given morph and prints the names of the referenced objects. static void CheckMorphNode( CAMorphNode * mnode, CAPoseMorphTag * tag, CAMorph * morph, BaseDocument * doc) { // loop through all nodes on this level while (mnode != nullptr ) { // get linked object BaseList2D * const link = mnode-> GetLink (tag, morph, doc); if (link != nullptr ) { // print name ApplicationOutput ( "Linked Object: " + link-> GetName ()); }

// check child nodes CheckMorphNode(mnode-> GetDown (), tag, morph, doc);

// get next node mnode = mnode-> GetNext (); } }

数据

Info

A CAMorphNode stores morph data of a corresponding BaseList2D 对象。

PSR

A CAMorphNode object can store PSR data:

// This example reads the position data stored in the given morph.

// check stored data if (mnode-> GetInfo () & CAMORPH_DATA_FLAGS::P ) { // access data const 向量 position = mnode-> GetP ();

// print data ApplicationOutput ( "Position: " + String::VectorToString (position)); }

Points

A CAMorphNode object can store point data:

// This example accesses the point data stored in the given morph. // The point data is changed and written back into the morph.

// check stored data if (mnode-> GetInfo () & CAMORPH_DATA_FLAGS::POINTS ) { Random random;

// loop through points const Int32 pointCount = mnode-> GetPointCount (); for ( Int32 i = 0; i < pointCount; ++i) { // get point 向量 point = mnode-> GetPoint (i);

// random offset point. x += random. Get01 () * 10.0; point. y += random. Get01 () * 10.0; point. z += random. Get01 () * 10.0;

// set point mnode-> SetPoint (i, point); } }

For point mode additional Pose Space Deformation data is stored:

CAReferencePSD Manual .

// This example accesses the PSD data of the given point morph.

// 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 ) { // get PSD data CAReferencePSD * const psd = mnode-> GetPSDReference (); if (psd) { // loop through all controllers const Int32 controllerCount = psd-> GetExternalControllerCount (); for ( Int32 controllerIndex = 0; controllerIndex < controllerCount; ++controllerIndex) { BaseObject * const controller = psd-> GetExternalController (controllerIndex); if (controller == nullptr ) return maxon::UnexpectedError( MAXON_SOURCE_LOCATION ); ApplicationOutput ( "Controller: " + controller-> GetName ()); } } } // collapse data const CAMORPH_MODE_FLAGS collapseFlags = CAMORPH_MODE_FLAGS::ALL | CAMORPH_MODE_FLAGS::COLLAPSE ; morph-> SetMode (doc, poseMorphTag, collapseFlags, CAMORPH_MODE::AUTO );

Tangents

A CAMorphNode object can store tangent data for spline points:

注意
For each spline point two tangent vectors are stored.
// This example reads the stored tangent data from the given morph.

// check stored data if (mnode-> GetInfo () & CAMORPH_DATA_FLAGS::TANGENTS ) { // loop through tangents const Int32 tangentCount = mnode-> GetTangentCount (); for ( Int32 i = 0; i < tangentCount; ++i) { // get data const 向量 tangent = mnode-> GetTangent (i); // print data ApplicationOutput ( "Tangent: " + String::VectorToString (tangent)); } }

Vertex Map

A CAMorphNode object can store vertex map data for all vertex map tags of the host object.

// This example loops through all data stored for all vertex map tags.

// check stored data if (mnode-> GetInfo () & CAMORPH_DATA_FLAGS::VERTEXMAPS ) { const Int32 vertexMapCount = mnode-> GetVertexMapTagCount ();

// loop through tags for ( Int32 tagIndex = 0; tagIndex < vertexMapCount; ++tagIndex) { ApplicationOutput ( "Tag Index " + String::IntToString (tagIndex));

// loop through vertice const Int32 vertexCount = mnode-> GetVertexMapCount (tagIndex); for ( Int32 vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex) { const Float weight = mnode-> GetVertexMap (tagIndex, vertexIndex); ApplicationOutput ( "Weight: " + String::FloatToString (weight)); } } }

参数

A CAMorphNode object can store data for various object parameters.

UV Sets

A CAMorphNode object can store UVW data for all UVW tags of the host object. See also UVWTag Manual .

// This example loops through all data stored for all UVW tags.

// 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::UV ) { // loop through data for all uvw tags const Int32 uvTagCount = mnode-> GetUVTagCount (); for ( Int32 tagIndex = 0; tagIndex < uvTagCount; ++tagIndex) { ApplicationOutput ( "UVW Tag #" + String::IntToString (tagIndex));

// loop through data for each polygon const Int32 uvCount = mnode-> GetUVCount (tagIndex); for ( Int32 uvIndex = 0; uvIndex < uvCount; ++uvIndex) { ApplicationOutput ( "Polygon #" + String::IntToString (uvIndex)); UVWStruct uvw; mnode-> GetUV (tagIndex, uvIndex, uvw); ApplicationOutput ( String::VectorToString (uvw. a )); ApplicationOutput ( String::VectorToString (uvw. b )); ApplicationOutput ( String::VectorToString (uvw. c )); ApplicationOutput ( String::VectorToString (uvw. d )); } } } // collapse data const CAMORPH_MODE_FLAGS collapseFlags = CAMORPH_MODE_FLAGS::ALL | CAMORPH_MODE_FLAGS::COLLAPSE ; morph-> SetMode (doc, poseMorphTag, collapseFlags, CAMORPH_MODE::AUTO );

Weight Maps

A CAMorphNode object can store weight data for all weight tags of the host object. See also CAWeightTag Manual .

// This example loops through all data stored for all weigth tags.

// 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::WEIGHTMAPS ) { // loop through data for all weight tags const Int32 weightTagCount = mnode-> GetWeightMapTagCount (); for ( Int32 tagIndex = 0; tagIndex < weightTagCount; ++tagIndex) { ApplicationOutput ( "Weight Tag #" + String::IntToString (tagIndex));

// loop through data for all joints const Int32 jointCount = mnode-> GetWeightMapJointCount (tagIndex); for ( Int32 jointIndex = 0; jointIndex < jointCount; ++jointIndex) { ApplicationOutput ( "Joint #" + String::IntToString (jointIndex)); const Int32 weightCount = mnode-> GetWeightMapCount (tagIndex, jointIndex); for ( Int32 weightIndex = 0; weightIndex < weightCount; ++weightIndex) { const Float weight = mnode-> GetWeightMap (tagIndex, jointIndex, weightIndex); ApplicationOutput ( String::FloatToString (weight)); } } } } // collapse data const CAMORPH_MODE_FLAGS collapseFlags = CAMORPH_MODE_FLAGS::ALL | CAMORPH_MODE_FLAGS::COLLAPSE ; morph-> SetMode (doc, poseMorphTag, collapseFlags, CAMORPH_MODE::AUTO );

延伸阅读

UVWStruct::b
Vector b
The UVW coordinate for the second point.
定义: operatingsystem.h:502
String::FloatToString
static String FloatToString(Float32 v, Int32 vvk=-1, Int32 nnk=-3)
定义: c4d_string.h:529
CAMorphNode::GetDown
CAMorphNode * GetDown()
CAMORPH_DATA_FLAGS::TANGENTS
@ TANGENTS
Tangents morphing.
CAReferencePSD::GetExternalController
BaseObject * GetExternalController(Int32 controllerIndex)
CAMorph::GetFirst
CAMorphNode * GetFirst()
CAMorphNode::GetUV
void GetUV(Int32 tindex, Int32 index, UVWStruct &uv)
BaseList2D
定义: c4d_baselist.h:2144
CAMorphNode::GetTangent
Vector GetTangent(Int32 index)
UVWStruct::c
Vector c
The UVW coordinate for the third point.
定义: operatingsystem.h:503
CAPoseMorphTag
定义: lib_ca.h:1617
CAMorphNode::GetVertexMapCount
Int32 GetVertexMapCount(Int32 tindex)
BaseObject
定义: c4d_baseobject.h:224
CAMORPH_DATA_FLAGS::UV
@ UV
UV coordinate morphing.
CAMorphNode::GetVertexMapTagCount
Int32 GetVertexMapTagCount()
CAMorphNode::GetLink
BaseList2D * GetLink(CAPoseMorphTag *tag, CAMorph *morph, BaseDocument *doc)
Float
maxon::Float Float
定义: ge_sys_math.h:64
CAMORPH_MODE::AUTO
@ AUTO
Auto mode. Used to collapse the data automatically into their correct mode.
CAMorphNode::GetPointCount
Int32 GetPointCount()
CAMorphNode::GetTangentCount
Int32 GetTangentCount()
MAXON_SOURCE_LOCATION
#define MAXON_SOURCE_LOCATION
定义: memoryallocationbase.h:66
CAMorphNode::GetPoint
Vector GetPoint(Int32 index)
CAMorphNode::GetUVCount
Int32 GetUVCount(Int32 tindex)
maxon::Vec3::z
T z
定义: vec.h:34
String::IntToString
static String IntToString(Int32 v)
定义: c4d_string.h:495
CAMorph::SetMode
Bool SetMode(BaseDocument *doc, CAPoseMorphTag *tag, CAMORPH_MODE_FLAGS flags, CAMORPH_MODE mode)
CAMorphNode::GetWeightMap
Float GetWeightMap(Int32 tindex, Int32 jindex, Int32 index)
CAMORPH_DATA_FLAGS::WEIGHTMAPS
@ WEIGHTMAPS
Joint weights morphing.
CAMorphNode::GetWeightMapJointCount
Int32 GetWeightMapJointCount(Int32 tindex)
maxon::Vec3< maxon::Float64, 1 >
CAMorphNode::GetWeightMapTagCount
Int32 GetWeightMapTagCount()
maxon::Vec3::x
T x
定义: vec.h:32
UVWStruct
定义: operatingsystem.h:463
CAMORPH_DATA_FLAGS::POINTS
@ POINTS
Points morphing.
CAMorph
定义: lib_ca.h:1428
CAMorphNode::GetWeightMapCount
Int32 GetWeightMapCount(Int32 tindex, Int32 jindex)
maxon::Vec3::y
T y
定义: vec.h:33
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
CAMorphNode::GetP
Vector GetP()
CAMORPH_MODE_FLAGS::ALL
@ ALL
Expand or collapse all data.
CAReferencePSD::GetExternalControllerCount
Int32 GetExternalControllerCount() const
CAReferencePSD
定义: lib_ca.h:923
CAMorphNode::SetPoint
void SetPoint(Int32 index, const Vector &pnt)
CAMorphNode::GetPSDReference
CAReferencePSD * GetPSDReference()
CAMorphNode::GetVertexMap
Float GetVertexMap(Int32 tindex, Int32 index)
CAMORPH_DATA_FLAGS::VERTEXMAPS
@ VERTEXMAPS
Vertex map morphing.
UVWStruct::d
Vector d
The UVW coordinate for the fourth point.
定义: operatingsystem.h:504
CAMorphNode::GetUVTagCount
Int32 GetUVTagCount()
Random::Get01
Float Get01(void)
Random
定义: c4d_tools.h:811
BaseList2D::GetName
String GetName() const
定义: c4d_baselist.h:2318
UVWStruct::a
Vector a
The UVW coordinate for the first point.
定义: operatingsystem.h:501
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.
BaseDocument
定义: c4d_basedocument.h:490
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_DATA_FLAGS::P
@ P
Position morphing.
CAMorphNode::GetNext
CAMorphNode * GetNext()

Copyright  © 2014-2025 乐数软件    

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