Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Final State Geo

    SDK Help
    0
    4
    527
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

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

      User Information:
      Cinema 4D Version:   R18 
      Platform:      
      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.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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
        doc->ExecutePasses(NULL, TRUE, TRUE, TRUE, production ? BUILDFLAGS_EXTERNALRENDERER : BUILDFLAGS_0); 
        
        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

          Hi,

          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.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post