C4DAtom Class Reference

#include <c4d_baselist.h>

Inheritance diagram for C4DAtom:

Detailed Description

The base class of many classes within the API.
Represents an object that can be read from and written to disk, copied and that has a description for the Attribute Manager.

See also
AtomArray

Private Member Functions

 C4DAtom ()
 
 ~C4DAtom ()
 

Type

Int32 GetType () const
 
Int32 GetRealType () const
 
Int32 GetDiskType () const
 
Bool IsInstanceOf (Int32 id) const
 
Int32 GetClassification () const
 

Message

Bool Message (Int32 type, void *data=nullptr)
 
Bool MultiMessage (MULTIMSG_ROUTE flags, Int32 type, void *data)
 

Copy

C4DAtomGetClone (COPYFLAGS flags, AliasTrans *trn)
 
Bool CopyTo (C4DAtom *dst, COPYFLAGS flags, AliasTrans *trn)
 

Read/Write

Bool Read (HyperFile *hf, Int32 id, Int32 level)
 
Bool Write (HyperFile *hf)
 
Bool ReadObject (HyperFile *hf, Bool readheader)
 
Bool WriteObject (HyperFile *hf)
 

Description

Bool GetDescription (Description *description, DESCFLAGS_DESC flags)
 
Bool GetParameter (const DescID &id, GeData &t_data, DESCFLAGS_GET flags)
 
