About
A BaseLink handles a reference to a C4DAtom (C4DAtomGoal) element. This class should always be used instead of storing a pointer to the element itself. A link is typically resolved by providing the BaseDocument that hosts the linked entity.
- Note
- When one copies entities an AliasTrans object can be used to determine how the links of these entities are handled.
-
To change all BaseLink objects pointing to an entity BaseList2D::TransferGoal() can be used.
Access
A BaseLink is typically stored in a BaseContainer or GeData container. Several functions are available to access either the BaseLink object itself or the linked entity.
To retrieve BaseLink objects stored in a BaseContainer use:
To modify BaseLink objects stored in a BaseContainer use:
See also BaseContainer Manual.
To retrieve BaseLink objects stored in a GeData object (GeData type is DA_ALIASLINK) use:
To modify BaseLink objects stored in a GeData object (GeData type is DA_ALIASLINK) use:
See also GeData Manual.
{
}
Definition: c4d_baselist.h:2245
String GetName() const
Definition: c4d_baselist.h:2412
Definition: c4d_baseobject.h:248
Bool IsInstanceOf(Int32 id) const
Definition: c4d_baselist.h:1437
Definition: c4d_gedata.h:83
const BaseList2D * GetLink(const BaseDocument *doc, Int32 instanceof=0) const
#define Obase
Base object - BaseObject.
Definition: ge_prepass.h:1086
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:210
#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
Allocation/Deallocation
BaseLink objects can be created with the usual functions:
if (link == nullptr)
link->SetLink(someOtherObject);
Definition: ge_autoptr.h:37
void SetBaseLink(const BaseLink &v)
Definition: c4d_gedata.h:724
Copy
BaseLink objects can be cloned or copied:
Properties
A BaseLink object stores a reference to an entity. This reference can be handled with these function:
if (link == nullptr)
if (shader == nullptr)
link->SetLink(shader);
mat->InsertShader(shader);
Definition: c4d_basechannel.h:36
static BaseShader * Alloc(Int32 type)
#define Xbrick
Brick.
Definition: ge_prepass.h:1314
@ MATERIAL_COLOR_SHADER
Definition: mmaterial.h:294
The stored reference is typically resolved using the BaseDocument that contains the referenced entity. If the linked entity is not part of a BaseDocument the BaseLink can be forced to be resolved:
tempDoc->InsertObject(cube, nullptr, nullptr);
if (link == nullptr)
link->SetLink(cube);
if (resultA != nullptr)
cube->Remove();
if (resultB == nullptr)
if (resultC != nullptr)
Disc I/O
BaseLink objects can be stored in a HyperFile using:
- Note
- This is typically used in NodeData::Read() and NodeData::Write().
BaseLinkArray
A BaseLinkArray can be used to handle multiple BaseLink objects.
Add And Remove
References to entities can easily be added to and removed from the array using:
while (material != nullptr)
{
}
A helper class to handle BaseLink instances.
Definition: c4d_baselinkarray.h:28
Bool Append(const C4DAtomGoal *bl)
Definition: c4d_baselinkarray.h:172
Definition: c4d_basematerial.h:28
BaseMaterial * GetNext()
Definition: c4d_basematerial.h:60
#define Mmaterial
Standard material.
Definition: ge_prepass.h:1004
Access
References to entities and other relevant data can easily be retrieved from the array using:
{
if (goal == nullptr)
{
}
}
Py_ssize_t i
Definition: abstract.h:645
Py_ssize_t count
Definition: abstract.h:640
Dummy class for C4DAtom objects that can be pointed to by BaseLink objects.
Definition: c4d_baselist.h:1652
PyObject * obj
Definition: complexobject.h:60
maxon::Int32 Int32
Definition: ge_sys_math.h:60
maxon::Int Int
Definition: ge_sys_math.h:64
Convert
The BaseLinkArray can be converted into and built from an AtomArray.
if (objects == nullptr)
void FromAtomArray(const AtomArray &ar)
Definition: c4d_baselinkarray.h:228
Further Reading