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

    Incorrect file structure

    Cinema 4D SDK
    r20
    3
    6
    2.6k
    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.
    • rsodreR
      rsodre
      last edited by

      Hi,

      I'm having a recurring issue, opening a test project I was working on the previous day, I get the message "Incorrect file structure" and have to thrash the file. I'm starting to think I'm saving something wrong...

      How can I debug file structure?
      Does C4D generates any log when this happens?

      Roger

      1 Reply Last reply Reply Quote 0
      • kbarK
        kbar
        last edited by

        Are you by any chance writing a plugin that writes to the C4D file? Read, Write, ReadObject, WriteObject etc...

        https://www.gamelogicdesign.com
        https://www.plugins4d.com

        rsodreR 1 Reply Last reply Reply Quote 0
        • rsodreR
          rsodre @kbar
          last edited by

          @kbar I have some custom data types that use WriteData() and ReadData() to store data into the object's container, but haven't changed recently.

          1 Reply Last reply Reply Quote 0
          • a_blockA
            a_block
            last edited by

            Hello Roger,

            I think, @kbar's assumption is not too far fetched. But of course it's difficult to analyze from here.
            Can you maybe break it down a bit and show us some of your code used in WriteData() and ReadData() (probably write is most interesting) in these custom data types?

            Cheers,
            Andreas

            rsodreR 1 Reply Last reply Reply Quote 0
            • rsodreR
              rsodre @a_block
              last edited by

              Hello @a_block,

              Turned out the corrupted files had nothing to do with my custom data. It started crashing on save, corrupting the project. I fixed the crashes by properly freeing vertex buffers with GlVertexBuffer::RemoveObject and GlProgramFactory::RemoveReference, just like the example. The save crash stopped and never again saw a corrupted file again.

              Thanks!

              1 Reply Last reply Reply Quote 0
              • a_blockA
                a_block
                last edited by

                Hi Roger,
                that's good news!
                Cheers,
                Andreas

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