On 24/01/2013 at 20:01, xxxxxxxx wrote:
It is assuredly possible to store as many images as you would like to the hyperfile.
Two important points you should consider:
1. You should create a LONG description in your tag to store the number of bitmaps currently in the array so that upon reading, you know the number that were saved and need to be read (otherwise, how would your code know? - this will surely end poorly if that number is not known).
2. For retaining button-image assignments, you will need to store that information somewhere. You could create a separate array that mirrors the bitmap array to store, say, the button ID. Or you could create a simple class that stores a BaseBitmap* and the button ID that you create as an array of instances. You would then go through the simple class array to store the bitmap (WriteImage()) and ID association (WriteLong()).
Realize that the reading-writing process is in tandem. That is, the order that you write data is the EXACT order that you must read it. The C4D file format is not random access - it is linear data (possibly chunked, but not important). The good thing though, is that static descriptions are always read before Read() is called so that they are available in Read() by default.
Finally, you need some way to do this. Yes, you will need to figure out what information is required to retain the bitmaps and their correct button associations and write-read-copyto that information for it to be retained in file. Also, upon reading, you need to allocate any dynamic structures (arrays, class arrays) that hold this information and data just like when the tag has it allocated otherwise. If you have an array of BaseBitmap* in which you store the images, you will need to allocate an array of BaseBitmap* in Read() not only to read in the images but to store them just like when images are added, say, by the user. Read() needs to reestablish all of the member data as it was while live in the tag when in use (as long as the member isn't just for some intermediate processing).