Bool SetParameter (const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
 
DynamicDescriptionGetDynamicDescription ()
 
Bool GetEnabling (const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc)
 
Bool TranslateDescID (const DescID &id, DescID &res_id, C4DAtom *&res_at)
 

Dirty Flags

UInt32 GetDirty (DIRTYFLAGS flags) const
 
void SetDirty (DIRTYFLAGS flags)
 
UInt32 GetHDirty (HDIRTYFLAGS mask) const
 
void SetHDirty (HDIRTYFLAGS mask)
 

Constructor & Destructor Documentation

◆ C4DAtom()

C4DAtom ( )
private

◆ ~C4DAtom()

~C4DAtom ( )
private

Member Function Documentation

◆ GetType()

Int32 GetType ( ) const

Gets the type of the atom.

Warning
This must be used to make sure that the derived object is really of the right type before casting it and accessing its members.
Note
Plugin nodes return their unique plugin IDs.
Returns
The type, for example Ocube.

◆ GetRealType()

Int32 GetRealType ( ) const

Gets the real type of the atom. This is similar to GetType(), but for multinodes the ID of the last linked part is returned.
E.g. XPresso nodes have the type ID_GV_GROUPDATA or ID_GV_NODEDATA but GetRealType() returns the ID of the operator.

Returns
The type, for example Ocube.

◆ GetDiskType()

Int32 GetDiskType ( ) const

Gets the atoms unique disk type ID.

Note
Normally this is the same as GetType() but there are exceptions.
Returns
The type, for example Ocube.

◆ IsInstanceOf()

Bool IsInstanceOf ( Int32  id) const

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

Note
To check if an object is a spline, check BaseList2D::GetInfo() & OBJECT_ISSPLINE instead.
Be aware that generators like the Cloner or Alembic objects have the flag OBJECT_ISSPLINE set at registration, but calling ToSpline() would not return a valid SplineObject.
In the case of an Alembic generator representing a spline, get the cache and check the type of it.
Parameters
[in]idThe base type ID, for example Obase.
Returns
true if the atom is an instance of the given type id, otherwise false.

◆ GetClassification()

Int32 GetClassification ( ) const

Returns the base type of the atom; e.g. Obase for objects , Tbase for tags etc.

Returns
The base type.

◆ Message()

Bool Message ( Int32  type,
void *  data = nullptr 
)

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
[in]typeThe message type, one of the following: MSG
[in,out]dataThe message data. The sender owns the pointed data.
Returns
Depends on the message type.

◆ MultiMessage()

Bool MultiMessage ( MULTIMSG_ROUTE  flags,
Int32  type,
void *  data 
)

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

Parameters
[in]flagsA combination of the following flags: MULTIMSG_ROUTE
[in]typeThe message type, one of the following types: MSG
[in,out]dataThe message data. The sender owns the pointed data.
Returns
Depends on the message type.

◆ GetClone()

C4DAtom* GetClone ( COPYFLAGS  flags,
AliasTrans trn 
)

Retrieves a copy of the atom.

Parameters
[in]flagsFlags for the clone: COPYFLAGS
[in]trnAn alias translator for the operation. Can be nullptr. The caller owns the pointed object.
Returns
The cloned atom. The caller owns the pointed object.

◆ CopyTo()

Bool CopyTo ( C4DAtom dst,
COPYFLAGS  flags,
AliasTrans trn 
)

Copies all values from *this to *dst.

Warning
The atoms must be of the same type.
Parameters
[out]dstThe destination. The caller owns the pointed object.
[in]flagsFlags for the copy: COPYFLAGS
[in]trnAn alias translator for the operation. Can be nullptr. The caller owns the pointed object.
Returns
true if the atom was copied, otherwise false.

◆ Read()

Bool Read ( HyperFile hf,
Int32  id,
Int32  level 
)

Reads the atom from a HyperFile, manually specifying id and disk level.

Note
This is the function to use if the hyper has been opened manually and the object is read separately. If reading within a plugin function where Cinema 4D has passed the hyper file use ReadObject().
Read(), Write(), ReadObject() and WriteObject() are generally not recommended for plugins.
Parameters
[in]hfThe hyper file to read from. The caller owns the pointed object.
[in]idThe ID of the atom to read.
[in]levelThe disk level of the atom to read.
Returns
true if the atom was read, otherwise false.

◆ Write()

Bool Write ( HyperFile hf)

Writes the atom to a HyperFile.

Note
This is the function to use if the hyper has been opened manually and the object is written separately. If writing within a plugin function where Cinema 4D has passed the hyper file use WriteObject().
Warning
Read(), Write(), ReadObject() and WriteObject() are generally not recommended for plugins.
Parameters
[in]hfThe hyper file to write to. The caller owns the pointed object.
Returns
true if the atom was written, otherwise false.

◆ ReadObject()

Bool ReadObject ( HyperFile hf,
Bool  readheader 
)

Reads the atom from a HyperFile within another read operation.

Note
This is the function to use where Cinema 4D has passed the hyper file, for example in a plugin hook. Otherwise use Read().
Warning
Read(), Write(), ReadObject() and WriteObject() are generally not recommended for plugins.
Parameters
[in]hfThe hyper file to read from. The caller owns the pointed object.
[in]readheaderNormally true. Should only be false if the file header is manually read.
Returns
true if the atom was read, otherwise false.

◆ WriteObject()

Bool WriteObject ( HyperFile hf)

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

Note
This is the function to use where Cinema 4D has passed the hyper file, for example in a plugin hook. Otherwise use Write().
Warning
Read(), Write(), ReadObject() and WriteObject() are generally not recommended for plugins.
Parameters
[in]hfThe hyper file to write to. The caller owns the pointed object.
Returns
true if the atom was written, otherwise false.

◆ GetDescription()

Bool GetDescription ( Description description,
DESCFLAGS_DESC  flags 
)

Gets the description for the atom.

Parameters
[out]descriptionFilled with the atom's description. The caller owns the pointed object.
[in]flagsFlags: DESCFLAGS_DESC
Returns
true if the description was retrieved, otherwise false.

◆ GetParameter()

Bool GetParameter ( const DescID id,
GeData t_data,
DESCFLAGS_GET  flags 
)

Gets a parameter of the atom.

Parameters
[in]idThe ID of the parameter.
[out]t_dataAssigned the parameter's data.
[in]flagsFlags: DESCFLAGS_GET
Returns
true if the parameter was retrieved, otherwise false.

◆ SetParameter()

Bool SetParameter ( const DescID id,
const GeData t_data,
DESCFLAGS_SET  flags 
)

Sets a parameter of the atom.

Parameters
[in]idThe ID of the parameter.
[in]t_dataThe data to set.
[in]flagsFlags: DESCFLAGS_SET
Returns
true if the parameter was set, otherwise false.

◆ GetDynamicDescription()

DynamicDescription* GetDynamicDescription ( )

Gets the dynamic description of the atom. (Also known as the user data part of the Attribute Manager.)

Returns
The dynamic description. The atom owns the pointed object.

◆ GetEnabling()

Bool GetEnabling ( const DescID id,
const GeData t_data,
DESCFLAGS_ENABLE  flags,
const BaseContainer itemdesc 
)

Checks if a description parameter should be disabled or enabled.

Parameters
[in]idThe ID of the parameter.
[out]t_dataAssigned the current data.
[in]flagsFlags: DESCFLAGS_ENABLE
[out]itemdescThe parameter's description, encoded to a container as described in Description.
Returns
true if the parameter should be enabled, otherwise false.

◆ TranslateDescID()

Bool TranslateDescID ( const DescID id,
DescID res_id,
C4DAtom *&  res_at 
)

Redirects description IDs between nodes.

Parameters
[in]idThe description ID to redirect.
[in]res_idThe target description ID.
[in]res_atThe target node.
Returns
true if successful, otherwise false.

◆ GetDirty()

UInt32 GetDirty ( DIRTYFLAGS  flags) const

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

See also
GetHDirty()
Parameters
[in]flagsFlags: DIRTYFLAGS
Returns
The dirty checksum.

◆ SetDirty()

void SetDirty ( DIRTYFLAGS  flags)

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

See also
SetHDirty()
Parameters
[in]flagsFlags: DIRTYFLAGS

◆ GetHDirty()

UInt32 GetHDirty ( HDIRTYFLAGS  mask) const

Gets the dirty bits for the specified mask.

See also
GetDirty().
Parameters
[in]maskMask: HDIRTYFLAGS
Returns
The dirty bits.

◆ SetHDirty()

void SetHDirty ( HDIRTYFLAGS  mask)

Sets the dirty bits, the one returned by GetHDirty().

See also
SetDirty().
Parameters
[in]maskMask: HDIRTYFLAGS