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)
{
{
{
}
}
}
- 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)
{
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:
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:1453
void InsertObject(BaseObject *op, BaseObject *parent, BaseObject *pred, Bool checknames=false)
static String UIntToString(UInt32 v)
Definition: c4d_string.h:511
Definition: c4d_baseobject.h:1410
UInt32 GetHDirty(HDIRTYFLAGS mask) const
Definition: c4d_baselist.h:1589
Definition: c4d_baseobject.h:224
C4DAtomGoal * GetLinkAtom(const BaseDocument *doc, Int32 instanceof=0) const
Definition: c4d_baselist.h:2913
Definition: lib_description.h:328
Bool GetDescription(Description *description, DESCFLAGS_DESC flags)
maxon::UInt32 UInt32
Definition: ge_sys_math.h:61
Int32 GetPointCount(void) const
Definition: c4d_baseobject.h:1460
BaseMaterial * GetActiveMaterial(void)
Matrix GetMg() const
Definition: c4d_baseobject.h:482
Int32 GetClassification() const
Definition: c4d_baselist.h:1409
#define Ocube
Cube.
Definition: ge_prepass.h:1074
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
@ PRIM_CUBE_LEN
Definition: ocube.h:6
UInt32 GetDirty(DIRTYFLAGS flags) const
Definition: c4d_baselist.h:1573
#define Opoint
Point - PointObject.
Definition: ge_prepass.h:1055
#define MSG_UPDATE
Must be sent if the bounding box has to be recalculated. (Otherwise use MSG_CHANGE....
Definition: c4d_baselist.h:340
Definition: c4d_string.h:38
@ FFDOBJECT_SIZE
Definition: offd.h:6
static String IntToString(Int32 v)
Definition: c4d_string.h:495
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:3066
#define Offd
FFD.
Definition: ge_prepass.h:1016
void GetActiveObjects(AtomArray &selection, GETACTIVEOBJECTFLAGS flags) const
Definition: c4d_gedata.h:82
#define Obase
Base object - BaseObject.
Definition: ge_prepass.h:1054
Definition: c4d_baselist.h:1361
void SetName(const maxon::String &name)
Definition: c4d_baselist.h:2354
maxon::Int32 Int32
Definition: ge_sys_math.h:60
void Translate(Bool connect_oldgoals)
Definition: c4d_baselist.h:3074
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:210
Bool Message(Int32 type, void *data=nullptr)
Definition: c4d_baselist.h:1424
@ OBJECT
Object data mask.
#define Mmaterial
Standard material.
Definition: ge_prepass.h:981
maxon::Vec3< maxon::Float64, 1 > Vector
Definition: ge_math.h:145
void EventAdd(EVENT eventflag=EVENT::NONE)
V off
The translation vector.
Definition: matrix.h:279
Definition: ge_autoptr.h:36
@ MATERIAL
Material data mask.
String GetString(Int32 id, const maxon::String &preset=maxon::String()) const
Definition: c4d_basecontainer.h:387
@ DESC_NAME
String Name for standalone use.
Definition: lib_description.h:91
BaseObject * GetActiveObject(void)
Bool IsInstanceOf(Int32 id) const
Definition: c4d_baselist.h:1403
void BrowseFree(void *&handle)
static String VectorToString(const Vector32 &v, Int32 nnk=-1)
Definition: c4d_string.h:571
Int32 GetType() const
Definition: c4d_baselist.h:1378
Definition: c4d_baselist.h:2869
Definition: c4d_basematerial.h:27
BaseLink * GetBaseLink(void) const
Definition: c4d_gedata.h:493
Bool GetParameter(const DescID &id, GeData &t_data, DESCFLAGS_GET flags)
const Vector & GetVector(void) const
Definition: c4d_gedata.h:451
@ MATERIAL_COLOR_COLOR
Definition: mmaterial.h:56
Definition: c4d_basecontainer.h:46