Document copied for Picture viewer doesnt copy contents of child of a TagData
-
I am encountering a problem when rendering to picture viewer.
I have two plugins, a TagData and a NodeData as its child.
I also created a link from the TagData to the NodeData for easy access
However when the document is copied and sent to the picture viewer renderer there are two issues.- The link is not copied
- The contents of the NodeData basecontainer are not copied over
The copied TagData does have a child object with my type, so it does exist
Here is how I connect the two plugins
Bool MyTagData::Init(GeListNode* node, Bool isCloneInit) { BaseTag* tag = (BaseTag*)node; BaseContainer *data = tag->GetDataInstance(); BaseList2D* mynodedata= BaseList2D::Alloc(ID_MY_NODEDATA); // Creating my MyNodeData mynodedata->InsertUnderLast(node); //Add as mynodedata as a child to mytagdata data->SetLink(MYTAG_NODEDATA_INK, mynodedata); //Add link for easy access return true; }
This basically works in all situations, except when sending it to the picture viewer for rendering.
I feel like im missing something, but i cant find what in the documentation -
Hey you are not supposed to modify the scene graph during the init function.
Adding children to a tag while it may be possible is as far as I know not something done in Cinema 4D. so for optimization purpose I would not be surprised that they are never copied at all.With that's said I would recommend you to use a custom branch to store your BaseList2D as demonstrated in C++ SDK: Custom Branching Code Example .
In last case you should implement the CopyTo to properly copy your data when your node is copied. But again modifying the scene Graph during the Init is not the way to got.Cheers,
Maxime.