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.
BaseObject*
const object =
doc->GetActiveObject();
if (object == nullptr)
AutoAlloc<AtomArray> materials;
if (materials == nullptr)
doc->GetActiveMaterials(materials);
for (
Int32 i = 0;
i < materials->GetCount(); ++
i)
{
C4DAtom*
const mat = materials->GetIndex(
i);
BaseMaterial* const material = static_cast<BaseMaterial*>(mat);
const String materialName = material->GetName();
BaseTake* const take = takeData->AddTake(materialName, nullptr, nullptr);
if (take == nullptr)
BaseOverrideGroup* const group = take->AddOverrideGroup();
if (group == nullptr)
group->AddToGroup(takeData, object);
BaseTag*
const tag = group->AddTag(takeData,
Ttexture, material);
if (tag == nullptr)
}
Py_ssize_t i
Definition: abstract.h:645
NONE
Definition: asset_browser.h:1
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
#define Ttexture
Texture - TextureTag.
Definition: ge_prepass.h:1420
#define ConstDescID(...)
Definition: lib_description.h:592
maxon::Int32 Int32
Definition: ge_sys_math.h:51
const char * doc
Definition: pyerrors.h:226
@ TEXTURETAG_PROJECTION
Definition: ttexture.h:10
@ TEXTURETAG_PROJECTION_UVW
Definition: ttexture.h:17
Access
Existing override groups are accessed from the host BaseTake:
- BaseTake::GetFirstOverrideGroup(): Returns the first override group of the take.
- BaseTake::GetOverrideGroups(): Returns an array with all override groups of the take.
AutoAlloc<AtomArray> overrideGroups;
if (overrideGroups == nullptr)
take->GetOverrideGroups(overrideGroups);
for (
Int32 i = 0;
i < overrideGroups->GetCount(); ++
i)
{
BaseOverrideGroup*
const group =
static_cast<BaseOverrideGroup*
>(overrideGroups->GetIndex(
i));
if (group == nullptr)
if (group->Find(takeData, activeObject))
ApplicationOutput(
"Override Group " + group->GetName() +
" contains the active object!");
}
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
Allocation/Deallocation
A BaseOverrideGroup is created using the host BaseTake.
- BaseTake::AddOverrideGroup(): Adds a new override group.
- BaseTake::DeleteOverrideGroup(): Deletes a given override group.
BaseOverrideGroup* const group = take->AddOverrideGroup();
if (group == nullptr)
group->SetName("New Override Group"_s);
Navigation
BaseOverrideGroup instances are organized in a simple BaseList2D list.
- BaseOverrideGroup::GetNext(): Returns the next override group in the list or
nullptr
.
- BaseOverrideGroup::GetPred(): Returns the previous override group in the list or
nullptr
.
BaseOverrideGroup* overrideGroup = take->GetFirstOverrideGroup();
while (overrideGroup != nullptr)
{
overrideGroup = overrideGroup->GetNext();
}
#define BIT_ACTIVE
Active.
Definition: ge_prepass.h:888
Read
- BaseOverrideGroup::GetTake(): Returns the host BaseTake.
Override Group
Objects
A BaseOverrideGroup acts like a null object. Different scene objects can be added to this group.
- BaseOverrideGroup::AddToGroup(): Adds the given object to the group.
- BaseOverrideGroup::GetObjectsInGroup(): Returns the objects of the group.
- BaseOverrideGroup::RemoveFromGroup(): Removes the given object from the group.
- BaseOverrideGroup::Find(): Checks if the given object is part of the group.
AutoAlloc<AtomArray> objects;
if (objects == nullptr)
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.
- BaseOverrideGroup::AddTag(): Adds the tag of the given type to the group. If the tag is a texture tag, the given material is used.
- BaseOverrideGroup::GetTag(): Returns the tag of the given type or
nullptr
.
- BaseOverrideGroup::RemoveTag(): Removes the tag of the given type.
BaseTag*
const compositingTag = group->AddTag(takeData,
Tcompositing,
nullptr);
if (compositingTag == nullptr)
#define Tcompositing
Compositing/render.
Definition: ge_prepass.h:1425
@ 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.
- BaseOverrideGroup::SetEditorMode(): Sets the editor mode.
- BaseOverrideGroup::GetEditorMode(): Gets the editor mode.
- BaseOverrideGroup::SetRenderMode(): Sets the render mode.
- BaseOverrideGroup::GetRenderMode(): Gets the render mode.
The modes are:
- MODE_OFF : off; elements are not visible.
- MODE_ON : on; elements are always visible.
- MODE_UNDEF : undefined; the parent mode applies.
BaseTake* const take = takeData->GetCurrentTake();
if (take == nullptr)
AutoAlloc<AtomArray> objects;
if (objects == nullptr)
BaseOverrideGroup* const group = take->AddOverrideGroup();
if (group == nullptr)
group->SetName("Render Objects"_s);
for (
Int32 i = 0;
i < objects->GetCount(); ++
i)
{
BaseObject*
const object =
static_cast<BaseObject*
>(objects->GetIndex(
i));
group->AddToGroup(takeData, object);
}
#define MODE_ON
The object is enabled regardless of the state of any parent object.
Definition: c4d_baseobject.h:36
#define MODE_OFF
The object is disabled regardless of the state of any parent object.
Definition: c4d_baseobject.h:37
Further Reading