Open Search

    Table of Contents

    About

    NodeData based classic plugin classes can implement NodeData::CopyTo(). This is usually only needed if internal data is not stored in the element's BaseContainer. If implemented, this function is called when Cinema 4D copies the element. Implementing this function is also needed to correctly support the undo system.

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

    NodeData::CopyTo() corresponds to C4DAtom::CopyTo().

    Usage

    NodeData::CopyTo() is called when Cinema 4D copies the element. This can happen for various reasons and multiple times.

    Bool CopyTo(NodeData* dest, GeListNode* snode, GeListNode* dnode, COPYFLAGS flags, AliasTrans* trn)
    {
    ExampleGenerator* const destObject = static_cast<ExampleGenerator*>(dest);
    if (destObject == nullptr)
    return false;
    // copy internal data
    if (_branchHead)
    {
    GeListHead* destBranchHead = destObject->_branchHead;
    _branchHead->CopyTo(destBranchHead, flags, trn);
    }
    destObject->_value = this->_value;
    return SUPER::CopyTo(dest, snode, dnode, flags, trn);
    }
    PyCompilerFlags * flags
    Definition: ast.h:14
    Definition: c4d_baselist.h:3067
    Bool CopyTo(C4DAtom *dst, COPYFLAGS flags, AliasTrans *trn)
    Definition: c4d_baselist.h:1490
    Definition: c4d_baselist.h:2044
    Represents a C4DAtom that resides in a 4D list.
    Definition: c4d_baselist.h:1831
    Definition: c4d_nodedata.h:39
    maxon::Bool Bool
    Definition: ge_sys_math.h:55
    COPYFLAGS
    Definition: ge_prepass.h:2885

    The arguments of the function are:

    • The destination plugin object as the base NodeData object.
    • The source node.
    • The destination node.
    • The flags for copy.
    • The AliasTrans object.

    The copy-flags are:

    Further Reading