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
}
Py_ssize_t i
Definition: abstract.h:645
Definition: ge_autoptr.h:37
String GetName() const
Definition: c4d_baselist.h:2544
Definition: c4d_basematerial.h:28
Definition: c4d_baseobject.h:248
Definition: lib_takesystem.h:196
BaseTag * AddTag(TakeData *takeData, Int32 type, BaseMaterial *mat)
void AddToGroup(TakeData *takeData, BaseList2D *node)
Definition: c4d_basetag.h:52
Definition: lib_takesystem.h:335
BaseOverrideGroup * AddOverrideGroup()
Definition: c4d_baselist.h:1521
Bool SetParameter(const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
Definition: c4d_string.h:41
maxon::Int32 Int32
Definition: ge_sys_math.h:56
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
#define Ttexture
Texture - TextureTag.
Definition: ge_prepass.h:1412
#define ConstDescID(...)
Definition: lib_description.h:594
const char * doc
Definition: pyerrors.h:226
Represents a level within a DescID.
Definition: lib_description.h:298
@ TEXTURETAG_PROJECTION
Definition: ttexture.h:10
@ TEXTURETAG_PROJECTION_UVW
Definition: ttexture.h:17

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!");
}
Bool Find(TakeData *takeData, BaseObject *op)
Bool GetOverrideGroups(AtomArray &selection)
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204

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);
void SetName(const maxon::String &name, Bool setDirty=true)
Definition: c4d_baselist.h:2550

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();
}
Bool GetBit(Int32 mask) const
Definition: c4d_baselist.h:2441
BaseOverrideGroup * GetNext() const
Definition: lib_takesystem.h:214
BaseOverrideGroup * GetFirstOverrideGroup()
#define BIT_ACTIVE
Active.
Definition: ge_prepass.h:889

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);
doc->GetActiveObjects(objects, GETACTIVEOBJECTFLAGS::NONE);
// 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);
#define Tcompositing
Compositing/render.
Definition: ge_prepass.h:1417
@ COMPOSITINGTAG_ENABLECHN0
Definition: tcompositing.h:19

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);
doc->GetActiveObjects(objects, GETACTIVEOBJECTFLAGS::NONE);
// 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);
}
void SetEditorMode(Int32 mode)
void SetRenderMode(Int32 mode)
#define MODE_ON
The object is enabled regardless of the state of any parent object.
Definition: c4d_baseobject.h:35
#define MODE_OFF
The object is disabled regardless of the state of any parent object.
Definition: c4d_baseobject.h:36

Further Reading