THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/05/2007 at 08:36, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R10
Platform: Windows ;
Language(s) : C++ ;
---------
In order to export objects I need to convert them into polygon objects before exporting.
But there are some problems with the hierarchy.
The ->GetNext and ->GetDown functions dont work as soon as a new object has been inserted.
How can I fix this?
And I have seen the Polygonize function, but I cant use it.
Any help is appreciated.
static bool transform(BaseObject* op, BaseDocument* dst)
{
if(!op || !dst )
return 1;
ModelingCommandData cd;
if(op->GetType() >= Ocube && op->GetType() <= Osinglepoly)
{
cd.doc = dst;
cd.op = op;
if (!SendModelingCommand(MCOMMAND_MAKEEDITABLE,cd))goto Error;
if (!cd.result) goto Error;
BaseObject* res = (BaseObject* )cd.result->GetIndex(0);
if (!res) goto Error;
dst->InsertObject(res, NULL, NULL);
}
transform(op->GetDown(), dst);
transform(op->GetNext(), dst);
return 0;
Error:
GePrint("Fehler bei Objektumwandlung");
AtomArray::Free(cd.result);
return 1;
}
//Jedes mathematische Objekt wird in ein Polygonobjekt umgewandelt
static BaseDocument* TransformObjToPoly(BaseDocument* doc)
{
BaseDocument* dst=BaseDocument::Alloc(); if (!dst) return NULL;
BaseObject* nx=NULL;
BaseObject* res=NULL;
BaseObject* op=NULL;
ModelingCommandData cd;
cd.doc = dst;
if (!doc->CopyTo(dst,0,NULL)) goto Error;
if(transform(dst->GetFirstObject(), dst)) goto Error;
return dst;
Error:
GePrint("Fehler bei Objektumwandlung");
blDelete(dst);
AtomArray::Free(cd.result);
return NULL;
}