Best practice for BaseContainer Types
-
On 16/02/2018 at 01:11, xxxxxxxx wrote:
Hi Everyone,
Im currently writing a plugin that stores and retrieves takes data.
Im planning to store 5 separate lists of strings in a sub-basecontainer (to keep the data with the file)
(following along from this post - https://developers.maxon.net/forum/topic/8019/10416_saving-custom-attributes-with-a-scene-file)
So, as per this:
subC = c4d.BaseContainer()
subC.SetString(NAME_IDS _, NAME_LIST _)__ What do i need to set the the subC type to, so i can store lists?
And if i want to store 5 separate lists of strings, is there any conflict i need to be aware of? _
"Once you've set a container value using one type you must neither try to access it using another type, nor overwrite it with a value of another type! Using the wrong access will not crash, but it is illegal."_ I am fully aware of the above from the documentation, hence asking for advice on best practice.
Any and all information would be much appreciated!
Thanks,
Cerac __
-
On 16/02/2018 at 03:45, xxxxxxxx wrote:
You will need to provide your own list implementation.
I do this by creating a subcontainer, storing the number of entries at index 0, then storing the different entries at following indeces (or in a separate subcontainer)Something like
BaseContainer bcList; bcList.SetInt32(0, count); BaseContainer bcData; for (Int32 i = 0; i < count; ++i) bcData.SetString(name_list[i]); bcList.SetContainer(1, bcData);