About
C4DAtom is the base class for many entities in the classic Cinema 4D API. Along with GeListNode and BaseList2D it implements the basic functionality of most classic entities. C4DAtomGoal is the extension of the C4DAtom class that allows to create safe references to an C4DAtom entity with a BaseLink .
Access
A pointer to a C4DAtom is typically provided by resolving a BaseLink to an entity. See BaseLink Manual .
if (link == nullptr )
if (linkedAtom != nullptr )
{
}
C4DAtom pointers to any kind of entity are often stored in AtomArray objects. See AtomArray Manual .
Allocation/Deallocation
C4DAtom instances cannot be created directly. Only instances of C4DAtom based classes can be created.
Type
C4DAtom gives access to information about the type and class of the specific entity:
if (classification ==
Obase )
{
const BaseObject *
const baseObject = static_cast<BaseObject*>(atom);
{
PointObject *
const pointObject = static_cast<PointObject*>(atom);
{
}
}
}
Note C4DAtom::IsInstanceOf() can also be used to check the classification and element type.
C4DAtom::GetType() can be used to get the ID of any entity that is not listed in the documentation.
Copy
C4DAtom based entities are easily copied and cloned:
The copy flags are:
The AliasTrans argument of these functions is optional. If an AliasTrans instance is provided it is used to update BaseLink parameters of the copied entities. If a BaseLink references an element that is also copied the BaseLink is changed to reference the copy of the originally referenced entity.
if (alias ==
nullptr || !alias->
Init (doc))
const Int32 selectionCount = objectSelection->GetCount();
if (selectionCount == 0)
for (
Int32 i = 0; i < selectionCount; ++i)
{
BaseObject *
const object = static_cast<BaseObject*>(objectSelection->GetIndex(i));
if (object == nullptr )
if (clone == nullptr )
const String objectName =
object ->GetName();
clone->
SetName (objectName +
" clone" );
}
Disc I/O
A C4DAtom based element can be read from and written to a HyperFile .
If the entity is handled inside another read/write function (NodeData::Read() and NodeData::Write() ) these functions must be used:
Warning These functions are generally not recommended for third party plugins.
Parameter Properties
Parameter descriptions and IDs are managed with these functions:
if (description == nullptr )
while (description->
GetNext (handle, &bc,
id , gid))
{
}
Parameters
The value of parameters should be changed with C4DAtom::GetParameter() and C4DAtom::SetParameter() . In this way one can be sure, the parameters are set correctly even if the entity does not store the data in its BaseContainer .
Note Some parameters must be set with DESCFLAGS_SET::USERINTERACTION .
Note Parameter IDs are defined with DescID objects. See DescID Manual .
Dirty States
The dirty status of an entity is a number that is increased every time the entity is changed.
The dirty flags are:
Hierarchy dirty (HDirty) states are used to check if the given entity or some child elements in the hierarchy were changed. Typically used with a BaseDocument or a GeListHead .
The hierarchy dirty flags are:
Messages
Entities in Cinema 4D often communicate by sending messages to each other. Such a message can be used to inform the element about some event or to retrieve data from the element. A message can be sent to an entity with these functions:
PointObject *
const pointObject = static_cast<PointObject*>(activeObject);
if (points == nullptr )
for (
Int32 i = 0; i < pointCount; ++i)
points[i] = points[i] +
Vector (0, 100, 0);
See also NodeData::Message() Manual .
Further Reading
Vector * GetPointW(void)
Definition: c4d_baseobject.h:1372
void InsertObject(BaseObject *op, BaseObject *parent, BaseObject *pred, Bool checknames=false)
static String UIntToString(UInt32 v)
Definition: c4d_string.h:509
Definition: c4d_baseobject.h:1329
UInt32 GetHDirty(HDIRTYFLAGS mask) const
Definition: c4d_baselist.h:1515
C4DAtom * GetClone(COPYFLAGS flags, AliasTrans *trn)
Definition: c4d_baselist.h:1373
Definition: c4d_baseobject.h:220
C4DAtomGoal * GetLinkAtom(const BaseDocument *doc, Int32 instanceof=0) const
Definition: c4d_baselist.h:2798
Definition: lib_description.h:315
Bool GetDescription(Description *description, DESCFLAGS_DESC flags)
maxon::UInt32 UInt32
Definition: ge_sys_math.h:46
Int32 GetPointCount(void) const
Definition: c4d_baseobject.h:1379
BaseMaterial * GetActiveMaterial(void)
Matrix GetMg() const
Definition: c4d_baseobject.h:478
Int32 GetClassification() const
Definition: c4d_baselist.h:1335
#define Ocube
Cube.
Definition: ge_prepass.h:1035
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:66
Definition: mmaterial.h:56
UInt32 GetDirty(DIRTYFLAGS flags) const
Definition: c4d_baselist.h:1499
#define Opoint
Point - PointObject.
Definition: ge_prepass.h:1017
#define MSG_UPDATE
Must be sent if the bounding box has to be recalculated. (Otherwise use MSG_CHANGE....
Definition: c4d_baselist.h:335
Definition: c4d_string.h:36
static String IntToString(Int32 v)
Definition: c4d_string.h:493
Bool GetNext(void *handle, const BaseContainer **bc, DescID &id, DescID &groupid)
Bool SetParameter(const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
Bool Init(BaseDocument *doc)
Definition: c4d_baselist.h:2951
#define Offd
FFD.
Definition: ge_prepass.h:975
void GetActiveObjects(AtomArray &selection, GETACTIVEOBJECTFLAGS flags) const
Definition: c4d_gedata.h:77
#define Obase
Base object - BaseObject.
Definition: ge_prepass.h:1016
Definition: c4d_baselist.h:1287
void SetName(const maxon::String &name)
Definition: c4d_baselist.h:2265
maxon::Int32 Int32
Definition: ge_sys_math.h:45
void Translate(Bool connect_oldgoals)
Definition: c4d_baselist.h:2959
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:209
Bool Message(Int32 type, void *data=nullptr)
Definition: c4d_baselist.h:1350
#define Mmaterial
Standard material.
Definition: ge_prepass.h:942
maxon::Vec3< maxon::Float64, 1 > Vector
Definition: ge_math.h:133
void EventAdd(EVENT eventflag=EVENT::NONE)
V off
The translation vector.
Definition: matrix.h:279
Definition: ge_autoptr.h:32
String GetString(Int32 id, const maxon::String &preset=maxon::String()) const
Definition: c4d_basecontainer.h:383
String Name for standalone use.
Definition: lib_description.h:87
BaseObject * GetActiveObject(void)
Bool IsInstanceOf(Int32 id) const
Definition: c4d_baselist.h:1329
void BrowseFree(void *&handle)
static String VectorToString(const Vector32 &v, Int32 nnk=-1)
Definition: c4d_string.h:569
Int32 GetType() const
Definition: c4d_baselist.h:1304
Definition: c4d_baselist.h:2754
Definition: c4d_basematerial.h:23
BaseLink * GetBaseLink(void) const
Definition: c4d_gedata.h:477
Bool GetParameter(const DescID &id, GeData &t_data, DESCFLAGS_GET flags)
const Vector & GetVector(void) const
Definition: c4d_gedata.h:435
Definition: c4d_basecontainer.h:42