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

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!

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.

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

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.

@mp5gosu thank you for you answer!

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.


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

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