-
首页
-
C4D R23.110 C++ SDK
HyperFile Class Reference
#include <c4d_file.h>
详细描述
Hyper files are used to save plugin data that cannot be stored in a
BaseContainer
.
Cinema 4D
creates it and pass it to dedicated Load and Save overrides when needed (see
NodeData
and
CustomDataTypeClass
).
Access to the hyper file's data is like a
FIFO
(first in, first out) buffer; the values must be written and read in the same order.
-
注意
-
Has to be created with
Alloc()
and destroyed with
Free()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
构造函数 & 析构函数文档编制
◆
HyperFile()
◆
~HyperFile()
成员函数文档编制
◆
Alloc()
Allocates a hyper file. Destroy the allocated hyper file with
Free()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
返回
-
The allocated hyper file, or
nullptr
if the allocation failed.
◆
Free()
Destructs hyper files allocated with
Alloc()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
参数
-
[in,out]
|
fl
|
The hyper file to destruct. If the pointer is
nullptr
nothing happens. The pointer is assigned
nullptr
afterwards.
|
◆
Open()
Opens the hyper file.
-
参数
-
[in]
|
ident
|
The file identification.
|
[in]
|
filename
|
The name of the file to open.
|
[in]
|
mode
|
The file mode:
FILEOPEN
|
[in]
|
error_dialog
|
The file error dialog:
FILEDIALOG
|
-
返回
-
true
if the hyper file could be opened, otherwise
false
.
◆
Close()
Closes the hyper file.
-
返回
-
true
if the hyper file could be closed, otherwise
false
.
◆
ReadChar()
Reads a
Char
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadUChar()
Reads a
UChar
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadInt16()
Reads a
Int16
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadUInt16()
Reads a
UInt16
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadInt32()
Reads a
Int32
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadUInt32()
Reads a
UInt32
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadInt64()
Reads a
Int64
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadUInt64()
Reads a
UInt64
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadFloat()
Reads a
Float
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadFloat32()
Reads a
Float32
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadFloat64()
Reads a
Float64
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadBool()
Reads a
Bool
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadTime()
Reads a
BaseTime
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadVector()
Reads a
向量
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadVector32()
Reads a
Vector32
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadVector64()
Reads a
Vector64
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadMatrix()
Reads a
矩阵
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadMatrix32()
Reads a
Matrix32
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadMatrix64()
Reads a
Matrix64
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadString()
Reads a
String
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadFilename()
Reads a
Filename
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadImage()
Reads a
BaseBitmap
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadGeData()
Reads a
GeData
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
ReadContainer()
Reads a container from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
[in]
|
flush
|
Specify if the container should be cleared before reading the new values.
Passing
false
will merge the container with the one read from the file.
|
-
返回
-
Success of reading the container.
◆
ReadMemory()
Bool
ReadMemory
|
(
|
void **
|
data
,
|
|
|
Int
*
|
size
|
|
)
|
|
|
Reads a block of memory from the hyper file.
-
注意
-
Only use when really needed. Be aware that the byte sequences will not be platform independent.
范例:
Int32
size;
void
* data =
nullptr
;
Bool
ok =
ReadMemory
(&data, &size);
DeleteMem
(data);
-
参数
-
[out]
|
data
|
A pointer to the start of the memory block to read.
|
[out]
|
size
|
Assigned the byte size of the memory data read.
|
-
返回
-
Success of reading the memory block.
◆
ReadChannelConvert()
Deprecated
.
◆
ReadArray()
Reads an array of the specified
type
from the hyper file.
-
参数
-
[out]
|
data
|
A pointer to an array to be filled. The caller owns the pointed array.
|
[in]
|
type
|
The data type:
HYPERFILEARRAY
|
[in]
|
structure_increment
|
The size of the data type (
sizeof()
).
|
[in]
|
count
|
The umber of elements in
data
.
|
-
返回
-
Success of reading the array.
◆
ReadUuid()
Reads a
C4DUuid
value from the hyper file.
-
参数
-
[out]
|
v
|
Assigned the value read from the hyper file.
|
-
返回
-
Success of reading the value.
◆
WriteChar()
Writes a
Char
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteUChar()
Writes a
UChar
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteInt16()
Writes a
Int16
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteUInt16()
Writes a
UInt16
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteInt32()
Writes a
Int32
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteUInt32()
Writes a
UInt32
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteInt64()
Writes a
Int64
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteUInt64()
Writes a
UInt64
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteFloat()
Writes a
Float
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteFloat32()
Writes a
Float32
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteFloat64()
Writes a
Float64
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteBool()
Writes a
Bool
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteTime()
Writes a
BaseTime
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteVector()
Bool
WriteVector
|
(
|
const
向量
&
|
v
|
)
|
|
Writes a
向量
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteVector32()
Writes a
Vector32
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteVector64()
Writes a
Vector64
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteMatrix()
Bool
WriteMatrix
|
(
|
const
矩阵
&
|
v
|
)
|
|
Writes a
矩阵
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteMatrix32()
Writes a
Matrix32
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteMatrix64()
Writes a
Matrix64
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteString()
Writes a
String
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteFilename()
Writes a
Filename
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteImage()
Writes an image to the hyper file.
-
参数
-
[in]
|
bmp
|
The bitmap to write to the hyperfile. The caller owns the pointed bitmap.
|
[in]
|
format
|
The image format:
FILTER
|
[in]
|
data
|
A container with additional format settings, or
nullptr
.
|
[in]
|
savebits
|
The save bits:
SAVEBIT
|
-
返回
-
Success of writing the image.
◆
WriteGeData()
Writes a
Char
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
WriteContainer()
Writes a container to the hyper file.
-
参数
-
[in]
|
v
|
The container to write to the hyper file.
|
-
返回
-
Success of writing the container.
◆
WriteMemory()
Bool
WriteMemory
|
(
|
const void *
|
data
,
|
|
|
Int
|
count
|
|
)
|
|
|
Writes a block of memory to the hyper file.
-
注意
-
Only use when really needed. Be aware that the byte sequences will not be platform independent.
-
参数
-
[in]
|
data
|
The start of the memory block to write to the hyper file.
|
[in]
|
count
|
The size in bytes of the memory data to write.
|
-
返回
-
Success of writing the memory block.
◆
WriteArray()
Writes an array of the specified
datatype
to the hyper file.
-
参数
-
[in]
|
data
|
The pointer to the array. The caller owns the pointed array.
|
[in]
|
datatype
|
The array data type:
HYPERFILEARRAY
|
[in]
|
structure_increment
|
Size of the data type (
sizeof()
).
|
[in]
|
count
|
The number of elements in
data
.
|
-
返回
-
Success of writing the array.
◆
WriteUuid()
Writes a
C4DUuid
value to the hyper file.
-
参数
-
[in]
|
v
|
The value to write to the hyper file.
|
-
返回
-
Success of writing the value.
◆
GetError()
Gets the error from the last hyper file operation.
-
返回
-
The error:
FILEERROR
◆
SetError()
Sets the error for the hyper file.
-
参数
-
◆
ReadValueHeader()
Reads the value header from the hyper file.
This is only necessary in combination with loops.
例如:
static
Bool
ReadSettings(
BaseObject
*op,
HyperFile
*hf,
Int32
level)
{
Int32
id, level, v;
String
test;
HYPERFILEVALUE
h;
while
(hf->
ReadValueHeader
(&h) && h==
HYPERFILEVALUE::START
)
{
if
(!hf->
ReadChunkStart
(&
id
, &level))
return
false
;
if
(
id
==2)
{
hf->
ReadInt32
(&v);
hf->
ReadInt32
(&v);
}
else
if
(
id
==3)
{
hf->
ReadInt32
(&v);
hf->
ReadInt32
(&v);
hf->
ReadInt32
(&v);
}
hf->
SkipToEndChunk
();
// Never forget this at the end
if
(
id
==0)
break
;
// Chunk ID 0 is end chunk
}
hf->
ReadString
(test);
return
true
;
}
-
参数
-
[in]
|
h
|
A pointer to a HYPERFILEVALUE to take the header value:
HYPERFILEVALUE
|
-
返回
-
true
if the header was read successfully, otherwise
false
.
◆
SkipValue()
Skips a given type of value.
-
参数
-
-
返回
-
true
if the value was of the given header type and it was skipped, otherwise
false
.
◆
WriteChunkStart()
Writes a chunk marker into the file indicating the beginning of a new chunk of data.
-
参数
-
[in]
|
id
|
The ID for the chunk.
|
[in]
|
level
|
To write additional information, increase this level to save/read new values.
|
-
返回
-
true
if the chunk identification was written successfully, otherwise
false
.
◆
WriteChunkEnd()
Bool
WriteChunkEnd
|
(
|
void
|
|
)
|
|
Writes a chunk ending marker into the hyper file.
-
返回
-
true
if the chunk end was written successfully, otherwise
false
.
◆
ReadChunkStart()
Reads a chunks identification from the hyper file.
-
参数
-
[out]
|
id
|
Assigned the chunk ID.
|
[out]
|
level
|
Assigned the chunk level.
|
-
返回
-
true
if the chunk start was read successfully, otherwise
false
.
◆
ReadChunkEnd()
Bool
ReadChunkEnd
|
(
|
void
|
|
)
|
|
Reads a chunk end marker from the hyper file.
-
返回
-
true
if the chunk end was read successfully, otherwise
false
.
◆
SkipToEndChunk()
Bool
SkipToEndChunk
|
(
|
void
|
|
)
|
|
Moves the file pointer to the end of the chunk.
-
注意
-
Should always be called after having finished reading values from the current chunk.
-
返回
-
true
if the end of the chunk was found and skipped to, otherwise
false
.
◆
GetFileVersion()
Int32
GetFileVersion
|
(
|
|
)
|
const
|
Gets the version of
Cinema 4D
that wrote the file. (Only valid while reading a
Cinema 4D
scene, object, material etc.)
-
返回
-
The file version.
◆
SetFileVersion()
void SetFileVersion
|
(
|
Int32
|
val
|
)
|
|
Private
.
◆
GetDocument()
Gets the active document for the hyper file operation.
Can be
nullptr
, for instance when saving layouts.
-
返回
-
The document for the hyper file operation.
Cinema 4D
owns the pointed document.
◆
GetLocation()
Gets the hyper file location.
-
返回
-
The hyper file location:
LOCATION
◆
GetFilterFlags()
Gets the filter flags, the value is valid only during a Load or a Merge.
-
返回
-
The filter flags:
SCENEFILTER
HYPERFILEVALUE
定义:
ge_prepass.h:3846
@ START
Marks the start of a chunk.
Bool ReadValueHeader(HYPERFILEVALUE *h)
Bool ReadMemory(void **data, Int *size)
void DeleteMem(T *&p)
定义:
defaultallocator.h:258
Bool SkipToEndChunk(void)
maxon::Int32 Int32
定义:
ge_sys_math.h:58
Bool ReadString(maxon::String *v)
Bool ReadChunkStart(Int32 *id, Int32 *level)
maxon::Bool Bool
定义:
ge_sys_math.h:53