Animate Scene + Polygonize
-
On 23/05/2013 at 14:00, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R12+
Platform: Windows ; Mac OSX ;
Language(s) : C++ ;---------
I'm having problems (**sometimes** ) getting a document completely updated/polygonized for export...The basic idea - for an animated export (multiple .obj files, or a .mdd cache file) - is:
- Animate the scene to the next frame to be exported.
- Polygonize the document - resolving any 'Primitive' objects to polygonal mesh form, as well as resolving any Deformer modifications.
- Export current polygonized scene.
- Wash, rinse, repeat until all animation frames have been exported.
...to animate the scene, I'm calling one of my 'compatibility' routines...
//------------------------------------------------------------- // cmpAnimateDocument() //------------------------------------------------------------- void cmpAnimateDocument(BaseDocument *pDoc, const BaseTime& frameTime) { // StopAllThreads(); pDoc->SetTime(frameTime); #ifdef _R12_SDK_ pDoc->ExecutePasses(NULL, TRUE, TRUE, TRUE, BUILDFLAGS_0); #elif _R11p5_SDK_ pDoc->ExecutePasses(NULL, TRUE, TRUE, TRUE); #else pDoc->AnimateDocument(NULL, TRUE, TRUE); #endif EventAdd(); #ifdef _R12_SDK_ DrawViews(DRAWFLAGS_FORCEFULLREDRAW | DRAWFLAGS_NO_THREAD, NULL); // force completion of cache rebuild #elif _R10p1_SDK_ DrawViews(DA_FORCEFULLREDRAW | DA_NO_THREAD, NULL); #else DrawViews(DA_FORCEFULLREDRAW); #endif }
...after which, I typically call:
pDoc = pBaseDoc->Polygonize()
...to get the scene in polygonal mesh form, for exporting.
The problem I'm (sometimes) seeing seems to be related to MoGraph objects in the scene and/or things like Text primitives.
In order for these to animate/polygonize/export correctly, the user has to manually "Make Editable", or even "Current State to Object" before exporting - which is a hassle, if they still want to maintain the Primitive form of those items.
I've even been able to manually 'adjust the hierarchy order' in the Object Manager to fix the export in some cases (when it seemed to be some 'priority' issue).
Does anyone know what I'm doing wrong or missing?
Thanks,
Keith
-
On 29/05/2013 at 15:22, xxxxxxxx wrote:
Howdy,
Instead of using BaseDocument::Polygonize(), could you use BaseObject::GetCache() or BaseObject::GetDeformCache() to access the polygonal virtual objects of the generator objects?
Adios,
Cactus Dan -
On 29/05/2013 at 15:43, xxxxxxxx wrote:
Hi Dan,
Possibly - thanks... I'll look into those and see if it's any better.
Since my post, I've also found that (likely largely depending on the exact scene structure) you can sometimes fix the problem just by adding a parent Null object.... but I'd like to find some means of making it "just work" instead of relying on the user to know/figure out all the work-arounds.
-
On 29/05/2013 at 15:50, xxxxxxxx wrote:
Howdy,
That's what I do with my FBX export plugin to convert Generator objects to exportable polygonal objects.
Adios,
Cactus Dan