TranslationMaps Class Reference Library » 建模

#include <lib_modeling.h>

详细描述

With previous versions of Cinema 4D it was a hard to update plugin tags after modeling operations. They all had to be done manually per tool (at least in theory, not many plugins bothered!).

A solution to this problem are the tag translation messages. During Modeling::Commit() there are two points at which translations of tags can be done:

注意
Modeling::Commit() fails then TRANSLATE is called with nullptr so that any data stored from PRETRANSLATE can be released.

The TranslationMaps pointer is passed for the translation message data .
A simple example is the vertex map tag. Points are the easiest to translate. Polygons are pretty much the same too. Edges are much harder since they do not have any representation.
In the modeling library they are handled by storing (in PRETRANSLATE) information about the points/polygons that form the edges and use this in TRANSLATE to match up any edge changes.

Bool VertexMapTag::Message ( Int32 type, void *data) { switch (type) { ... case MSG_TRANSLATE_POINTS : RemapVertexMap(( Float *)t_data,( TranslationMaps *)data); break ; } return SUPER::Message(type,data); }
static void RemapVertexMap( Float *vmap, TranslationMaps *map) { if (map && map-> m_pPointMap && map-> m_nPointCount && vmap) { Int32 i,l,s; TransPointInterData *ipnt;

// Processed any interpolated points

for (i=0;i<map-> m_mPointCount ;i++) { if (!(map-> m_pPointMap [i]. lFlags & TRANSMAP_PNTFLAG_INTER )) continue ; ipnt=&map-> m_pInterpolatedPoints [map-> m_pPointMap [i]. mIndex ]; vmap[map-> m_pPointMap [i]. nIndex ]=Mix(vmap[ipnt-> p1 ],vmap[ipnt-> p2 ],ipnt-> t ); }

// Merge any welds

for (i=0;i<map-> m_mWeldCount ;) { l=map-> m_pWeldMap [i]. nIndex ; s=0; Float sum=0.0; while (i<map-> m_mWeldCount && map-> m_pWeldMap [i]. nIndex ==l) { if (map-> m_pWeldMap [i]. oIndex >=0) { sum+=vmap[map-> m_pWeldMap [i]. oIndex ]; s++; } i++; } if (s>0) sum=sum/ Float (s); vmap[l]=sum; }

// Remap any changes

for (i=0;i<map-> m_mPointCount ;i++) { if (map-> m_pPointMap [i]. lFlags & ( TRANSMAP_PNTFLAG_INTER | TRANSMAP_FLAG_DELETED )) continue ; if (map-> m_pPointMap [i]. lFlags & TRANSMAP_FLAG_NEW ) vmap[map-> m_pPointMap [i]. nIndex ]=0.0; else if (map-> m_pPointMap [i]. nIndex !=map-> m_pPointMap [i]. oIndex ) vmap[map-> m_pPointMap [i]. nIndex ]=vmap[map-> m_pPointMap [i]. oIndex ]; } } }

公共成员函数

  TranslationMaps ()
Int32   FindOriginalPoint ( Int32 index)
Int32   FindOriginalPolygon ( Int32 index)
Int32   FindOriginalPgon ( Int32 index)
Int32   FindOriginalSegment ( Int32 index)
Int32   FindNewPoint ( Int32 index)
Int32   FindNewPolygon ( Int32 index)
Int32   FindNewPgon ( Int32 index)
Int32   FindNewSegment ( Int32 index)
Int32   FindWeldPoint ( Int32 index)
Int32   FindMeltPolygon ( Int32 index)

Public Attributes

