-
首页
-
C4D R23.110 C++ SDK
BaseContainer Class Reference
#include <c4d_basecontainer.h>
详细描述
A container is a collection of individual values. Each value has its own ID and type. Container can also carry any number of child containers.
90%
of
Cinema 4D
's internal values are stored in containers and all messages are working with container, so this class is an essential part of the SDK.
Containers can store any
GeData
type, including custom data types. Use
GetCustomDataType()
to access these values in a safe manner.
It is recommended to use the available containers to store your own values as well. That way they will be automatically saved.
However, to store values in the top level of for example an object container, use a sub-container with a unique id from
http://www.plugincafe.com
. Inside this sub-container use whatever ids.
-
警告
-
Keep in mind that there is no guarantee for a value to be in the container. Use default values whenever possible when accessing container's ID data.
Use the typed access methods (for example
GetBool()
) whenever possible, instead of the low-level
GetData()
.
Once a container value has been set using one type you must neither try to access it using another type, nor overwrite it with a value of another type! Using the wrong access will not crash, but it is illegal.
Get Data
|
Bool
|
GetBool
(
Int32
id,
Bool
preset=false) const
|
Int32
|
GetInt32
(
Int32
id,
Int32
preset=0) const
|
UInt32
|
GetUInt32
(
Int32
id,
UInt32
preset=0) const
|
Int64
|
GetInt64
(
Int32
id,
Int64
preset=0) const
|
UInt64
|
GetUInt64
(
Int32
id,
UInt64
preset=0) const
|
Float
|
GetFloat
(
Int32
id,
Float
preset=0.0) const
|
void *
|
GetVoid
(
Int32
id, void *preset=nullptr) const
|
void *
|
GetMemoryAndRelease
(
Int32
id,
Int
&count, void *preset=nullptr)
|
void *
|
GetMemory
(
Int32
id,
Int
&count, void *preset=nullptr) const
|
向量
|
GetVector
(
Int32
id, const
向量
&preset=
向量
()) const
|
矩阵
|
GetMatrix
(
Int32
id, const
矩阵
&preset=
矩阵
()) const
|
String
|
GetString
(
Int32
id, const
maxon::String
&preset=
maxon::String
()) const
|
C4DUuid
|
GetUuid
(
Int32
id, const
C4DUuid
&preset=
C4DUuid
(
DC
)) const
|
Filename
|
GetFilename
(
Int32
id, const
Filename
&preset=
Filename
()) const
|
BaseTime
|
GetTime
(
Int32
id, const
BaseTime
&preset=
BaseTime
()) const
|
BaseContainer
|
GetContainer
(
Int32
id) const
|
BaseContainer
*
|
GetContainerInstance
(
Int32
id)
|
const
BaseContainer
*
|
GetContainerInstance
(
Int32
id) const
|
BaseList2D
*
|
GetLink
(
Int32
id, const
BaseDocument
*doc,
Int32
instanceof=0) const
|
BaseObject
*
|
GetObjectLink
(
Int32
id, const
BaseDocument
*doc) const
|
BaseMaterial
*
|
GetMaterialLink
(
Int32
id, const
BaseDocument
*doc) const
|
BaseLink
*
|
GetBaseLink
(
Int32
id) const
|
const
CustomDataType
*
|
GetCustomDataType
(
Int32
id,
Int32
datatype) const
|
Set Data
|
void
|
SetBool
(
Int32
id,
Bool
b)
|
void
|
SetInt32
(
Int32
id,
Int32
l)
|
void
|
SetUInt32
(
Int32
id,
UInt32
l)
|
void
|
SetInt64
(
Int32
id,
Int64
l)
|
void
|
SetUInt64
(
Int32
id,
UInt64
l)
|
void
|
SetFloat
(
Int32
id,
Float
r)
|
void
|
SetVoid
(
Int32
id, void *v)
|
void
|
SetMemory
(
Int32
id, void *mem,
Int
count)
|
void
|
SetVector
(
Int32
id, const
向量
&v)
|
void
|
SetMatrix
(
Int32
id, const
矩阵
&m)
|
void
|
SetString
(
Int32
id, const
maxon::String
&s)
|
void
|
SetUuid
(
Int32
id, const
C4DUuid
&u)
|
void
|
SetFilename
(
Int32
id, const
Filename
&f)
|
void
|
SetTime
(
Int32
id, const
BaseTime
&b)
|
void
|
SetContainer
(
Int32
id, const
BaseContainer
&s)
|
void
|
SetLink
(
Int32
id,
C4DAtomGoal
*link)
|
构造函数 & 析构函数文档编制
◆
BaseContainer()
[1/3]
Default constructor. Creates an empty container with ID
0
.
◆
BaseContainer()
[2/3]
Creates a container with a specific
id
.
-
参数
-
[in]
|
id
|
The container ID.
|
◆
BaseContainer()
[3/3]
Copy constructor. Creates a new container with all the IDs and values from the source one.
-
参数
-
[in]
|
n
|
The source container.
|
◆
~BaseContainer()
Destructor.
成员函数文档编制
◆
operator=()
Assignment operator. Copies all values from the source container.
-
参数
-
[in]
|
n
|
The source container.
|
-
返回
-
The assigned source container to the left-operand container.
◆
GetClone()
Retrieves a copy of the container including all values.
-
参数
-
[in]
|
flags
|
The flags for the clone:
COPYFLAGS
|
[in]
|
trans
|
An alias translator for the operation. Can be
nullptr
. The caller owns the pointed alias translator.
|
-
返回
-
The cloned container. The caller owns the pointed container.
◆
CopyTo()
Copies the container values into the destination container
dst
.
-
参数
-
[out]
|
dst
|
The destination container. The caller owns the pointed container.
|
[in]
|
flags
|
The flags for the clone:
COPYFLAGS
|
[in]
|
trans
|
An alias translator for the operation. Can be
nullptr
. The caller owns the pointed alias translator.
|
-
返回
-
true
if successful, otherwise
false
.
◆
FlushAll()
Clears all values in the container. The container ID is not changed.
◆
GetId()
Gets the ID of the container.
-
返回
-
The container ID.
◆
SetId()
void SetId
|
(
|
Int32
|
c_id
|
)
|
|
Sets the ID of the container.
-
参数
-
[in]
|
c_id
|
The container ID.
|
◆
GetDirty()
Gets the dirty count. It is incremented when the container changes so it can be used to check if the container has changed.
-
返回
-
The dirty counter.
◆
RemoveData()
Removes the first data item with the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the value to be removed.
|
-
返回
-
true
if any value was removed, otherwise
false
.
◆
RemoveIndex()
Removes the data item at the specified index
i
.
-
参数
-
[in]
|
i
|
The index of the value to be removed.
|
-
返回
-
true
if any value was removed, otherwise
false
.
◆
FindIndex()
Gets the index for the value with the specified
id
.
ppData
is optionally assigned the data of the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the value.
|
[out]
|
ppData
|
Assigned the data of the specified
id
, if not
nullptr
.
|
-
返回
-
The index of the value, or
NOTOK
if such value does not exists.
◆
GetIndexId()
Gets the ID of the element at the specified
index
.
Can be used to browse through the container:
Int32
i = 0;
while
(
true
)
{
id
=
GetIndexId
(i++);
if
(
id
==
NOTOK
)
break
;
...
}
-
参数
-
[in]
|
index
|
The index of the value.
|
-
返回
-
The ID of the value, or
NOTOK
if it does not exist.
◆
GetDataPointer()
Retrieves a pointer to directly access the data (Read-only).
-
参数
-
[in]
|
id
|
The ID of the data.
|
-
返回
-
A pointer to the data (Read-only). The container owns the pointed data.
◆
GetDataPointers()
void GetDataPointers
|
(
|
const
Int32
*
|
ids
,
|
|
|
Int32
|
cnt
,
|
|
|
const
GeData
**
|
data
|
|
)
|
|
const
|
Retrieves an array of pointers to directly access the data (Read-only).
-
参数
-
[out]
|
ids
|
Assigned a pointer to the array of data IDs. The container owns the pointed array.
|
[in]
|
cnt
|
The number of array elements.
|
[out]
|
data
|
Assigned a pointer to the data pointer array. The container owns the pointed array.
|
◆
GetIndexData()
Retrieves the data for the element at
index
.
-
参数
-
[in]
|
index
|
The index of the element.
|
-
返回
-
The data, or
nullptr
if no data was found. The container owns the pointed data. Must not be changed!
◆
InsData()
Inserts an arbitrary data at the specified
id
.
-
注意
-
Does not check if the ID already exists in the container.
-
参数
-
[in]
|
id
|
The ID to insert at.
|
[in]
|
n
|
The data to insert.
|
-
返回
-
The inserted data. The container owns the pointed data.
◆
InsDataAfter()
Inserts an arbitrary data at the specified
id
after
last
.
-
参数
-
[in]
|
id
|
The ID to insert at.
|
[in]
|
n
|
The data to insert.
|
[in]
|
last
|
The data to insert after. The container owns the pointed data.
|
-
返回
-
The inserted data. The container owns the pointed data.
◆
SetData()
Sets an arbitrary data at the specified
id
. If a value exists under the same ID, its content will be changed.
-
参数
-
[in]
|
id
|
The ID of the element to set.
|
[in]
|
n
|
The data to set.
|
-
返回
-
The data set, or a
DA_NIL
data if it was not found.
◆
GetData()
Retrieves the data for an element at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the element.
|
-
返回
-
The data, or a
DA_NIL
data if it was not found.
◆
operator==()
Equality operator. Checks if the containers have the same IDs, the same values and all values are equal.
-
注意
-
IDs have to be in the same order.
-
参数
-
[in]
|
d
|
The container to compare against.
|
-
返回
-
true
if the containers have the same IDs, the same values and all values are equal, otherwise
false
.
◆
operator!=()
Not equal operator. Checks if the containers have different IDs, different values or values are different.
-
参数
-
[in]
|
d
|
The container to compare against.
|
-
返回
-
true
if the containers have different IDs, different values or values are different, otherwise
false
.
◆
GetBool()
Gets the
Bool
value at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[in]
|
preset
|
Returned if the value is not available.
|
-
返回
-
The value.
◆
GetInt32()
Gets the
Int32
value at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[in]
|
preset
|
Returned if the value is not available.
|
-
返回
-
The value.
◆
GetUInt32()
Gets the
UInt32
value at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[in]
|
preset
|
Returned if the value is not available.
|
-
返回
-
The value.
◆
GetInt64()
Gets the
Int64
value at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[in]
|
preset
|
Returned if the value is not available.
|
-
返回
-
The value.
◆
GetUInt64()
Gets the
UInt64
value at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[in]
|
preset
|
Returned if the value is not available.
|
-
返回
-
The value.
◆
GetFloat()
Gets the
Float
value at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[in]
|
preset
|
Returned if the value is not available.
|
-
返回
-
The value.
◆
GetVoid()
void* GetVoid
|
(
|
Int32
|
id
,
|
|
|
void *
|
preset
=
nullptr
|
|
)
|
|
const
|
Gets the
void*
value at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[in]
|
preset
|
Returned if the value is not available.
|
-
返回
-
The value, or
preset
if it does not exist.
◆
GetMemoryAndRelease()
void* GetMemoryAndRelease
|
(
|
Int32
|
id
,
|
|
|
Int
&
|
count
,
|
|
|
void *
|
preset
=
nullptr
|
|
)
|
|
|
Gets the memory buffer at the specified
id
.
-
注意
-
In this version of
GetMemory()
the caller takes over the ownership of the memory block.
The memory block must be allocated with
NewMem()
and deallocated with
DeleteMem()
.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[out]
|
count
|
Assigned the number of bytes in the memory buffer returned.
|
[in]
|
preset
|
Returned if the value is not available.
|
-
返回
-
The memory buffer, or
preset
if it does not exist. The caller takes over the ownership of the memory block.
◆
GetMemory()
void* GetMemory
|
(
|
Int32
|
id
,
|
|
|
Int
&
|
count
,
|
|
|
void *
|
preset
=
nullptr
|
|
)
|
|
const
|
Gets the memory buffer at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[out]
|
count
|
Assigned the number of bytes in the memory buffer returned.
|
[in]
|
preset
|
Returned if the value is not available.
|
-
返回
-
The memory buffer, or
preset
if it does not exist. The container owns the pointed memory block.
◆
GetVector()
Gets the
向量
value at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[in]
|
preset
|
Returned if the value is not available.
|
-
返回
-
The value.
◆
GetMatrix()
Gets the
矩阵
value at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[in]
|
preset
|
Returned if the value is not available.
|
-
返回
-
The value.
◆
GetString()
Gets the
String
value at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[in]
|
preset
|
Returned if the value is not available.
|
-
返回
-
The value.
◆
GetUuid()
Gets the
C4DUuid
value at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[in]
|
preset
|
Returned if the value is not available.
|
-
返回
-
The value.
◆
GetFilename()
Gets the
Filename
value at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[in]
|
preset
|
Returned if the value is not available.
|
-
返回
-
The value.
◆
GetTime()
Gets the
BaseTime
value at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[in]
|
preset
|
Returned if the value is not available.
|
-
返回
-
The value.
◆
GetContainer()
Gets a copy of the sub-container at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested sub-container.
|
-
返回
-
The sub-container, or an empty container if it does not exist.
◆
GetContainerInstance()
[1/2]
Gets a pointer to the sub-container at the specified
id
. Changes to the pointed container are reflected in the stored sub-container.
-
参数
-
[in]
|
id
|
The ID of the requested sub-container ID.
|
-
返回
-
A pointer to the sub-container, or
nullptr
if it does not exist. The container owns the pointed sub-container.
◆
GetContainerInstance()
[2/2]
Gets a read-only pointer to the sub-container with the specified
id
.
-
由于
-
R17.032
-
参数
-
[in]
|
id
|
The ID of the requested sub-container ID.
|
-
返回
-
A pointer to the sub-container, or
nullptr
if it does not exist. The container owns the pointed sub-container.
◆
GetLink()
Gets a linked baselist node at the specified
id
. Equivalent to
BaseLink::GetLink()
.
若
instanceof
is specified,
nullptr
is returned if the node is not of this type.
-
参数
-
[in]
|
id
|
The ID of the requested value.
|
[in]
|
doc
|
The document to evaluate the link in. The caller owns the pointed document.
|
[in]
|
instanceof
|
Set this to a node type to only return the link if it is of this type.
|
-
返回
-
The linked object, or
nullptr
if the link is broken. The document owns the pointed linked baselist.
◆
GetObjectLink()
Gets a linked object at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested object link.
|
[in]
|
doc
|
The document to evaluate the object link in. The caller owns the pointed document.
|
-
返回
-
The linked object, or
nullptr
if the link is broken. The document owns the pointed linked object.
◆
GetMaterialLink()
Gets a linked material at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested link.
|
[in]
|
doc
|
The document to evaluate the link in. The caller owns the pointed document.
|
-
返回
-
The linked material, or
nullptr
if the link is broken. The document owns the pointed linked material.
◆
GetBaseLink()
Gets the
BaseLink
at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested link.
|
-
返回
-
The link, or
nullptr
if there is no link stored. The container owns the pointed link.
◆
GetCustomDataType()
Gets the
CustomDataType
value at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the requested custom datatype.
|
[in]
|
datatype
|
The datatype type ID.
|
-
返回
-
The custom datatype, or
nullptr
if it does not exist or the wrong
datatype
was specified. The container owns the pointed custom datatype.
◆
GetType()
Gets the type of the element at the specified
id
.
-
参数
-
[in]
|
id
|
The ID of the element.
|
-
返回
-
The type of the element:
DA_TYPES
◆
SetBool()
设置
Bool
value at the specified
id
, or inserts it if it does not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
b
|
The new or inserted value.
|
◆
SetInt32()
设置
Int32
value at the specified
id
, or inserts it if it does not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
l
|
The new or inserted value.
|
◆
SetUInt32()
设置
UInt32
value at the specified
id
, or inserts it if it does not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
l
|
The new or inserted value.
|
◆
SetInt64()
设置
Int64
value at the specified
id
, or inserts it if it does not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
l
|
The new or inserted value.
|
◆
SetUInt64()
设置
UInt64
value at the specified
id
, or inserts it if it does not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
l
|
The new or inserted value.
|
◆
SetFloat()
设置
Float
value at the specified
id
, or inserts it if it does not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
r
|
The new or inserted value.
|
◆
SetVoid()
void SetVoid
|
(
|
Int32
|
id
,
|
|
|
void *
|
v
|
|
)
|
|
|
设置
void*
value at the specified
id
, or inserts it if it does not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
v
|
The new or inserted value.
|
◆
SetMemory()
void SetMemory
|
(
|
Int32
|
id
,
|
|
|
void *
|
mem
,
|
|
|
Int
|
count
|
|
)
|
|
|
Sets the memory block at the specified
id
to
mem
, or inserts it if it did not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
mem
|
The memory buffer. The container takes the ownership over the memory buffer.
|
[in]
|
count
|
The number of bytes in
mem
.
|
◆
SetVector()
void SetVector
|
(
|
Int32
|
id
,
|
|
|
const
向量
&
|
v
|
|
)
|
|
|
设置
向量
value at the specified
id
, or inserts it if it does not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
v
|
The new or inserted value.
|
◆
SetMatrix()
void SetMatrix
|
(
|
Int32
|
id
,
|
|
|
const
矩阵
&
|
m
|
|
)
|
|
|
设置
矩阵
value at the specified
id
, or inserts it if it does not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
m
|
The new or inserted value.
|
◆
SetString()
设置
String
value at the specified
id
, or inserts it if it does not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
s
|
The new or inserted value.
|
◆
SetUuid()
设置
C4DUuid
value at the specified
id
, or inserts it if it does not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
u
|
The new or inserted value.
|
◆
SetFilename()
设置
Filename
value at the specified
id
, or inserts it if it does not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
f
|
The new or inserted value.
|
◆
SetTime()
设置
BaseTime
value at the specified
id
, or inserts it if it does not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
b
|
The new or inserted value.
|
◆
SetContainer()
Sets the sub-container value at the specified
id
, or inserts it if it does not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
s
|
The new or inserted value.
|
◆
SetLink()
Sets the link value at the specified
id
, or inserts it if it does not exist.
-
参数
-
[in]
|
id
|
The ID of the value to set.
|
[in]
|
link
|
The new or inserted value.
|
◆
MergeContainer()
Stores the values from
src
in the container, overwriting any elements with the same IDs and keeping the rest.
-
参数
-
[in]
|
src
|
The source container to merge.
|
◆
GetParameter()
Retrieves the
GeData
for the specified parameter description
id
.
-
参数
-
[in]
|
id
|
The ID of the requested data.
|
[out]
|
t_data
|
Assigned the retrieved data.
|
-
返回
-
true
if successful, otherwise
false
.
◆
SetParameter()
设置
GeData
for the specified parameter description
id
.
-
参数
-
[in]
|
id
|
The ID of the parameter to set.
|
[in]
|
t_data
|
The data to set or insert.
|
◆
Sort()
Sorts the container entries by ID.
-
注意
-
This function sorts the strings and remove any other value. (keeping the ID)
Member Data Documentation
◆
dummy1
◆
dummy2
◆
dummy3
◆
dummy4
◆
dummy5
#define NOTOK
定义:
ge_sys_math.h:265
maxon::Int32 Int32
定义:
ge_sys_math.h:58
Int32 GetIndexId(Int32 index) const
定义:
c4d_basecontainer.h:197