Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/09/2009 at 03:54, xxxxxxxx wrote:
User Information: Cinema 4D Version: 10.5 Platform: Language(s) : C++ ;
--------- I am getting some results when using the TranslationMaps for polygons that I cannot explain. When you delete an ngon that consists of two or more polygons, the information that is passed in the translation maps is not what I would expect. here is a code snippet I use in the Message member of a tag plugin.
> <code> > >> `
\> if (type==MSG_TRANSLATE_POLYGONS) \> { // Update the indexes as needed \> BaseContainer *bc=((BaseList2D* )node)->GetDataInstance(); \> if (!bc) \> return false; \> \> LONG lngI,lngJ,lngSize; \> \> TranslationMaps *map; \> map=(TranslationMaps* )data; \> \> if (map) \> { \> // New to old polygon mapping \> if (arrNewToOldPoly) \> GeFree(arrNewToOldPoly); \> lngSize = sizeof(LONG) * map->m_nPolygonCount; \> arrNewToOldPoly = (LONG* )GeAlloc(lngSize); \> if (!arrNewToOldPoly) \> return false; \> \> for (lngI=0;lngI<map->m_nPolygonCount;lngI++) \> { if (lngI>=map->m_oPolygonCount) \> { arrNewToOldPoly[lngI]=-1; \> } \> else \> { arrNewToOldPoly[lngI]=lngI;} \> \> } \> \> for (lngJ=0;lngJ<map->m_mPolygonCount;lngJ++) \> { \> GePrint("New To Old "+LongToString(map->m_pPolygonMap[lngJ].nIndex)+" "+LongToString(map->m_pPolygonMap[lngJ].oIndex)+" "+LongToString(map->m_pPolygonMap[lngJ].lFlags)); \> \> if ((map->m_pPolygonMap[lngJ].lFlags & TRANSMAP_FLAG_NEW)) \> { arrNewToOldPoly[map->m_pPolygonMap[lngJ].nIndex]=-1; \> }; \> \> if ((map->m_pPolygonMap[lngJ].lFlags & TRANSMAP_FLAG_MOVED)) \> { if (map->m_pPolygonMap[lngJ].nIndex != -1) \> { arrNewToOldPoly[map->m_pPolygonMap[lngJ].nIndex]=map->m_pPolygonMap[lngJ].oIndex; \> } \> }; \> \> } \> \> // Old to new polygon mapping \> if (arrOldTonewPoly) \> GeFree(arrOldTonewPoly); \> lngSize = sizeof(LONG) * map->m_oPolygonCount; \> arrOldTonewPoly = (LONG* )GeAlloc(lngSize); \> if (!arrOldTonewPoly) \> return false; \> \> for (lngI=0;lngI<map->m_oPolygonCount;lngI++) \> { arrOldTonewPoly[lngI]=lngI; \> } \> \> for (lngJ=0;lngJ<map->m_mPolygonCount;lngJ++) \> { GePrint("Old To New "+LongToString(map->m_pPolygonMap[lngJ].nIndex)+" "+LongToString(map->m_pPolygonMap[lngJ].oIndex)+" "+LongToString(map->m_pPolygonMap[lngJ].lFlags)); \> \> if ((map->m_pPolygonMap[lngJ].lFlags & TRANSMAP_FLAG_DELETED)) \> { arrOldTonewPoly[map->m_pPolygonMap[lngJ].oIndex]=-1; \> }; \> \> if ((map->m_pPolygonMap[lngJ].lFlags & TRANSMAP_FLAG_MOVED)) \> { arrOldTonewPoly[map->m_pPolygonMap[lngJ].oIndex]=map->m_pPolygonMap[lngJ].nIndex; \> }; \> } \> \> } \> } \>
` > > </code>
Now if use some simple polygon objects (I started with a cube with 2 segments), and do some simple tests this is what I get:
Delete a single polygon: Highest polygon index is 23, the index of the polygon that gets deleted is 7
The polygon mapping gives this nIndex -1 oIndex 7 lFlags 8 (TRANSMAP_FLAG_DELETED) nIndex 7 oIndex 23 lFlags 4 (TRANSMAP_FLAG_MOVED)
That makes perfect sense but if I try to delete a ngon that consists of 2 polygons things are not that clear
Delete a ngon: Highest polygon index is 26, the indexes of the polygons that make up the ngon are 25 and 7
The polygon mapping gives this nIndex 7 oIndex 26 lFlags 4 (TRANSMAP_FLAG_MOVED) nIndex -1 oIndex 28 lFlags 8 (TRANSMAP_FLAG_DELETED)
So the mapping tells me that polygon 25 (old index) has not been changed, although it does not exist any more and both polygon 26 and 7 (old index) are now both polygon 7 (new index) although the original 7 has been deleted. Is this a bug or am I missing something?
Cheers,
Nebu