The undo system of Cinema 4D allows to store changes of elements so that these changes can be undone and redone. An undo action can contain multiple changes to multiple elements - all these changes will be undone in a single step when the undo action is applied. These undo actions are stored in an undo buffer and are created in a BaseDocument.
Undo actions are added to the BaseDocument using these functions:
The undo types are:
UNDOTYPE::CHANGE_SELECTION : Change to point/poly/edge selection only. Needs to be called BEFORE the change.
UNDOTYPE::NEWOBJ : New object/material/tag etc. was created. Needs to be called AFTER the insertion.
UNDOTYPE::DELETEOBJ : Object/node/tag etc. to be deleted. Needs to be called BEFORE removal.
UNDOTYPE::BITS : Change to object bits, e.g. selection status. Needs to be called BEFORE the change.
UNDOTYPE::HIERARCHY_PSR : Change in hierarchical placement and PSR values. Needs to be called BEFORE the change.
Undo actions can be applied using these functions:
If the user changes a parameter value in the Attribute Manager, Cinema 4D will create the proper undos. NodeData based plugins will receive a message to add custom operations to the automatically created undo action.