c4d.C4DAtom

The base class of many other classes.

Inheritance

Members

C4DAtom.__eq__(self, other)
C4DAtom.__ne__(self, other)

Check if two different objects point to the same object.

Note

Does not compare if two different objects are equal.

Return type: bool
Returns: True if the objects point to the same object, otherwise False.
C4DAtom.__call__()

New in version R13.016.

Returns the atom if it is alive or None if the atom is dead. This is a convenient way to know if you can still use the object.

Return type: C4DAtom
Returns: The atom if it is still alive, otherwise None.
C4DAtom.CheckOwnership()

Returns the ownership. Normally you don’t need this method.

Return type: bool
Returns: True if Python owns the object, False if CINEMA 4D owns it.
C4DAtom.SetDirty(flags)

Sets the dirty checksum, the one returned by GetDirty().

Parameters: flags (int) –

Flags

DIRTY_MATRIX Matrix changed.
DIRTY_DATA Container changed.
DIRTY_SELECT Checks all valid selections of the object, e.g. points, edge, polys.
DIRTY_CACHE Checks if the cache of an object has been changed (rebuilt).
DIRTY_CHILDREN Checks if the children are dirty.
C4DAtom.GetDirty(flags)

Gets the dirty checksum for the object. This can be used to check if the object has been changed.

Parameters: flags (int) –

Flags

DIRTY_MATRIX Matrix changed.
DIRTY_DATA Container changed.
DIRTY_SELECT Checks all valid selections of the object, e.g. points, edge, polys.
DIRTY_CACHE Checks if the cache of an object has been changed (rebuilt).
DIRTY_CHILDREN Checks if the children are dirty.
Return type: int
Returns: The checksum.
C4DAtom.IsAlive()

Even though a reference to an object still exists, the object might be freed by an user interaction. Normally not needed.

Return type: bool
Returns: True if the object is still alive, otherwise False
C4DAtom.CheckType(id)

Checks if this atom is an instance of a base type.

Parameters: id (int) – The type, for example Ocube.
Return type: int
Returns: True if the atom is an instance of the type id, otherwise False.
C4DAtom.GetType()

Get the type of the atom. This must be used to make sure that the derived object really is of the right type before trying to access its members.

Return type: int
Returns: The type, for example Ocube.
C4DAtom.GetClassification()

Returns the base type of the object, e.g. for all objects Obase, for all materials Mmat, for all tags Tbase etc.

Return type: int
Returns: The base type.
C4DAtom.Message(type[, data])

Sends a message to the atom only.

Note

Some notification messages are automatically passed along to branches: MSG_POINTS_CHANGED, MSG_POLYGONS_CHANGED and MSG_SEGMENTS_CHANGED. This is for convenience and historical reasons.

