Open Search

    Table of Contents

    About

    NodeData based classic plugin classes can implement NodeData::Read() and NodeData::Write(). This allows to store internal data that is not stored in the BaseContainer when the scene is saved to a *.c4d file.

    Note
    If NodeData::Read() and NodeData::Write() are implemented typically also NodeData::CopyTo() should be implemented.

    NodeData::Read() corresponds to C4DAtom::Read(), NodeData::Write() corresponds to C4DAtom::Write().

    See also BaseDocument Disc I/O.

    Usage

    NodeData::Read() is called when a *.c4d file is loaded, NodeData::Write() is called when the element is saved to a *.c4d file. The given HyperFile object represents this *.c4d file.

    // This example stores an internal list and an integer value with the actual object.
    {
    if (level >= 0) // checks the plugin level
    {
    // read a GeListHead
    _branchHead->ReadObject(hf, true);
    // read an integer value
    hf->ReadInt32(&_value);
    }
    return true;
    }
    Bool Write(const GeListNode* node, HyperFile* hf) const
    {
    // store a GeListHead
    _branchHead->WriteObject(hf);
    // store an integer value
    hf->WriteInt32(_value);
    return true;
    }
    Represents a C4DAtom that resides in a 4D list.
    Definition: c4d_baselist.h:1844
    Definition: c4d_file.h:1085
    Bool WriteInt32(Int32 v)
    Bool ReadInt32(Int32 *v)
    maxon::Bool Bool
    Definition: ge_sys_math.h:55
    maxon::Int32 Int32
    Definition: ge_sys_math.h:60
    PyObject PyObject PyObject int level
    Definition: import.h:58
    Definition: node.h:10

    The arguments of the functions are:

    Note
    The order of operations needs to be the same in both function implementations.
    When NodeData::Read() is called the element is not yet part of a BaseDocument.
    To check if a message dialog can be shown in the context of NodeData::Read(), use HyperFile::GetFilterFlags() to check if SCENEFILTER::DIALOGSALLOWED is set.

    Further Reading