Final State Geo

On 19/08/2017 at 18:53, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R18 
Language(s) :     C++  ;

I've been doing some research on GetCache(), GetDeformCache(), and Document->Polygonize(). I was wondering if there was a definitive command to get the final render scene(PictureViewer) state for an export plugin I'm developing.

The thing I'm trying to wrap my head around right now is how I would know if a cube under say a cloner didn't need to be exported vs. a cube under a cube.  See the cube is a generator that doesn't effect it's children so the children need to be exported, but the cloner generates stuff from it's children so exporting the direct children would be an logic error. Is there a command/flag that allows me to tell the difference?

Obviously if I had access the the cloned final render scene then form my cursory research there would be no generators at all, just the final cached geo, and a simple hierarchy loop would suffice.

On 20/08/2017 at 14:58, xxxxxxxx wrote:

BaseDocument * doc = GetActiveDocument(); // or anything you want to export
// flag BUILDFLAGS_EXTERNALRENDERER asks it to generate final state geometry

On 21/08/2017 at 10:46, xxxxxxxx wrote:


one part of the puzzle got already delivered. Using ExecutePasses() you can make sure to get the correct caches (i.E. the Render Subdivisions of a Subdivision Surface) and also to get the scene representation for a certain frame (by setting the time before ExecutePasses()). See the BaseDocument manual for details.

Objects which are used as input objects of generators are marked by BIT_CONTROLOBJECT. See BaseObject manual for details.

And then you need to properly walk the cache structure to get the polygonal representations you are looking for. Again BaseObject manual provides details and a handy code snippet.

For all future readers we maybe should add, that we are talking about a SceneSaverData plugin here.

On 24/08/2017 at 16:52, xxxxxxxx wrote:

I ended up using

if (!(child->GetInfo() & OBJECT_INPUT) && !(child->GetInfo() & OBJECT_MODIFIER)) {

To check that I wasn't exporting objects under generators or normal objects that I didn't want to. I had to do some tricky logic with Generators but I've resolved that thus far with a custom node class in my plugin.