your code does look a bit confusing to me.
If you invoke
ObjectData.Init()then you do not have to handle your cache manually in
Only letting your
GVOlogic execute if the
BaseObjectnode attached to your
ObjectDatahas no children and then grabing the first object of the scene as an input is really weird.
If you do some file I/O, you should not do it in
GVOif possible. Also the following snippet is a crash waiting to happen (when your first object in the scene is a
preset = doc.GetFirstObject() obj = preset.GetClone()
You do modify the scene graph and invoke events in
GVO. You are not allowed to do that.
You also use
GVOagainst its purpose since you never do return any objects constructed in your
GVO. You only return the cache when your object node isn't flagged dirty. But that does not mean anything since you never return any objects to populate that cache. In most cases your
None, which will be read by c4d as that you have indicated an memory error. If you want to return nothing you have to return a null object. So there is nothing to convert in your
Think of your
ObjectDataas a null object. In
GVOyou have to return the object tree that c4d is supposed to put under that null. These children objects will be hidden from the user. When the user then invokes "current state to object" c4d will remove that null and return the hidden object tree.