Description Class Reference Library » 描述

#include <lib_description.h>

详细描述

The description class contains information for all description ID of an object.
For example it stores a BaseContainer for ID_BASEOBJECT_REL_POSITION that describes that this value is a Vector, has minimum and maximum values XYZ etc.
To access the actual values of these description parameters you will have to ask the object itself, for example with C4DAtom::GetParameter() .
Example to get the name of a description, for example "Landscape Object":

String GetTypeName( C4DAtom *op) { if (op) { AutoAlloc<Description> desc; if (!desc) return String (); if (!op-> GetDescription (desc, DESCFLAGS_DESC::NONE )) return String (); const BaseContainer *bc = desc-> GetParameterI ( DESCID_ROOT , nullptr ); if (bc) return bc-> GetString ( DESC_NAME ); } return String (); }

公共成员函数

Bool   LoadDescription (const BCResourceObj *bc, Bool copy)
Bool   LoadDescription ( Int32 id)
Bool   LoadDescription (const String &id)
Bool   SortGroups ()
const BCResourceObj *  GetDescription ()
const BaseContainer GetParameter (const DescID &id, BaseContainer &temp, AtomArray *ar) const
BaseContainer GetParameterI (const DescID &id, AtomArray *ar)
Bool   SetParameter (const DescID &id, const BaseContainer ¶m, const DescID &groupid)
void *  BrowseInit ()
Bool   GetNext (void *handle, const BaseContainer **bc, DescID &id, DescID &groupid)
void  BrowseFree (void *&handle)
DescEntry *  GetFirst (const AtomArray &op)
DescEntry *  GetNext (DescEntry *de)
DescEntry *  GetDown (DescEntry *de)
void  GetDescEntry (DescEntry *de, const BaseContainer **bc, DescID &descid)
SubDialog CreateDialogI ()
void  FreeDialog ( SubDialog *dlg)
Bool   CreatePopupMenu ( BaseContainer &menu)
Bool   GetPopupId ( Int32 id, const DescID &descid)
Bool   CheckDescID (const DescID &searchid, const AtomArray &ops, DescID *completeid)
Bool   GetSubDescriptionWithData (const DescID &did, const AtomArray &op, RESOURCEDATATYPEPLUGIN *resdatatypeplugin, const BaseContainer &bc, DescID *singledescid)
const DescID GetSingleDescID ()
void  SetSingleDescriptionMode (const DescID &descid)

私有成员函数

  描述 ()
  ~Description ()

Alloc/Free

static 描述 Alloc ()
static void  Free ( 描述 *&description)

构造函数 & 析构函数文档编制

◆  Description()

描述 () private

◆  ~Description()

~ 描述 () private

成员函数文档编制

◆  Alloc()

static 描述 * Alloc ( )
static

Allocates a description. Destroy the allocated description with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

返回
The allocated description, or nullptr if the allocation failed.

◆  Free()

static void Free ( 描述 *&  description )
static

Destructs descriptions allocated with Alloc() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

参数
[in,out] description The description to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆  LoadDescription() [1/3]

Bool LoadDescription ( const BCResourceObj *  bc ,
Bool   copy  
)

Loads a description from a BCResourceObj , such as the one returned from GetDescription() .

警告
Existing entries are lost.
参数
[in] bc The BCResourceObj to load the description from.
[in] copy true if the description should be copied, otherwise the objects will share the same internal data so that changes to one affects the other.
返回
true if the description was loaded, otherwise false .

◆  LoadDescription() [2/3]

Bool LoadDescription ( Int32   id )

Loads a description by ID. The ID must have been registered with RegisterDescription() .

警告
Existing entries are lost.
参数
[in] id The description ID, for example Obase .
返回
true if the description was loaded, otherwise false .

◆  LoadDescription() [3/3]

Bool LoadDescription ( const String id )

Loads a description by name. The description name must have been registered with RegisterDescription() .

警告
Existing entries are lost.
参数
[in] id The description name, for example "Obase" .
返回
true if the description was loaded, otherwise false .

◆  SortGroups()

Bool SortGroups ( )

Private .

◆  GetDescription()

const BCResourceObj* GetDescription ( )

Retrieves the internal pointer of the description.

返回
The internal description pointer.

◆  GetParameter()

const BaseContainer * GetParameter ( const DescID id ,
BaseContainer temp ,
AtomArray ar  
) const

Retrieves the information container for a description parameter.

参数
[in] id The description ID.
[out] temp When the parameter is of a dynamic type that does not already exist as predefined container, i.e. not returnable as pointer, the result is the address of temp ,其中 temp allows to store the data.
In this case nullptr is returned.
[out] ar Most of the time this can be just AtomArray() . However dynamic descriptions (like sub-descriptions of a gradient or dynamic XPresso node) need an array of elements the parameter is assigned to.
返回
The information container, or nullptr if temp was used. The description owns the pointed container.

◆  GetParameterI()

BaseContainer * GetParameterI ( const DescID id ,
AtomArray ar  
)

Retrieves a pointer to the information container for a description parameter.

参数
[in] id The description ID.
[out] ar Most of the time this can be just AtomArray() . However dynamic descriptions (like sub-descriptions of a gradient or dynamic XPresso node) need an array of elements the parameter is assigned to.
返回
The information container. The description owns the pointed container.

◆  SetParameter()

Bool SetParameter ( const DescID id ,
const BaseContainer param ,
const DescID groupid  
)

Inserts a description parameter into the collection.

参数
[in] id The description ID.
[in] param The settings for the new parameter.
[in] groupid The ID of the parameter's group, or DESCID_ROOT .
返回
true if the parameter was inserted, otherwise false .

◆  BrowseInit()

void* BrowseInit ( )

Starts browsing the parameters linearly.

