THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2006 at 14:52, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.1
Platform: Windows ;
Language(s) : C++ ;
---------
Me again :)...
Ok, I've switched back to Riptide, while I wait on some responses about the selection-tag stuff.
I'm trying to update Riptide (.obj import/export plugin) to work with R9+ Ngons and could use some help.
At this time, as I scan over the input file, I'm keeping track of 'which' polygons have more than 4 edges and then breaking them up into triangles. Once the PolygonObject has been created, I then loop through my ngon list and try to build the ngons, like so...
... snip ...
op = PolygonObject::Alloc(m_numVerts,m_numFaces);
padr = op->GetPoint();
vadr = op->GetPolygon();
// ...various other stuff happens here to read the file and build up the PolygonObject...
if( m_numNgons )
{
op->ResizeObject(m_numVerts, m_numFaces, m_numNgons);
pNgonBase = op->GetNgonBase();
if( pNgonBase )
{
NgonLoader *pNgons = &m_pNgons[0]; // NgonLoader is my own structure
for(i=0; i<m_numNgons; i++)
{
LONG cnt;
cnt = pNgonBase->BuildNgonFromPolys(pNgons->polys, NULL, pNgons->polycnt, 0, vadr, padr);
GePrint("cnt = "+LongToString(cnt));
pNgons++;
}
pNgonBase->InitMap();
}
}
... snip ...
...so, in the above, pNgons->polys is an array of the sub-set of polygon indices that make up that ngon and pNgons->polycnt is the number of polygon indices in that array, for that ngon and vadr/padr are the face/point arrays for the entire PolygonObject.
The problem is, BuildNgonFromPolys() is failing (returns NOTOK). Can someone tell me where I went wrong? According to the docs, the second param (LONG* outer) is optional, which I assume means that I don't need to supply it.
Any help would be appreciated,
Thanks.
- Keith