Int32   m_oPointCount
Int32   m_oPolygonCount
Int32   m_oPgonCount
Int32   m_oSegmentCount
Int32   m_nPointCount
Int32   m_nPolygonCount
Int32   m_nPgonCount
Int32   m_nSegmentCount
Int32   m_mPointCount
Int32   m_mPolygonCount
Int32   m_mPgonCount
Int32   m_mSegmentCount
Int32   m_mWeldCount
Int32   m_mMeltCount
TransMapData m_pPointMap
TransMapData m_pPolygonMap
TransMapData m_pPgonMap
TransMapData m_pSegmentMap
TransIndexMapData m_pWeldMap
TransIndexMapData m_pMeltMap
TransMapNewData m_pNewPointMap
TransMapNewData m_pNewPolygonMap
TransMapNewData m_pNewPgonMap
TransMapNewData m_pNewSegmentMap
TransPointInterData m_pInterpolatedPoints
TransPointDeltaData m_pDeltaPoints

构造函数 & 析构函数文档编制

◆  TranslationMaps()

TranslationMaps ( )

Constructor.

成员函数文档编制

◆  FindOriginalPoint()

Int32 FindOriginalPoint ( Int32   index )

Searches for the original (i.e old) index based on the new index . (A pure helper. The source for this function is available in lib_modeling.cpp .)

参数
[in] index The new index.
返回
The old index.

◆  FindOriginalPolygon()

Int32 FindOriginalPolygon ( Int32   index )

Searches for the original (i.e old) index based on the new index . (A pure helper. The source for this function is available in lib_modeling.cpp .)

参数
[in] index The new index.
返回
The old index.

◆  FindOriginalPgon()

Int32 FindOriginalPgon ( Int32   index )

Searches for the original (i.e old) index based on the new index . (A pure helper. The source for this function is available in lib_modeling.cpp .)

参数
[in] index The new index.
返回
The old index.

◆  FindOriginalSegment()

Int32 FindOriginalSegment ( Int32   index )

Searches for the original (i.e old) index based on the new index . (A pure helper. The source for this function is available in lib_modeling.cpp .)

参数
[in] index The new index.
返回
The old index.

◆  FindNewPoint()

Int32 FindNewPoint ( Int32   index )

Searches for the new index based on the original index . (A pure helper. The source for this function is available in lib_modeling.cpp .)

参数
[in] index The old index.
返回
The new index.

◆  FindNewPolygon()

Int32 FindNewPolygon ( Int32   index )

Searches for the new index based on the original index . (A pure helper. The source for this function is available in lib_modeling.cpp .)

参数
[in] index The old index.
返回
The new index.

◆  FindNewPgon()

Int32 FindNewPgon ( Int32   index )

Searches for the new index based on the original index . (A pure helper. The source for this function is available in lib_modeling.cpp .)

参数
[in] index The old index.
返回
The new index.

◆  FindNewSegment()

Int32 FindNewSegment ( Int32   index )

Searches for the new index based on the original index . (A pure helper. The source for this function is available in lib_modeling.cpp .)

参数
[in] index The old index.
返回
The new index.

◆  FindWeldPoint()

Int32 FindWeldPoint ( Int32   index )

Searches for the new index based on the original index . (A pure helper. The source for this function is available in lib_modeling.cpp .)

参数
[in] index The old index.
返回
The new index.

◆  FindMeltPolygon()

Int32 FindMeltPolygon ( Int32   index )

Searches for the new index based on the original index . (A pure helper. The source for this function is available in lib_modeling.cpp .)

参数
[in] index The old index.
返回
The new index.

Member Data Documentation

◆  m_oPointCount

Int32 m_oPointCount

Original point count.

◆  m_oPolygonCount

Int32 m_oPolygonCount

Original polygon count.

◆  m_oPgonCount

Int32 m_oPgonCount

Original Pgon count.

◆  m_oSegmentCount

Int32 m_oSegmentCount

Original segment count.

◆  m_nPointCount

Int32 m_nPointCount

New point count.

◆  m_nPolygonCount

Int32 m_nPolygonCount

New polygon count.

◆  m_nPgonCount

Int32 m_nPgonCount

New Pgon count.

◆  m_nSegmentCount

Int32 m_nSegmentCount

New segment count.

◆  m_mPointCount

Int32 m_mPointCount

Map point count.

◆  m_mPolygonCount

Int32 m_mPolygonCount

Map polygon count.

◆  m_mPgonCount

Int32 m_mPgonCount

Map Pgon count.

