GeMarker Manual

About

A GeMarker object contains an unique ID. It is used to identify BaseList2D based objects.

Warning
These markers change when the source object is copied or when the document is re-loaded.

Access

// This example gets the name and the marker of the given BaseObject.
// The name is used to search for an object with the same name in the document.
// The marker is used to check if the found object is also the original object.
const String objectName = object->GetName();
const GeMarker& marker = object->GetMarker();
// search object with the same name
const BaseObject* const foundObject = doc->SearchObject(objectName);
if (foundObject != nullptr)
{
// check if it is the same object
const GeMarker& foundObjectMarker = foundObject->GetMarker();
// compare if the markers are equal
if (foundObjectMarker.Compare(marker) == 0)
ApplicationOutput("The found object is the original object"_s);
else
ApplicationOutput("The found object is not the original object"_s);
}
const GeMarker & GetMarker() const
Definition: c4d_baselist.h:2591
Definition: c4d_baseobject.h:248
A unique marker that identifies an object.
Definition: c4d_baselist.h:1446
Int32 Compare(const GeMarker &m) const
Definition: c4d_baselist.h:1483
Definition: c4d_string.h:41
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
const char * doc
Definition: pyerrors.h:226

The marker of a copy is different than the marker of the original object:

// This example copies an object.
// The copy has a different marker than the original.
const GeMarker& originalMarker = object->GetMarker();
C4DAtom* const atomClone = object->GetClone(COPYFLAGS::NONE, nullptr);
BaseObject* const clone = static_cast<BaseObject*>(atomClone);
if (clone == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
doc->InsertObject(clone, nullptr, nullptr);
const GeMarker& cloneMarker = clone->GetMarker();
// check if the markers are not equal
if (cloneMarker.IsEqual(originalMarker) == false)
ApplicationOutput("The markers are not equal"_s);
Definition: c4d_baselist.h:1521
C4DAtom * GetClone(COPYFLAGS flags, AliasTrans *trn) const
Definition: c4d_baselist.h:1606
Bool IsEqual(const GeMarker &m) const
Definition: c4d_baselist.h:1476
@ NONE
None.
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67

See also BaseList2D Marker.

Allocation/Deallocation

GeMarker objects can be created with the usual tools:

// This example creates two markers and checks if they are not equal.
const Bool invalidMarkerA = markerA == nullptr;
const Bool invalidMarkerB = markerB == nullptr;
if (invalidMarkerA || invalidMarkerB)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
// compare
if (markerA->IsEqual(*markerB) == false)
ApplicationOutput("Markers not identical"_s);
Definition: ge_autoptr.h:37
maxon::Bool Bool
Definition: ge_sys_math.h:51

Functionality

GeMarker objects can be handled with:

// This example iterates through all BaseDocuments in the document list.
// The active BaseDocument is marked with a star.
const BaseDocument* const activeDocument = GetActiveDocument();
if (activeDocument == nullptr)
return maxon::UnexpectedError(MAXON_SOURCE_LOCATION);
while (document != nullptr)
{
const GeMarker& docMarker = document->GetMarker();
const GeMarker& activeDocMarker = activeDocument->GetMarker();
// use GeMarker to compare identity of the BaseDocuments
if (docMarker.IsEqual(activeDocMarker))
{
ApplicationOutput("Document: " + document->GetDocumentName().GetString() + " *");
}
else
{
ApplicationOutput("Document: " + document->GetDocumentName().GetString());
}
document = document->GetNext();
}
BaseDocument * GetActiveDocument()
BaseDocument * GetFirstDocument()
Definition: c4d_basedocument.h:497
const BaseDocument * GetNext() const
Definition: c4d_basedocument.h:533
Filename GetDocumentName() const
String GetString() const

Read and Write

GeMarker objects can be stored in a HyperFile.

Further Reading