警告
After browsing is done done BrowseFree() must be called.
返回
The browse handle.

◆  GetNext() [1/2]

Bool GetNext ( void *  handle ,
const BaseContainer **  bc ,
DescID id ,
DescID groupid  
)

Retrieves the next parameter in a browse sequence initialized with BrowseInit() .

参数
[in] handle The browse handle returned by BrowseInit() .
[out] bc Assigned the settings for the retrieved parameter. The caller owns the pointed base container.
[out] id Assigned the ID of the retrieved parameter.
[out] groupid Assigned the group ID of the retrieved parameter.
返回
true if a new parameter was retrieved, otherwise the sequence is finished.

◆  BrowseFree()

void BrowseFree ( void *&  handle )

Frees browse handles from BrowseInit() .

参数
[in,out] handle The handle to free. Assigned nullptr .

◆  GetFirst()

DescEntry* GetFirst ( const AtomArray op )

Gets a handle to the first description entry. Use GetDescEntry() to access the information and GetNext() or GetDown() to browse the hierarchy.

参数
[in] op Most of the time this can be just AtomArray() . However dynamic descriptions (like sub-descriptions of a gradient or dynamic XPresso node) need an array of elements the parameter is assigned to.
返回
The description entry handle.

◆  GetNext() [2/2]

DescEntry* GetNext ( DescEntry *  de )

Gets the next description entry handle.

参数
[in] de The current description entry handle.
返回
The next description entry handle.

◆  GetDown()

DescEntry* GetDown ( DescEntry *  de )

Gets the child description entry handle.

参数
[in] de The current description entry handle.
返回
The child description entry handle.

◆  GetDescEntry()

void GetDescEntry ( DescEntry *  de ,
const BaseContainer **  bc ,
DescID descid  
)

Retrieves the data for a description entry handle.

参数
[in] de The current description entry handle.
[out] bc Assigned the settings for the retrieved parameter. The caller owns the pointed base container.
[out] descid Assigned the ID of the retrieved parameter.

◆  CreateDialogI()

SubDialog * CreateDialogI ( )

Private .

◆  FreeDialog()

void FreeDialog ( SubDialog dlg )

Private .

◆  CreatePopupMenu()

Bool CreatePopupMenu ( BaseContainer menu )

Builds a popup menu for choosing a parameter in the description.

参数
[out] menu Assigned the menu container.
返回
true if the menu was built, otherwise false .

◆  GetPopupId()

Bool GetPopupId ( Int32   id ,
const DescID descid  
)

Private .

◆  CheckDescID()

Bool CheckDescID ( const DescID searchid ,
const AtomArray ops ,
DescID completeid  
)

Checks if a description ID searchid exists for the given objects ops (usually only one single object is passed as otherwise the smallest common nominator is returned).
completeid != nullptr and the return value is true the complete ID will be assigned to completeid .

注意
Complete ID means that all parts of the DescLevel are filled with appropriate data.
For example if the DescID passed is: DescID ( DescLevel (ID_BASEOBJECT_POSITION, 0, 0), DescLevel ( VECTOR_X , 0, 0)) CheckDescID() will return: DescID ( DescLevel (ID_BASEOBJECT_POSITION, DTYPE_VECTOR , ID_BASEOBJECT_GROUP1 ), DescLevel ( VECTOR_X , DTYPE_REAL , ...))
参数
[in] searchid The partial ID.
[in] ops Most of the time this can be just AtomArray() . However dynamic descriptions (like sub-descriptions of a gradient or dynamic XPresso node) need an array of elements the parameter is assigned to.
[out] completeid Assigned the complete ID.
返回
true if a description ID searchid exists, otherwise false .

◆  GetSubDescriptionWithData()

Bool GetSubDescriptionWithData ( const DescID did ,
const AtomArray op ,
RESOURCEDATATYPEPLUGIN *  resdatatypeplugin ,
const BaseContainer bc ,
DescID singledescid  
)

Retrieves dynamic sub-description data (e.g. the gradient data type).

参数
[in] did The description ID.
[in] op The current objects.
[in] resdatatypeplugin The resource data type plug, retrieved with FindResourceDataTypePlugin() .
[out] bc The existing container for the data type.
[in] singledescid Should be nullptr .
返回
true if successful, otherwise false .

◆  GetSingleDescID()

const DescID * GetSingleDescID ( )

Private .

◆  SetSingleDescriptionMode()

void SetSingleDescriptionMode ( const DescID descid )

Private .

DescID
定义: lib_description.h:327
C4DAtom::GetDescription
Bool GetDescription(Description *description, DESCFLAGS_DESC flags)
VECTOR_X
@ VECTOR_X
X component.
定义: lib_description.h:267
DESCID_ROOT
#define DESCID_ROOT
Root description ID.
定义: lib_description.h:22
DESCFLAGS_DESC::NONE
@ NONE
None.
String
定义: c4d_string.h:38
DTYPE_VECTOR
@ DTYPE_VECTOR
向量
定义: lib_description.h:70
ID_BASEOBJECT_GROUP1
@ ID_BASEOBJECT_GROUP1
定义: obase.h:51
DescLevel
Represents a level within a DescID.
定义: lib_description.h:286
C4DAtom
定义: c4d_baselist.h:1331
Description::GetParameterI
BaseContainer * GetParameterI(const DescID &id, AtomArray *ar)
AutoAlloc
定义: ge_autoptr.h:36
BaseContainer::GetString
String GetString(Int32 id, const maxon::String &preset=maxon::String()) const
定义: c4d_basecontainer.h:387
DESC_NAME
@ DESC_NAME
String Name for standalone use.
定义: lib_description.h:91
DTYPE_REAL
@ DTYPE_REAL
Float
定义: lib_description.h:68
BaseContainer
定义: c4d_basecontainer.h:46