◆  m_mSegmentCount

Int32 m_mSegmentCount

Map segment count.

◆  m_mWeldCount

Int32 m_mWeldCount

Map weld count.

◆  m_mMeltCount

Int32 m_mMeltCount

Map melt count.

◆  m_pPointMap

TransMapData * m_pPointMap

Point translation map.

◆  m_pPolygonMap

TransMapData * m_pPolygonMap

Polygon translation map.

◆  m_pPgonMap

TransMapData * m_pPgonMap

Pgon translation map.

◆  m_pSegmentMap

TransMapData * m_pSegmentMap

Segment translation map.

◆  m_pWeldMap

TransIndexMapData * m_pWeldMap

Weld index translation map.

◆  m_pMeltMap

TransIndexMapData * m_pMeltMap

Melt index translation map.

◆  m_pNewPointMap

TransMapNewData * m_pNewPointMap

New point translation map.

◆  m_pNewPolygonMap

TransMapNewData * m_pNewPolygonMap

New polygon translation map.

◆  m_pNewPgonMap

TransMapNewData * m_pNewPgonMap

New Pgon translation map.

◆  m_pNewSegmentMap

TransMapNewData * m_pNewSegmentMap

New segment translation map.

◆  m_pInterpolatedPoints

TransPointInterData * m_pInterpolatedPoints

Interpolation map.

◆  m_pDeltaPoints

TransPointDeltaData * m_pDeltaPoints

Delta map.

TRANSMAP_FLAG_NEW
#define TRANSMAP_FLAG_NEW
New.
定义: lib_modeling.h:45
TranslationMaps::m_pPointMap
TransMapData * m_pPointMap
Point translation map.
定义: lib_modeling.h:312
MSG_TRANSLATE_POINTS
#define MSG_TRANSLATE_POINTS
Sent by the modeling core to let tags etc. update after point changes. The corresponding data is Tran...
定义: c4d_baselist.h:512
TransMapData::lFlags
Int32 lFlags
定义: lib_modeling.h:101
Float
maxon::Float Float
定义: ge_sys_math.h:64
TranslationMaps::m_pInterpolatedPoints
TransPointInterData * m_pInterpolatedPoints
Interpolation map.
定义: lib_modeling.h:325
TranslationMaps
定义: lib_modeling.h:213
TransPointInterData::t
Float t
Interpolation parameter.
定义: lib_modeling.h:123
TransIndexMapData::nIndex
Int32 nIndex
New index.
定义: lib_modeling.h:83
TransPointInterData
定义: lib_modeling.h:119
TranslationMaps::m_mPointCount
Int32 m_mPointCount
Map point count.
定义: lib_modeling.h:304
TranslationMaps::m_pWeldMap
TransIndexMapData * m_pWeldMap
Weld index translation map.
定义: lib_modeling.h:317
TranslationMaps::m_nPointCount
Int32 m_nPointCount
New point count.
定义: lib_modeling.h:299
Int32
maxon::Int32 Int32
定义: ge_sys_math.h:58
C4DAtom::Message
Bool Message(Int32 type, void *data=nullptr)
定义: c4d_baselist.h:1394
TransPointInterData::p1
Int32 p1
First point.
定义: lib_modeling.h:121
TransIndexMapData::oIndex
Int32 oIndex
Old index.
定义: lib_modeling.h:82
TRANSMAP_PNTFLAG_INTER
#define TRANSMAP_PNTFLAG_INTER
Interpolated.
定义: lib_modeling.h:55
Bool
maxon::Bool Bool
定义: ge_sys_math.h:53
TransPointInterData::p2
Int32 p2
Second point.
定义: lib_modeling.h:122
TranslationMaps::m_mWeldCount
Int32 m_mWeldCount
Map weld count.
定义: lib_modeling.h:309
TransMapData::mIndex
Int32 mIndex
Mapped index.
定义: lib_modeling.h:104
TRANSMAP_FLAG_DELETED
#define TRANSMAP_FLAG_DELETED
Deleted.
定义: lib_modeling.h:48