Custom Plugin Data Saving



  • On 22/10/2015 at 19:41, xxxxxxxx wrote:

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

    ---------
    I looked up words like custom, data, saving, and whatnot but found no clear information on this. I need a nudge in the right direction on where to look. I want to go further with a plugin I've made and I'd like to use and retain some custom information that might get calculated during use. I'd also of course like to save states of the user data fields as well. My question is, how does one go about saving custom information like that. In a plugin like X-Particles for instance they have all sorts of stuff saved with the actual scene, particle ages, ids, colors, position vectors, etc. From what I've been reading some of this is automatic I guess, if your using the right base data types?



  • On 23/10/2015 at 04:55, xxxxxxxx wrote:

    You need to overload the NodeData::Read(),::Write() virtual functions. They will be called when the c4d scene file is saved/loaded. There you can save/load your custom data into a HyperFile.

    You also want to overload CopyTo() for that matter for completeness.



  • On 23/10/2015 at 07:48, xxxxxxxx wrote:

    So basically, I need to derive any new classes from NodeData to take advantage of data persistence?



  • On 23/10/2015 at 10:43, xxxxxxxx wrote:

    There are special derived classes that you should derive your own plugin from, i.e. ObjectData, TagData, ShaderData etc. depending on what kind of plugin you want to create. These are all derived from NodeData.

    Check out the SDK docs for info on these subclasses.

    Of course you can also write data onto disc at any time. Overloading the provided virtual functions however makes sure you have maximum support.


Log in to reply