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

    Document's SetData triggers breakpoint

    SDK Help
    0
    4
    441
    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 12/09/2016 at 01:09, xxxxxxxx wrote:

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

      ---------
      Hello.

      Here is how I copy general settings from Active Document to a cloned one.

      BaseDocument* cloned_document = BaseDocument::Alloc();
      BaseContainer data = GetActiveDocument->GetData(DOCUMENTSETTINGS_GENERAL);
      cloned_document->SetData(DOCUMENTSETTINGS_GENERAL,data); 
      

      Nevertheless, whenever I load one of my projects in R18, a breakpoint is triggered in SetData in the very first execution of this code. I use this code inside InitGLImage method of a MaterialData plugin.

      What causes this breakpoint ?

      Thank you for your time.

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

        On 12/09/2016 at 08:25, xxxxxxxx wrote:

        Hello,

        as always one should never use GetActiveDocument() inside a NodeData based plugin. Access the host document of an element using GeListNode::GetDocument() (see BaseDocument Manual).

        So far I could not reproduce any breakpoint with the description and code you provided. Can you provide more information?

        best wishes,
        Sebastian

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

          On 20/09/2016 at 02:03, xxxxxxxx wrote:

          Hello.

          Here is the code that triggers breakpoint. This code is at the start of InitGLImage in my MaterialData (there is nothing before it). This happens only when I have an R17 scene and I open it in R18.
          The doc parameter is the one passed in InitGLImage

          BaseDocument* dummy_document = BaseDocument::Alloc();
          BaseContainer doc_data = doc->GetData(DOCUMENTSETTINGS_GENERAL); 
          dummy_document->SetData(DOCUMENTSETTINGS_GENERAL, doc_data);
          

          I was using GetActiveDocument because InitGLImage runs only when you have Cinema4D opened (right?).

          Thank you for your time.

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

            On 23/09/2016 at 08:33, xxxxxxxx wrote:

            Hello,

            well, InitGLImage() is called when the OpenGL renderer is used. One can use the "Hardware OpenGL" or "Software OpenGL" renderer as the render engine in the render settings. This is typically done to create fast animation previews. And this render job can be rendered on the command line, team render etc. where GetActiveDocument() would not be valid.

            best wishes,
            Sebastian

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