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)
{
}
Definition: c4d_baselist.h:3116
const C4DAtomGoal * GetLinkAtom(const BaseDocument *doc, Int32 instanceof=0) const
Definition: c4d_baselist.h:3164
Definition: c4d_baselist.h:1520
Definition: c4d_gedata.h:83
const BaseLink * GetBaseLink() const
Definition: c4d_gedata.h:529
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
#define ConstDescID(...)
Definition: lib_description.h:594
@ INSTANCEOBJECT_LINK
Definition: oinstance.h:6
const char * doc
Definition: pyerrors.h:226
Represents a level within a DescID.
Definition: lib_description.h:298
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:
const Int32 classification =
atom->GetClassification();
if (classification ==
Obase)
{
{
{
}
}
}
void EventAdd(EVENT eventflag=EVENT::NONE)
Definition: c4d_baseobject.h:248
Matrix GetMg() const
Definition: c4d_baseobject.h:510
Definition: c4d_baseobject.h:1564
Int32 GetPointCount() const
Definition: c4d_baseobject.h:1613
static String IntToString(Int32 v)
Definition: c4d_string.h:497
static String VectorToString(const Vector32 &v, Int32 nnk=-1)
Definition: c4d_string.h:573
maxon::Vec3< maxon::Float64, 1 > Vector
Definition: ge_math.h:141
maxon::Int32 Int32
Definition: ge_sys_math.h:56
#define atom
Definition: graminit.h:72
#define Offd
FFD.
Definition: ge_prepass.h:1052
#define Opoint
Point - PointObject.
Definition: ge_prepass.h:1091
#define Obase
Base object - BaseObject.
Definition: ge_prepass.h:1090
@ FFDOBJECT_SIZE
Definition: offd.h:6
V off
The translation vector.
Definition: matrix.h:263
- 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.
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");
doc->InsertObject(clone,
nullptr,
nullptr);
}
#define alias(a0, a1, a2)
Definition: Python-ast.h:681
Py_ssize_t i
Definition: abstract.h:645
Definition: ge_autoptr.h:37
void SetName(const maxon::String &name, Bool setDirty=true)
Definition: c4d_baselist.h:2549
Definition: c4d_string.h:41
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)
void* handle = description->BrowseInit();
while (description->GetNext(handle, &bc, id, gid))
{
}
description->BrowseFree(handle);
Definition: c4d_basecontainer.h:48
String GetString(Int32 id, const maxon::String &preset=maxon::String()) const
Definition: c4d_basecontainer.h:432
Definition: lib_description.h:355
@ DESC_NAME
String Name for standalone use.
Definition: lib_description.h:91
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.
Bool SetParameter(const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
Bool GetParameter(const DescID &id, GeData &t_data, DESCFLAGS_GET flags) const
Bool IsInstanceOf(Int32 id) const
Definition: c4d_baselist.h:1561
const Vector & GetVector() const
Definition: c4d_gedata.h:486
Py_ssize_t size
Definition: bytesobject.h:86
#define Ocube
Cube.
Definition: ge_prepass.h:1119
@ PRIM_CUBE_LEN
Definition: ocube.h:6
- 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:
UInt32 GetDirty(DIRTYFLAGS flags) const
Definition: c4d_baselist.h:1743
static String UIntToString(UInt32 v)
Definition: c4d_string.h:513
maxon::UInt32 UInt32
Definition: ge_sys_math.h:57
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:
{
}
Definition: c4d_basematerial.h:28
@ OBJECT
Object data mask.
@ MATERIAL
Material data mask.
#define Mmaterial
Standard material.
Definition: ge_prepass.h:1008
@ MATERIAL_COLOR_COLOR
Definition: mmaterial.h:56
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)
points[
i] = points[
i] +
Vector(0, 100, 0);
Bool Message(Int32 type, void *data=nullptr)
Definition: c4d_baselist.h:1582
Vector * GetPointW()
Definition: c4d_baseobject.h:1606
#define MSG_UPDATE
Must be sent if the bounding box has to be recalculated. (Otherwise use MSG_CHANGE....
Definition: c4d_baselist.h:359
See also NodeData::Message() Manual.
Further Reading