Parameters:
  • type (int) –

    The message ID, one of the following:

    MSG_POINTS_CHANGED The points have changed. The corresponding data is VariableChanged.
    MSG_POLYGONS_CHANGED The polygons have changed. The corresponding data is VariableChanged.
    MSG_UPDATE Must be sent if the bounding box has to be recalculated. (Otherwise you can use MSG_CHANGE.)
    MSG_SMALLUPDATE Part of the object has changed that needs no cache rebuilding. Note: This message should be used very carefully, it is there for (small) performance enhancements, for example if a polygon selection is changed then the caches needn’t be rebuilt, so MSG_SMALLUPDATE can be sent.
    MSG_CHANGE Must be sent if any object data (except for the matrix) has been changed.
    MSG_BASECONTAINER Message with a container, for example from a C.O.F.F.E.E. plugin. The corresponding data is BaseContainer.
    MSG_SEGMENTS_CHANGED The segments have changed. The corresponding data is VariableChanged.
    MSG_FILTER A message filter that lets you block C4DAtom.MultiMessage() calls. The corresponding data is MessageFilter. Return True to let the message pass and False to block it!
    MSG_TRANSFERGOALS Internal message!
    MSG_DESCRIPTION_INITUNDO Allows elements to create undo actions for the following parameter changes in the attributes manager. This is already automatically handled for keys, tags, objects etc. The corresponding data is DescriptionInitUndo.
    MSG_DESCRIPTION_CHECKUPDATE Allows elements to determine the type of refresh after a parameter has been changed in the Active manager. This is already automatically handled for keys, tags, objects etc. The corresponding data is DescriptionCheckUpdate. Note: Currently this message is completely handled by all baseclasses. Most plugins won’t need to modify the message data. It’s more interesting to start some update action - e.g. deleting data that will be rebuilt with the next access.
    MSG_DESCRIPTION_COMMAND Sent by for example BUTTON (description element). See example below.
    MSG_DESCRIPTION_POPUP Allows popup menu handling in the Attribute Manager. The corresponding data is DescriptionPopup.
    MSG_DESCRIPTION_POSTSETPARAMETER After a SetParameter() call to an atom element this message is sent to the object. The corresponding data is DescriptionPostSetValue.
    MSG_DESCRIPTION_VALIDATE Allows you to update dependencies or to check for invalid values after a parameter has been changed (For example: the light’s inner radius always must be smaller than the light’s outer radius - so this routine checks for it and corrects it). The corresponding data is DescriptionValidate.
    MSG_EDIT Allows elements to do some action if the user edits the element (doubleclick e.g. in object manager).
    MSG_MENUPREPARE Allows tags, objects, shaders etc. to do some setup work when called from the menu. The corresponding data is the current BaseDocument.
    MSG_RETRIEVEPRIVATEDATA A generic private message to retrieve data from an object. Specific for every type of object so no public documentation available. The corresponding data is RetrievePrivateData.
    MSG_DESCRIPTION_REMOVE_ENTRY Tells the node to remove a description entry. The corresponding data is DescriptionCommand.
    MSG_DESCRIPTION_EDIT_ENTRY Tells the node to edit a description entry. The corresponding data is DescriptionCommand.
    MSG_DESCRIPTION_CHECKDRAGANDDROP Asks the node if a drag and drop onto for example a LINK (description element) field should be accepted. The corresponding data is DescriptionCheckDragAndDrop.
    MSG_DESCRIPTION_GETBITMAP Queries the object for updated bitmaps for BitmapButtonCustomGui elements in the description. (E.g. the lens flare preview.) The corresponding data is DescriptionGetBitmap.
    MSG_DESCRIPTION_GETOBJECTS Private.
    MSG_DESCRIPTION_USERINTERACTION_END End of user interaction.
    MSG_DESCRIPTION_GETINLINEOBJECT Sent by the Attribute Manager to the object. The object can check for a description ID and return the linked objects in the atom array. The corresponding data is DescriptionInlineObjectMsg.
    MSG_MOVE_FINISHED Sent after a handle or the object has been moved.
    MSG_MOVE_START Sent before a handle or the object has been moved.
    MSG_EDITABLE_END Private.
    MSG_GETCUSTOMICON Every atom can return a custom icon with this message. The corresponding data is GetCustomIconData.
    MSG_MATERIALDRAGANDDROP Received by a material upon dropping an instance of the material onto an object. The material can choose to create a tag of its own, or trigger other actions, instead of letting CINEMA 4D create a normal material assignment. The corresponding data is MaterialDragAndDrop. For example Sketch and Toon creates its own type of tag and returns it in result. CINEMA 4D creates the undo for it and activates it. Inserting the tag is done by the material.
    MSG_DRAGANDDROP Received when something is dropped on it. The corresponding data is DragAndDrop.
    MSG_INITIALCHANNEL See HandleInitialChannel().
    MSG_DOCUMENTINFO Sent as broadcast message to the document when it its loaded, saved etc. The corresponding data is DocumentInfoData. (See the type member for more information about when the message is sent.)
    MSG_GETSELECTION Private.
    MSG_MULTI_RENDERNOTIFICATION A document and all of its elements receive this message before a render starts. The corresponding data is RenderNotificationData.
    MSG_MULTI_MARKMATERIALS When data is None this is sent to plugin nodes to let them mark the materials that they use. Otherwise the message is sent to let you translate you material links, for example when a material is replaced, and then the corresponding structure is MarkMaterials. (An example for both cases is included on the MarkMaterials page.)
    MSG_MULTI_DOCUMENTCLONED The document has been cloned.
    MSG_MULTI_DOCUMENTIMPORTED After a C4D document has been loaded this message is sent to the document (and all children structures). The corresponding data is DocumentImported.
    MSG_MULTI_SETNEWMARKERS Private.
    MSG_MULTI_CLEARSUGGESTEDFOLDER Objects have to remove absolute paths (only if they support MSG_GETALLASSETS). Both are important for SaveProject to work and to collect all items.
    MSG_TRANSLATE_POINTS Sent by the modeling core to let tags etc. update after point changes. The corresponding data is TranslationMaps.
    MSG_TRANSLATE_POLYGONS Sent by the modeling core to let tags etc. update after polygon changes. The corresponding data is TranslationMaps.
    MSG_TRANSLATE_NGONS Sent by the modeling core to let tags etc. update after N-gon changes. The corresponding data is TranslationMaps.
    MSG_TRANSLATE_SEGMENTS Sent by the modeling core to let tags etc. update after segment changes. The corresponding data is TranslationMaps.
    MSG_PRETRANSLATE_POINTS Sent before MSG_TRANSLATE_POINTS, before the changes are actually carried out. The corresponding data is TranslationMaps.
    MSG_PRETRANSLATE_POLYGONS Sent before MSG_TRANSLATE_POLYGONS, before the changes are actually carried out. The corresponding data is TranslationMaps.
    MSG_PRETRANSLATE_NGONS Sent before MSG_TRANSLATE_NGONS, before the changes are actually carried out. The corresponding data is TranslationMaps.
    MSG_PRETRANSLATE_SEGMENTS Sent before MSG_TRANSLATE_SEGMENTS, before the changes are actually carried out. The corresponding data is TranslationMaps.
    MSG_UPDATE_NGONS Should be sent if points are changed and any N-gons need updating. CINEMA 4D will then update the N-gons, if the user has this option enabled.
    MSG_DOCUMENT_MODE_CHANGED Sent to the active tool plugin during BaseDocument.SetMode().
    MSG_TOOL_RESTART Private. (Handles the tool description apply behaviour after mouse clicks.)
    MSG_DEFORMMODECHANGED Private.
    MSG_ANIMATE Sent to objects after they have been animated.
    MSG_CALCMEMUSAGE Private.
    MSG_SCALEDOCUMENT Tells the document that another document with different scale has been merged. The corresponding data is MessageScaleDocument.
    MSG_GET_INHERITANCECONTAINER Private.
    MSG_SOFTTAG_UPDATE Private.
  • data (any) – The message data. Depends on the message type.
