About

A BaseOverrideGroup acts like a virtual null object. It can have multiple child objects. Tags applied to the group are applied to the child objects.

Warning
Override groups add tags to the scene and own these tags. It is not possible to delete these tags. NBIT::TAKE_LOCK can be used to check if a tag is owned by a BaseOverrideGroup.
// This code creates a take with an override group for each selected material
// and adds the object "object" to the newly created group.
// get the active object
BaseObject* const object = doc->GetActiveObject();
if (object == nullptr)
return maxon::IllegalArgumentError(MAXON_SOURCE_LOCATION);
// get all active materials
if (materials == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
doc->GetActiveMaterials(materials);
// loop through all active materials
for (Int32 i = 0; i < materials->GetCount(); ++i)
{
C4DAtom* const mat = materials->GetIndex(i);
BaseMaterial* const material = static_cast<BaseMaterial*>(mat);
// create a new take
const String materialName = material->GetName();
BaseTake* const take = takeData->AddTake(materialName, nullptr, nullptr);
if (take == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
// create an override group
BaseOverrideGroup* const group = take->AddOverrideGroup();
if (group == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
// add the object to the group
group->AddToGroup(takeData, object);
// create a texture tag referencing this material
BaseTag* const tag = group->AddTag(takeData, Ttexture, material);
if (tag == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
// set projection to UVW
}

Access

Existing override groups are accessed from the host BaseTake:

// This example checks all override groups if they contain the object "activeObject".
AutoAlloc<AtomArray> overrideGroups;
if (overrideGroups == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
take->GetOverrideGroups(overrideGroups);
// loop through all BaseOverrideGroups
for (Int32 i = 0; i < overrideGroups->GetCount(); ++i)
{
BaseOverrideGroup* const group = static_cast<BaseOverrideGroup*>(overrideGroups->GetIndex(i));
if (group == nullptr)
return maxon::UnexpectedError(MAXON_SOURCE_LOCATION);
// check if the override group contains the given object
if (group->Find(takeData, activeObject))
ApplicationOutput("Override Group " + group->GetName() + " contains the active object!");
}

Allocation/Deallocation

A BaseOverrideGroup is created using the host BaseTake.

// This example accesss the BaseOverrideGroup from the
// given take and set the group name.
BaseOverrideGroup* const group = take->AddOverrideGroup();
if (group == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
group->SetName("New Override Group"_s);

Navigation

BaseOverrideGroup instances are organized in a simple BaseList2D list.

// This example loops through all override groups and checks which groups are currently selected
BaseOverrideGroup* overrideGroup = take->GetFirstOverrideGroup();
while (overrideGroup != nullptr)
{
ApplicationOutput("OverrideGroup: " + overrideGroup->GetName());
// check if override group is selected
if (overrideGroup->GetBit(BIT_ACTIVE))
ApplicationOutput("This is an active group.");
overrideGroup = overrideGroup->GetNext();
}

Read

Override Group

Objects

A BaseOverrideGroup acts like a null object. Different scene objects can be added to this group.

// This example adds the currently selected objects to the BaseOverrideGroup "group".
if (objects == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
// loop through all active objects
for (Int32 i = 0; i < objects->GetCount(); ++i)
{
BaseObject* const object = static_cast<BaseObject*>(objects->GetIndex(i));
group->AddToGroup(takeData, object);
}

Tags

Override groups act as virtual null objects that can host different tags. If a take is applied, this tag is added to the objects in question.

// This example simply adds and configures the compositing tag.
BaseTag* const compositingTag = group->AddTag(takeData, Tcompositing, nullptr);
if (compositingTag == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);

Modes

With these modes it is possible to control the visibility of the assigned objects when rendering and in the viewport.

The modes are:

  • MODE_OFF : off; elements are not visible.
  • MODE_ON : on; elements are always visible.
  • MODE_UNDEF : undefined; the parent mode applies.
// This code adds the currently selected objects to a new group in the current take.
// The objects of this group will only be visible in the renderer but not in the editor.
BaseTake* const take = takeData->GetCurrentTake();
if (take == nullptr)
return maxon::UnexpectedError(MAXON_SOURCE_LOCATION);
// get all active objects
if (objects == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
// create an override group
BaseOverrideGroup* const group = take->AddOverrideGroup();
if (group == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
group->SetName("Render Objects"_s);
group->SetEditorMode(MODE_OFF); // invisible in editor
group->SetRenderMode(MODE_ON); // visible in renderer
// loop through all active objects
for (Int32 i = 0; i < objects->GetCount(); ++i)
{
// add object to group
BaseObject* const object = static_cast<BaseObject*>(objects->GetIndex(i));
group->AddToGroup(takeData, object);
}

Further Reading

BaseTake::AddOverrideGroup
BaseOverrideGroup * AddOverrideGroup()
BaseList2D::GetBit
Bool GetBit(Int32 mask) const
Definition: c4d_baselist.h:2237
TEXTURETAG_PROJECTION_UVW
@ TEXTURETAG_PROJECTION_UVW
Definition: ttexture.h:17
BaseOverrideGroup
Definition: lib_takesystem.h:180
MODE_ON
#define MODE_ON
The object is enabled regardless of the state of any parent object.
Definition: c4d_baseobject.h:35
BaseObject
Definition: c4d_baseobject.h:224
DescID
Definition: lib_description.h:328
BaseTake
Definition: lib_takesystem.h:319
BaseOverrideGroup::AddToGroup
void AddToGroup(TakeData *takeData, BaseList2D *node)
COMPOSITINGTAG_ENABLECHN0
@ COMPOSITINGTAG_ENABLECHN0
Definition: tcompositing.h:19
BaseTag
Definition: c4d_basetag.h:46
TakeData::AddTake
BaseTake * AddTake(const String &name, BaseTake *parent, BaseTake *cloneFrom)
GETACTIVEOBJECTFLAGS::NONE
@ NONE
None.
BaseTake::GetFirstOverrideGroup
BaseOverrideGroup * GetFirstOverrideGroup()
BaseDocument::GetActiveMaterials
void GetActiveMaterials(AtomArray &selection) const
BaseOverrideGroup::AddTag
BaseTag * AddTag(TakeData *takeData, Int32 type, BaseMaterial *mat)
AtomArray::GetCount
Int32 GetCount() const
Definition: c4d_baselist.h:1649
MAXON_SOURCE_LOCATION
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
BaseOverrideGroup::SetRenderMode
void SetRenderMode(Int32 mode)
DESCFLAGS_SET::NONE
@ NONE
None.
TEXTURETAG_PROJECTION
@ TEXTURETAG_PROJECTION
Definition: ttexture.h:10
BIT_ACTIVE
#define BIT_ACTIVE
Active.
Definition: ge_prepass.h:865
String
Definition: c4d_string.h:38
C4DAtom::SetParameter
Bool SetParameter(const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
TakeData::GetCurrentTake
BaseTake * GetCurrentTake()
BaseTake::GetOverrideGroups
Bool GetOverrideGroups(AtomArray &selection)
BaseDocument::GetActiveObjects
void GetActiveObjects(AtomArray &selection, GETACTIVEOBJECTFLAGS flags) const
BaseOverrideGroup::SetEditorMode
void SetEditorMode(Int32 mode)
C4DAtom
Definition: c4d_baselist.h:1361
BaseList2D::SetName
void SetName(const maxon::String &name)
Definition: c4d_baselist.h:2354
Int32
maxon::Int32 Int32
Definition: ge_sys_math.h:60
ApplicationOutput
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:210
Ttexture
#define Ttexture
Texture - TextureTag.
Definition: ge_prepass.h:1270
AutoAlloc
Definition: ge_autoptr.h:36
BaseOverrideGroup::GetNext
BaseOverrideGroup * GetNext() const
Definition: lib_takesystem.h:199
MODE_OFF
#define MODE_OFF
The object is disabled regardless of the state of any parent object.
Definition: c4d_baseobject.h:36
BaseDocument::GetActiveObject
BaseObject * GetActiveObject(void)
BaseList2D::GetName
String GetName() const
Definition: c4d_baselist.h:2348
BaseOverrideGroup::Find
Bool Find(TakeData *takeData, BaseObject *op)
Tcompositing
#define Tcompositing
Compositing/render.
Definition: ge_prepass.h:1275
BaseMaterial
Definition: c4d_basematerial.h:27
AtomArray::GetIndex
C4DAtom * GetIndex(Int32 idx) const
Definition: c4d_baselist.h:1664