BaseOverrideGroup Manual

内容表

关于

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.

警告
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 AutoAlloc<AtomArray> 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 tag-> SetParameter ( DescID ( TEXTURETAG_PROJECTION ), TEXTURETAG_PROJECTION_UVW , DESCFLAGS_SET::NONE ); }

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);

导航

BaseOverrideGroup instances are organized in a simple BaseList2D 列表。

// 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 (); }

读取

Override Group

对象

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". AutoAlloc<AtomArray> objects; 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 ); compositingTag-> SetParameter ( DescID ( COMPOSITINGTAG_ENABLECHN0 ), true , DESCFLAGS_SET::NONE );

Modes

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

The modes are:

// 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 AutoAlloc<AtomArray> 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 ); }

延伸阅读

BaseTake::AddOverrideGroup
BaseOverrideGroup * AddOverrideGroup()
BaseList2D::GetBit
Bool GetBit(Int32 mask) const
定义: c4d_baselist.h:2207
BaseOverrideGroup
定义: lib_takesystem.h:180
MODE_ON
#define MODE_ON
The object is enabled regardless of the state of any parent object.
定义: c4d_baseobject.h:35
BaseObject
定义: c4d_baseobject.h:224
DescID
定义: lib_description.h:327
BaseTake
定义: lib_takesystem.h:319
BaseOverrideGroup::AddToGroup
void AddToGroup(TakeData *takeData, BaseList2D *node)
COMPOSITINGTAG_ENABLECHN0
@ COMPOSITINGTAG_ENABLECHN0
定义: tcompositing.h:19
BaseTag
定义: 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
定义: c4d_baselist.h:1619
MAXON_SOURCE_LOCATION
#define MAXON_SOURCE_LOCATION
定义: memoryallocationbase.h:66
BaseOverrideGroup::SetRenderMode
void SetRenderMode(Int32 mode)
DESCFLAGS_SET::NONE
@ NONE
None.
BIT_ACTIVE
#define BIT_ACTIVE
Active.
定义: ge_prepass.h:837
String
定义: 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)
TEXTURETAG_PROJECTION
@ TEXTURETAG_PROJECTION
定义: ttexture.h:10
BaseDocument::GetActiveObjects
void GetActiveObjects(AtomArray &selection, GETACTIVEOBJECTFLAGS flags) const
BaseOverrideGroup::SetEditorMode
void SetEditorMode(Int32 mode)
C4DAtom
定义: c4d_baselist.h:1331
BaseList2D::SetName
void SetName(const maxon::String &name)
定义: c4d_baselist.h:2324
Int32
maxon::Int32 Int32
定义: ge_sys_math.h:58
ApplicationOutput
#define ApplicationOutput(formatString,...)
定义: debugdiagnostics.h:207
Ttexture
#define Ttexture
Texture - TextureTag.
定义: ge_prepass.h:1236
AutoAlloc
定义: ge_autoptr.h:36
BaseOverrideGroup::GetNext
BaseOverrideGroup * GetNext() const
定义: lib_takesystem.h:199
MODE_OFF
#define MODE_OFF
The object is disabled regardless of the state of any parent object.
定义: c4d_baseobject.h:36
BaseDocument::GetActiveObject
BaseObject * GetActiveObject(void)
BaseList2D::GetName
String GetName() const
定义: c4d_baselist.h:2318
TEXTURETAG_PROJECTION_UVW
@ TEXTURETAG_PROJECTION_UVW
定义: ttexture.h:17
BaseOverrideGroup::Find
Bool Find(TakeData *takeData, BaseObject *op)
Tcompositing
#define Tcompositing
Compositing/render.
定义: ge_prepass.h:1241
BaseMaterial
定义: c4d_basematerial.h:27
AtomArray::GetIndex
C4DAtom * GetIndex(Int32 idx) const
定义: c4d_baselist.h:1634

Copyright  © 2014-2025 乐数软件    

工业和信息化部: 粤ICP备14079481号-1