Return type:

bool

Returns:

Depends on the message type.

C4DAtom.MultiMessage(flags, type[, data])

New in version R13.016.

Sends a message to the atom and to its children, parents or branches, depending on flags.

Parameters:
  • flags (int) –

    A combination of the following:

    MULTIMSG_ROUTE_NONE None.
    MULTIMSG_ROUTE_UP Send to parents.
    MULTIMSG_ROUTE_ROOT Send to root object.
    MULTIMSG_ROUTE_DOWN Send to children.
    MULTIMSG_ROUTE_BROADCAST Broadcast the message, i.e. distribute it to all branches given by GeListNode.GetBranchInfo().
  • type (int) –

    The message ID, one of the following:

    MSG_POINTS_CHANGED The points have changed. The corresponding data is VariableChanged.
    MSG_POLYGONS_CHANGED The polygons have changed. The corresponding data is VariableChanged.
    MSG_UPDATE Must be sent if the bounding box has to be recalculated. (Otherwise you can use MSG_CHANGE.)
    MSG_SMALLUPDATE Part of the object has changed that needs no cache rebuilding. Note: This message should be used very carefully, it is there for (small) performance enhancements, for example if a polygon selection is changed then the caches needn’t be rebuilt, so MSG_SMALLUPDATE can be sent.
    MSG_CHANGE Must be sent if any object data (except for the matrix) has been changed.
    MSG_BASECONTAINER Message with a container, for example from a C.O.F.F.E.E. plugin. The corresponding data is BaseContainer.
    MSG_SEGMENTS_CHANGED The segments have changed. The corresponding data is VariableChanged.
    MSG_FILTER A message filter that lets you block C4DAtom.MultiMessage() calls. The corresponding data is MessageFilter. Return True to let the message pass and False to block it!
    MSG_TRANSFERGOALS Internal message!
    MSG_DESCRIPTION_INITUNDO Allows elements to create undo actions for the following parameter changes in the attributes manager. This is already automatically handled for keys, tags, objects etc. The corresponding data is DescriptionInitUndo.
    MSG_DESCRIPTION_CHECKUPDATE Allows elements to determine the type of refresh after a parameter has been changed in the Active manager. This is already automatically handled for keys, tags, objects etc. The corresponding data is DescriptionCheckUpdate. Note: Currently this message is completely handled by all baseclasses. Most plugins won’t need to modify the message data. It’s more interesting to start some update action - e.g. deleting data that will be rebuilt with the next access.
    MSG_DESCRIPTION_COMMAND Sent by for example BUTTON (description element). See example below.
    MSG_DESCRIPTION_POPUP Allows popup menu handling in the Attribute Manager. The corresponding data is DescriptionPopup.
    MSG_DESCRIPTION_POSTSETPARAMETER After a SetParameter() call to an atom element this message is sent to the object. The corresponding data is DescriptionPostSetValue.
    MSG_DESCRIPTION_VALIDATE Allows you to update dependencies or to check for invalid values after a parameter has been changed (For example: the light’s inner radius always must be smaller than the light’s outer radius - so this routine checks for it and corrects it). The corresponding data is DescriptionValidate.
    MSG_EDIT Allows elements to do some action if the user edits the element (doubleclick e.g. in object manager).
    MSG_MENUPREPARE Allows tags, objects, shaders etc. to do some setup work when called from the menu. The corresponding data is the current BaseDocument.
    MSG_RETRIEVEPRIVATEDATA A generic private message to retrieve data from an object. Specific for every type of object so no public documentation available. The corresponding data is RetrievePrivateData.
    MSG_DESCRIPTION_REMOVE_ENTRY Tells the node to remove a description entry. The corresponding data is DescriptionCommand.
    MSG_DESCRIPTION_EDIT_ENTRY Tells the node to edit a description entry. The corresponding data is DescriptionCommand.
    MSG_DESCRIPTION_CHECKDRAGANDDROP Asks the node if a drag and drop onto for example a LINK (description element) field should be accepted. The corresponding data is DescriptionCheckDragAndDrop.
    MSG_DESCRIPTION_GETBITMAP Queries the object for updated bitmaps for BitmapButtonCustomGui elements in the description. (E.g. the lens flare preview.) The corresponding data is DescriptionGetBitmap.
    MSG_DESCRIPTION_GETOBJECTS Private.
    MSG_DESCRIPTION_USERINTERACTION_END End of user interaction.
    MSG_DESCRIPTION_GETINLINEOBJECT Sent by the Attribute Manager to the object. The object can check for a description ID and return the linked objects in the atom array. The corresponding data is DescriptionInlineObjectMsg.
    MSG_MOVE_FINISHED Sent after a handle or the object has been moved.
    MSG_MOVE_START Sent before a handle or the object has been moved.
    MSG_EDITABLE_END Private.
    MSG_GETCUSTOMICON Every atom can return a custom icon with this message. The corresponding data is GetCustomIconData.
    MSG_MATERIALDRAGANDDROP Received by a material upon dropping an instance of the material onto an object. The material can choose to create a tag of its own, or trigger other actions, instead of letting CINEMA 4D create a normal material assignment. The corresponding data is MaterialDragAndDrop. For example Sketch and Toon creates its own type of tag and returns it in result. CINEMA 4D creates the undo for it and activates it. Inserting the tag is done by the material.
    MSG_DRAGANDDROP Received when something is dropped on it. The corresponding data is DragAndDrop.
    MSG_INITIALCHANNEL See HandleInitialChannel().
    MSG_DOCUMENTINFO Sent as broadcast message to the document when it its loaded, saved etc. The corresponding data is DocumentInfoData. (See the type member for more information about when the message is sent.)
    MSG_GETSELECTION Private.
    MSG_MULTI_RENDERNOTIFICATION A document and all of its elements receive this message before a render starts. The corresponding data is RenderNotificationData.
    MSG_MULTI_MARKMATERIALS When data is None this is sent to plugin nodes to let them mark the materials that they use. Otherwise the message is sent to let you translate you material links, for example when a material is replaced, and then the corresponding structure is MarkMaterials. (An example for both cases is included on the MarkMaterials page.)
    MSG_MULTI_DOCUMENTCLONED The document has been cloned.
    MSG_MULTI_DOCUMENTIMPORTED After a C4D document has been loaded this message is sent to the document (and all children structures). The corresponding data is DocumentImported.
    MSG_MULTI_SETNEWMARKERS Private.
    MSG_MULTI_CLEARSUGGESTEDFOLDER Objects have to remove absolute paths (only if they support MSG_GETALLASSETS). Both are important for SaveProject to work and to collect all items.
    MSG_TRANSLATE_POINTS Sent by the modeling core to let tags etc. update after point changes. The corresponding data is TranslationMaps.
    MSG_TRANSLATE_POLYGONS Sent by the modeling core to let tags etc. update after polygon changes. The corresponding data is TranslationMaps.
    MSG_TRANSLATE_NGONS Sent by the modeling core to let tags etc. update after N-gon changes. The corresponding data is TranslationMaps.
    MSG_TRANSLATE_SEGMENTS Sent by the modeling core to let tags etc. update after segment changes. The corresponding data is TranslationMaps.
    MSG_PRETRANSLATE_POINTS Sent before MSG_TRANSLATE_POINTS, before the changes are actually carried out. The corresponding data is TranslationMaps.
    MSG_PRETRANSLATE_POLYGONS Sent before MSG_TRANSLATE_POLYGONS, before the changes are actually carried out. The corresponding data is TranslationMaps.
    MSG_PRETRANSLATE_NGONS Sent before MSG_TRANSLATE_NGONS, before the changes are actually carried out. The corresponding data is TranslationMaps.
    MSG_PRETRANSLATE_SEGMENTS Sent before MSG_TRANSLATE_SEGMENTS, before the changes are actually carried out. The corresponding data is TranslationMaps.
    MSG_UPDATE_NGONS Should be sent if points are changed and any N-gons need updating. CINEMA 4D will then update the N-gons, if the user has this option enabled.
    MSG_DOCUMENT_MODE_CHANGED Sent to the active tool plugin during BaseDocument.SetMode().
    MSG_TOOL_RESTART Private. (Handles the tool description apply behaviour after mouse clicks.)
    MSG_DEFORMMODECHANGED Private.
    MSG_ANIMATE Sent to objects after they have been animated.
    MSG_CALCMEMUSAGE Private.
    MSG_SCALEDOCUMENT Tells the document that another document with different scale has been merged. The corresponding data is MessageScaleDocument.
    MSG_GET_INHERITANCECONTAINER Private.
    MSG_SOFTTAG_UPDATE Private.
  • data (any) – The message data. It must match the message ID type.
