Dump/Restore UserDataContainer
-
Hi,
Is it possible to dump (and restore) a complete UserDataContainer?
ie. save the whole information into a definition in a python source that can be then used to auto generate identical UserDataContainers?I'm talking about the data types and structure (groups etc), not the value content.
best, index
-
Hi,
I am not quite sure what you would consider possible in this context.
- You can of course just create some Python code that hardcodes the desired structure of the container.
- You could obviously also automate this, by lets say taking in some template container and then saving the data structure to a
JSON
file. But this approach has two problems: You are not able to identify the data type of all container values in Python, because some types have not been ported. And for the ones you can identify you are sometimes not able to create some null value out of nothing when rebuilding the container. This both only concerns some more fringe data types like function pointers or memory dumps and of course also limits your possibilities in 1. - The best solution is probably to write the template container to a
c4d.storage.Hyperfile
and then read this file back. This will obviously also serialise and deserialise the values of the container, not only its structure. But again, it is not always possible to populate all data types of some random container structure in Python anyways.
Cheers,
zipit -
thanks zipit,
using Hyperfile looks very promising,
the Userdata Container seems to be a list containing tuples and BaseContainers,
I will try to store that into a file and report back If it worksindex
-
i finally succeeded in saving a BaseList2D userdata description (not the values)
then loading and re-applying / cloning the full definition to a different BaseList2D,
and finally copy over the values from the source to the target BaseList2Dhere is a similar topic for saving / loading the values (not the description) here:
https://developers.maxon.net/forum/topic/11960/advice-for-saving-user-data/8
I made a comment there about copying the userdata values