Hi,
yes, this is expected, and documented in NodeData::Read() / NodeData::Write() Manual. With that's said Read/Write is supposed to serialize data of your object (most of the time member variable) to the c4d file (the HyperFile), so accessing the BaseDocument is a sign of a bad design.
May I ask why do you really want to access the BaseDocument in the Read function?
Cheers,
Maxime
edit (@ferdinand): Just to be clear here, as we briefly talked about this in our morning meeting, what the docs write there is in a certain sense legacy information. When a branch, e.g., the Xbase
(shader) branch of a material is being deserialized, the to be deserialized node is inserted into the branch and with that will have access to a document.
But what @m_adam wrote is of course true, the document in this context is the fruit from the forbidden tree, as the node is not yet fully deserialized and certain parts of the GeListHead::Read, GeListNode::Read, BaseList2D::Read, ..., YourPluginLayer::Read
deserialization chain might pull all sorts of tricks to carry out the deserialization, including temporarily removing the node from the scene graph.
The documentation is therefore effectively still correct, as deserializing a node should never rely on the document context and accessing the document is forbidden in that context.