Return type:

bool

Returns:

Depends on the message type.

C4DAtom.CopyTo(dst, flags)

Copies all values from self to dst. The atoms must be of the same type!

Parameters:
  • dst (C4DAtom) –
  • flags (int) –
    COPY_NO_HIERARCHY Copy without children.
    COPY_NO_ANIMATION Copy without tracks, sequences or keys.
    COPY_NO_BITS Don’t copy BaseList2D bits.
    COPY_NO_BRANCHES Don’t copy branches, for example tags on an object. Automatically implies COPY_NO_ANIMATION, as animation is a branch.
    COPY_NO_INTERNALS This flag means that just the source object’s data is transfered to the destination (without modifying the source).
    COPY_DOCUMENT This is a read-only flag that’s set when a complete document is copied.
    COPY_NONGONS Don’t copy N-gons.
Return type:

bool

Returns:

True if the atom was copied.

C4DAtom.GetClone([flags=0])

Clones the object and returns the reference.

Parameters: flags (int) –

Flags for the clone.

COPY_NO_HIERARCHY Copy without children.
COPY_NO_ANIMATION Copy without tracks, sequences or keys.
COPY_NO_BITS Don’t copy BaseList2D bits.
COPY_NO_BRANCHES Don’t copy branches, for example tags on an object. Automatically implies COPY_NO_ANIMATION, as animation is a branch.
COPY_NO_INTERNALS This flag means that base links aren’t transfered to the new cloned object, so that they still point at the source object.
COPY_DOCUMENT This is a read-only flag that’s set when a complete document is copied.
COPY_NONGONS Don’t copy N-gons.
Return type: C4DAtom
Returns: Minimum of type atom.
C4DAtom.Write(hf)

