Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    • Register
    • Login

    How to keep data in tag plugin even if restart Cinema 4D

    Cinema 4D SDK
    python
    3
    7
    1.1k
    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.
    • M
      mike
      last edited by r_gigante

      i need keep dict data in my tag plugin even if restart cinema 4d. SetWorldPluginData() maybe useful,but how to get the currect data if i have tag multiple instances?I'm sorry this may be a basic question, but I didn't find a satisfactory answer.

      hope your help!

      1 Reply Last reply Reply Quote 0
      • M
        mp5gosu
        last edited by mp5gosu

        Since tags belong to an object and objects are written to disk on save, your tag data should still be available on reload.
        Otherwise, you could write a custom BaseContainer with your settings before Cinema 4D gets restarted.

        M 1 Reply Last reply Reply Quote 1
        • M
          mike @mp5gosu
          last edited by

          @mp5gosu Oh!Thank you for your help! I check my code and find it's my error. Excuse me again, I also find :
          1.save project and close
          2.open project
          3.tag plugin data exists and clear data
          4.don't save and recovery project
          5.data is null
          How to solve this problem,keep data?

          1 Reply Last reply Reply Quote 0
          • M
            mp5gosu
            last edited by

            If you don't save, you are responsible to write any data on document close to a custom BaseContainer that is written to your object's container.
            And read the container and restore the tag data on loading the document again.

            M 1 Reply Last reply Reply Quote 1
            • M
              mike @mp5gosu
              last edited by

              @mp5gosu thank you for you answer!

              1 Reply Last reply Reply Quote 0
              • M
                m_adam
                last edited by m_adam

                Hi if your topic is solved please consider turning the topic as solved see Q&A New Functionality.

                In addition to the @mp5gosu message I wanted to point you to the NodeData::Write/Read/CopyTo for more information see the C++ NodeData::Read() / NodeData::Write() Manual which will handle to write/read data when c4d close/open a scene.

                Moreover, if you go to the BaseContainer way and still facing issue with data loading, you may need to react to some message, see NodeData::Message.

                Finally, if you implement the Read/Write make sure to use the disklevel functionality when you register your Plugin. Disklevel can be understood as a plugin version, so if you modify the structure of the data stored you will still be able to read/write your data according to the correct version.

                Cheers,
                Maxime.

                MAXON SDK Specialist

                Development Blog, MAXON Registered Developer

                1 Reply Last reply Reply Quote 1
                • M
                  m_adam
                  last edited by m_adam

                  Please consider to sets the topic as solved if it's the case.
                  Cheers,
                  Maxime.

                  EDIT: I've done it, but feel free to set it back to Open if you feel the need to ask more questions.

                  MAXON SDK Specialist

                  Development Blog, MAXON Registered Developer

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