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. animate the scene, I'm calling one of my 'compatibility' routines...
// cmpAnimateDocument()  
void cmpAnimateDocument(BaseDocument *pDoc, const BaseTime& frameTime)  
//    StopAllThreads();  
#ifdef _R12_SDK_  
  pDoc->ExecutePasses(NULL, TRUE, TRUE, TRUE, BUILDFLAGS_0);  
#elif _R11p5_SDK_  
  pDoc->ExecutePasses(NULL, TRUE, TRUE, TRUE);  
  pDoc->AnimateDocument(NULL, TRUE, TRUE);  
#ifdef _R12_SDK_  
  DrawViews(DRAWFLAGS_FORCEFULLREDRAW | DRAWFLAGS_NO_THREAD, NULL);    // force completion of cache rebuild  
#elif _R10p1_SDK_  

...after which, I typically call:

pDoc = pBaseDoc->Polygonize() 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?



On 29/05/2013 at 15:22, xxxxxxxx wrote:


Instead of using BaseDocument::Polygonize(), could you use BaseObject::GetCache() or BaseObject::GetDeformCache() to access the polygonal virtual objects of the generator objects?

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:


That's what I do with my FBX export plugin to convert Generator objects to exportable polygonal objects. :wink:

Cactus Dan