New in version R13.016.

Writes the atom to a HyperFile.

Note

This is the function to use if you have opened the hyper file yourself and are writing the object manually. If writing within a plugin function where CINEMA 4D has passed the hyper file you should use WriteObject().

Note

The methods Read(), Write(), ReadObject() and WriteObject() are generally not recommended for plugins.

Parameters: hf (HyperFile) – The hyperfile to write to.
Return type: bool
Returns: True if the atom was written, otherwise False.
C4DAtom.Read(hf, id, level)

New in version R13.016.

Reads to this atom from a HyperFile, manually specifying ID and level.

Note

This is the function to use if you have opened the hyper file yourself and are reading the object separately. If reading within a plugin function where CINEMA 4D has passed the hyper file you should use ReadObject().

Note

The methods Read(), Write(), ReadObject() and WriteObject() are generally not recommended for plugins.

Parameters:
  • hf (HyperFile) – The hyperfile to read from.
  • id (int) – The ID of the atom to read.
  • level (int) – The disklevel of the atom to read.
Return type:

bool

Returns:

True if the atom was read, otherwise False.

C4DAtom.WriteObject(hf)

New in version R13.016.

Writes this atom to a HyperFile, within another write operation.

Note

This is the function to use where CINEMA 4D has passed the hyper file you should use, for example in a plugin hook. Otherwise you should use Write().

Note

The methods Read(), Write(), ReadObject() and WriteObject() are generally not recommended for plugins.

Parameters: hf (HyperFile) – The hyperfile to write to.
Return type: bool
Returns: True if the atom was written, otherwise False.
C4DAtom.ReadObject(hf, readheader)

New in version R13.016.

Reads to this atom from a HyperFile within another read operation.

Note

This is the function to use where CINEMA 4D has passed the hyper file you should use, for example in a plugin hook. Otherwise you should use Read().

Note

The methods Read(), Write(), ReadObject() and WriteObject() are generally not recommended for plugins.

Parameters:
  • hf (HyperFile) – The hyperfile to read from.
  • readheader (bool) – Normally True. Should only be False if you have manually read the file header yourself.
Return type:

bool

Returns:

True if the atom was read, otherwise False.

Table Of Contents