AliasTrans Class Reference

#include <c4d_baselist.h>

Detailed Description

An alias translator class.

Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

The alias translator takes care about reconnecting BaseLink links when cloning, copying, reading or writing objects.
Normally Cinema 4D will provide an alias translator when needed, for example in NodeData::CopyTo(). However, to copy objects manually use:

if (!aliastrans || !aliastrans->Init(document))
return false;
dup = op->GetClone(COPYFLAGS::NONE, aliastrans);
if (!dup)
return false;
aliastrans->Translate(true);
Definition: ge_autoptr.h:37
@ NONE
None.
PyObject * op
Definition: object.h:520

Private Member Functions

 AliasTrans ()
 
 ~AliasTrans ()
 

Alloc/Free

static AliasTransAlloc ()
 
static void Free (AliasTrans *&link)
 

Init and Translate

Bool Init (BaseDocument *doc)
 
void Translate (Bool connect_oldgoals)
 

Constructor & Destructor Documentation

◆ AliasTrans()

AliasTrans ( )
private

◆ ~AliasTrans()

~AliasTrans ( )
private

Member Function Documentation

◆ Alloc()

static AliasTrans* Alloc ( )
static

Allocates an alias translator. Destroy the allocated alias translator with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated alias translator, or nullptr if the allocation failed.

◆ Free()

static void Free ( AliasTrans *&  link)
static

Destructs alias translators allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in,out]linkThe alias translator to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ Init()

Bool Init ( BaseDocument doc)

Initializes the alias translator in the specified document doc.

Parameters
[in]docThe document. The caller owns the pointed object.
Returns
true if the alias translator was initialized, otherwise false.

◆ Translate()

void Translate ( Bool  connect_oldgoals)

Translates the links in all objects that the translator has come across.

Parameters
[in]connect_oldgoalsConnect old goals.
For example: Take a cube with an instance linked to this cube, select both and duplicate them in one action.
The new cube is linked to the new instance if connect_oldgoals is true. If it is false the new instance is linked to the old cube.