Unique IDs for External Applications

Each external application can have a unique ID to identify it in Cineware. GetWriterInfo() must be overridden on the external side.

The unique application ID has to be a registered plugin ID (can be obtained by contacting MAXON or through Plugin Cafe). Every application should register one ID once and use it a lifetime.

The application ID and the name are assigned in GetWriterInfo(). Once this is done the ID can be used to add and retrieve unique IDs with BaseList2D::AddUniqueID() and BaseList2D::FindUniqueID() for every object. These methods can also retrieve Cinema 4D's unique object IDs.

Example:

Register the unique application ID:

const Int32 appid = ...; // A unique plugin ID
void GetWriterInfo(Int32 &id, String &appname )
{
id = appid;
appname = "Commandline Example";
}

Add unique ID and marker to an object:

op->AddUniqueID(appid, (const Char*)&stamp, sizeof(stamp)));

Loop through all unique IDs:

Int32 idCount = op->GetUniqueIDCount();
for (Int32 idIndex=0; idIndex<idCount; idIndex++)
{
Int32 appid, bytes;
const Char* mem;
if (op->GetUniqueIDIndex(idIndex, appid, mem, bytes))
{
if (!op->FindUniqueID(appid, mem, bytes))
{
GeBoom();
continue;
}
printf(" - UniqueID (%d Byte): ", bytes);
for (Int32 index=0;index<bytes;index++)
{
printf("%2.2x", (UChar)mem[index]);
}
printf(" - AppID: %d", appid);
printf("\n");
}
}
cineware::UChar
unsigned char UChar
Unsigned 8 bit character.
Definition: c4d_system.h:196
cineware::Char
char Char
Signed 8 bit character.
Definition: c4d_system.h:195
cineware::Int32
int32_t Int32
32 bit signed integer datatype.
Definition: c4d_system.h:186
GetWriterInfo
void GetWriterInfo(cineware::Int32 &id, cineware::String &appname)