Best way to store "Bake" Information
-
Hello! I had a more general question about the proper way to do something within Cinema.
I want to have a 'Bake' button on my plugin that will do some of the heavy lifting as a single step, so that these calculations don't need to be done on a per update basis. I could create the needed data structures once and use those instead of constantly rebuilding them.
My question is what is the best way to implement this. My initial thought was to use a BaseArray of a custom Class to store the needed data. Something along the lines of one entry per child object to keep track of relationships and choices. Is this a valid way to go about it?
I was running into some problems with Read and Write, converting the Class to be read and written could be done though. One thing I was stumped on is that if I Free my BaseArray when the object is deleted then how would I bring it back if Undo was used?
Thanks for any help,
Dan -
Hi,
I'm guessing you are in an NodeData?
There's no "best way".
Depending on your data, you need to create a container for them. Could be a class, an array.
You must implement Read, Write and CopyTo. (If you implement one, you need all of them).Either you serialized the data into smaller data that can be read/write to hyperfiles with already existing function, or you can use WriteMemory that will allow you to write object to hyperfiles. Be aware that WriteMemory is not platform independent. Then, you can use ReadMemory.
If you delete the object, the object will be copied to the undo stack. The CopyTo willl be used to copy your data.
Cheers,
Manuel -
Hi Manuel,
I didn't think about CopyTo being called on undo. That might be all I need then, thanks. I did a couple tweaks and as of now everything is perfect.
Dan