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 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; }
On 29/05/2007 at 00:43, xxxxxxxx wrote:
Hi ...
What you want to do is to make all the objects in the document editable. Am I right? I use this code segment for that.
Bool dlgLevelControl::Command(LONG id, const BaseContainer &msg;) { switch(id) { case BTN_TEST://when the testing button is pressed { BaseDocument *doc=GetActiveDocument(); BaseObject *obj=doc->GetFirstObject(); MakeAllEditable(obj); } break; } } ...
void dlgTest::MakeAllEditable(BaseObject *obj) { String strObj; if(obj) { strObj=obj->GetName(); BaseDocument *doc=GetActiveDocument(); ModelingCommandData mcd; mcd.bc=obj->GetDataInstance(); mcd.doc=doc; mcd.op=obj; mcd.mode=MODIFY_ALL; mcd.flags=MODELINGCOMMANDFLAG_CREATEUNDO; if (!SendModelingCommand(MCOMMAND_MAKEEDITABLE,mcd)) return; EventAdd(EVENT_FORCEREDRAW); obj=doc->SearchObject(strObj); MakeAllEditable(obj->GetDown()); MakeAllEditable(obj->GetNext()); } }
Hope it can help ... Zaw Min Tun
On 29/05/2007 at 01:17, xxxxxxxx wrote:
Thank you very much, it works perfectly.
Since the changes rearanges objects in the list, this
obj=doc->SearchObject(strObj);
was necessary to go to modified object.
It drove me nuts for a while
tnx again.
On 31/05/2007 at 19:29, xxxxxxxx wrote:
Yes ... it's always like that ... You're welcome ...
Zaw Min Tun