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

    GENERAL and DOCUMENT settings [SOLVED]

    SDK Help
    0
    2
    287
    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 03/10/2016 at 02:40, xxxxxxxx wrote:

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

      ---------
      Hello.

      I have seen that DOCUMENTSETTINGS_DOCUMENT include the project settings which can be found in ddoc.h
      But which parameters belong in DOCUMENTSETTINGS_GENERAL group ? 
      If I copy the whole document, are the general settings copied as well or only the document settings ?

      Thank you for your time.

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

        On 05/10/2016 at 06:37, xxxxxxxx wrote:

        Hi Peterakos, thanks for writing us.To browse through the parameters belonging to DOCUMENTSETTINGS_GENERAL you can use the GetData() method to retrieve the BaseContainer and using a BrowseContainer object you can iterate and return the id/value of those parameters and matching the ID to the values found in ddoc.h get an understanding of their purpose.

          
        GeData* dataPtr = nullptr;  
        Int32 id = 0;
          
        // Retrieve the BaseContainer where to access the DOCUMENTSETTINGS_GENERAL params
        BaseContainer bcGenData = doc->GetData(DOCUMENTSETTINGS_GENERAL);
          
        // Allocate a BrowseContainer object, initializing with the reference to retrieved BaseContainer
        BrowseContainer containerBrowser = BrowseContainer(&bcGenData );
          
        // Loop through all parameters stored  
        while (containerBrowser.GetNext(&id, &dataPtr))  
        {  
         if (dataPtr)
           ... and do something with the data retrieved  
        }  
        

        With reference to the second part of the question, I confirm that if you change the value of one of the parameters belonging to DOCUMENTSETTINGS_GENERAL once you copy or clone the document the parameter in the new document is populated with the new value. Please take care of calling the SetData() method after updating the value any parameter stored in DOCUMENTSETTINGS_GENERAL.

          
        // Change the value of the project FPS  
        bcGenData.SetParameter(DOCUMENT_FPS, Int32(66));
          
        // Update the values in the document  
        doc->SetData(DOCUMENTSETTINGS_GENERAL, bcGenData);
        GeData docFPSData;
          
        // Allocate a new BaseDocument instance  
        BaseDocument* copiedDocPtr = BaseDocument::Alloc();  
        if (nullptr == copiedDocPtr)  
         return false;
          
        // Copy the old document on the new document  
        doc->CopyTo(copiedDocPtr, COPYFLAGS_0, nullptr);
          
        // Retrieve the BaseContainer for the new document referred to DOCUMENTSETTINGS_GENERAL  
        BaseContainer bcNewCopyGenData = copiedDocPtr->GetData(DOCUMENTSETTINGS_GENERAL);
          
        // Populate the GeData object with the values belonging to param DOCUMENT_FPS  
        bcNewCopyGenData.GetParameter(DOCUMENT_FPS, docFPSData);
          
        // Print the value  
        GePrint("FPS in copied doc is: " + String::IntToString(docFPSData.GetInt32()));
          
        // Deallocate the new doc  
        BaseDocument::Free(copiedDocPtr);  
        

        Best, Riccardo

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