c4d.storage.HyperFile

class c4d.storage.HyperFile
Hyper files are used to store data in a file.
The HyperFile works with the ‘FIFO’ concept.
The values will be written and read in the same order.

The following source code is a simple example showing how to use the HyperFile class.
import c4d, os
YOUR_IDENT = 49545 # Choose a custom ident
path = os.path.join("/Users", "Dev", "Desktop", "test.file")
print path

def Write(path, key):
    #write
    print path
    hf = c4d.storage.HyperFile()
    if hf.Open(ident=key, filename=path, mode=c4d.FILEOPEN_WRITE, error_dialog=c4d.FILEDIALOG_NONE):
        bc = c4d.BaseContainer()
        bc[0] = "test"
        bc[1] = "3"
        hf.WriteContainer(bc)
        hf.Close()
    else:
        c4d.gui.MessageDialog("Cannot open file to write.")

def Read(path, key):
    #read
    hf = c4d.storage.HyperFile()
    if hf.Open(ident=key, filename=path, mode=c4d.FILEOPEN_READ, error_dialog=c4d.FILEDIALOG_NONE):
        bc = hf.ReadContainer()
        hf.Close()
        print bc[0], bc[1] #output: test 3
    else:
        c4d.gui.MessageDialog("Cannot open file to read.")

Write(path, YOUR_IDENT)
Read(path, YOUR_IDENT)

Methods Signatures

HyperFile.__init__(self)

Allocates a hyper file.

HyperFile.Open(self, ident, filename, ...)

Opens the hyper file.

HyperFile.Close(self)

Closes the hyper file.

HyperFile.WriteChar(self, v)

Write a character to the hyperfile.

HyperFile.WriteUChar(self, v)

Write a very short int to the hyperfile.

HyperFile.WriteInt16(self, v)

Write a signed short int to the hyperfile.

HyperFile.WriteUInt16(self, v)

Write an unsigned short int to the hyperfile.

HyperFile.WriteInt32(self, v)

Write an int to the hyperfile.

HyperFile.WriteUInt32(self, v)

Write an unsigned int to the hyperfile.

HyperFile.WriteInt64(self, v)

Write a double precision int value to the hyperfile.

HyperFile.WriteUInt64(self, v)

Write a double precision unsigned int value to the hyperfile.

HyperFile.WriteFloat32(self, v)

Write a float value to the hyperfile.

HyperFile.WriteFloat64(self, v)

Write a double precision float value to the hyperfile.

HyperFile.WriteVector(self, v)

Write a Vector to the hyperfile.

HyperFile.WriteVector32(self, v)

Write a Vector to the hyperfile.

HyperFile.WriteVector64(self, v)

Write a double precision Vector to the hyperfile.

HyperFile.WriteMatrix(self, v)

Write a Matrix to the hyperfile.

HyperFile.WriteMatrix32(self, v)

Write a Matrix to the hyperfile.

HyperFile.WriteMatrix64(self, v)

Write a double precision Matrix to the hyperfile.

HyperFile.WriteBool(self, v)

Write a bool to the hyperfile.

HyperFile.WriteTime(self, v)

Write a BaseTime to the hyperfile.

HyperFile.WriteString(self, v)

Write a string to the hyperfile.

HyperFile.WriteFilename(self, v)

Write a path to the hyperfile.

HyperFile.WriteImage(self, v, format, data)

Write an image to the hyperfile.

HyperFile.WriteContainer(self, v)

Write the settings in a BaseContainer to the hyperfile.

HyperFile.WriteMemory(self, data)

Write a block of memory to the hyperfile.

HyperFile.WriteData(self, v)

Write data to the container.

HyperFile.ReadChar(self)

Read a character from the hyperfile.

HyperFile.ReadUChar(self)

Read an unsigned character from the hyperfile.

HyperFile.ReadInt16(self)

Read a signed word from the hyperfile.

HyperFile.ReadUInt16(self)

Read an unsigned word from the hyperfile.

HyperFile.ReadInt32(self)

Read an int from the hyperfile.

HyperFile.ReadUInt32(self)

Read an unsigned int from the hyperfile.

HyperFile.ReadInt64(self)

Read a double precision int from the hyperfile.

HyperFile.ReadUInt64(self)

Read a double precision unsigned int from the hyperfile.

HyperFile.ReadFloat(self)

Read a float from the hyperfile.

HyperFile.ReadFloat32(self)

Read a float from the hyperfile.

HyperFile.ReadFloat64(self)

Read a double precision float from the hyperfile.

HyperFile.ReadVector(self)

Read a Vector from the hyperfile.

HyperFile.ReadVector32(self)

Read a Vector from the hyperfile.

HyperFile.ReadVector64(self)

Read a double precision Vector from the hyperfile.

HyperFile.ReadMatrix(self)

Read a Matrix from the hyperfile.

HyperFile.ReadMatrix32(self)

Read a Matrix from the hyperfile.

HyperFile.ReadMatrix64(self)

Read a double precision Matrix from the hyperfile.

HyperFile.ReadBool(self)

Read a bool from the hyperfile.

HyperFile.ReadTime(self)

Read a BaseTime from the hyperfile.

HyperFile.ReadString(self)

Read a string from the hyperfile.

HyperFile.ReadFilename(self)

Read a path from the hyperfile.

HyperFile.ReadImage(self)

Read a bitmap from the hyperfile.

HyperFile.ReadContainer(self)

Read a container from the hyperfile.

HyperFile.ReadMemory(self)

Read a block of memory from the hyperfile.

HyperFile.ReadData(self)

Read a data from the hyperfile.

HyperFile.GetError(self)

Get the error from the last hyperfile operation.

HyperFile.SetError(self, err)

Set the error value for this hyperfile.

HyperFile.ReadValueHeader(self)

Read the value header from the file. This is only necessary in combination with loops.

HyperFile.SkipValue(self, h)

Skip a given type of value.

HyperFile.WriteChunkStart(self, id, level)

Write a chunk marker into the file indicating the beginning of a new chunk of data.

HyperFile.WriteChunkEnd(self)

Write a chunk ending marker into the file.

HyperFile.ReadChunkStart(self)

Read a chunks identification from the file.

HyperFile.ReadChunkEnd(self)

Read a chunks end marker from the file.

HyperFile.SkipToEndChunk(self)

Move the file pointer to the end of the chunk.

HyperFile.GetDocument(self)

Gets the active document for the hyper file operation.

HyperFile.GetFileVersion(self)

Get the version of Cinema 4D that wrote the file.

HyperFile.GetFilterFlags(self)

Gets the filter flags, the value is valid only during a Load or a Merge.

Methods Documentation

HyperFile.__init__(self)

Allocates a hyper file.

Return type

c4d.storage.HyperFile

Returns

The hyper file.

HyperFile.Open(self, ident, filename, mode, error_dialog)

Opens the hyper file.

Parameters
  • ident (int) – File identification.

  • filename (Union[str, c4d.storage.MemoryFileStruct]) – File to open.

  • mode (int) –

    File mode:

    FILEOPEN_APPEND

    Open an existing file for writing and set the position to the end of that file.

    FILEOPEN_READ

    Open the file for reading.

    FILEOPEN_WRITE

    Create a new file for writing. Warning: If the file name points to an existing file, it will be overwritten.

    FILEOPEN_READWRITE

    Open the file for both reading and writing.

    FILEOPEN_READ_NOCACHE

    Private.

    FILEOPEN_SHAREDREAD

    Private.

    FILEOPEN_SHAREDWRITE

    Private.

  • error_dialog (int) –

    File error dialog:

    FILEDIALOG_NONE

    Never show an error dialog.

    FILEDIALOG_ANY

    Show an error dialog for any error.

    FILEDIALOG_IGNOREOPEN

    Do not show an error dialog if the file does not exist, otherwise like FILEDIALOG_ANY.

Return type

bool

Returns

True if the hyper file could be opened, otherwise False.

HyperFile.Close(self)

Closes the hyper file.

Return type

bool

Returns

True on success.

HyperFile.WriteChar(self, v)

Write a character to the hyperfile.

Parameters

v (int) – A char to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteUChar(self, v)

Write a very short int to the hyperfile.

Parameters

v (int) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteInt16(self, v)

Write a signed short int to the hyperfile.

New in version R15.037.

Parameters

v (int) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteUInt16(self, v)

Write an unsigned short int to the hyperfile.

New in version R15.037.

Parameters

v (int) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteInt32(self, v)

Write an int to the hyperfile.

New in version R15.037.

Parameters

v (int) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteUInt32(self, v)

Write an unsigned int to the hyperfile.

New in version R15.037.

Parameters

v (int) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteInt64(self, v)

Write a double precision int value to the hyperfile.

New in version R15.037.

Parameters

v (int) – The integer to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteUInt64(self, v)

Write a double precision unsigned int value to the hyperfile.

New in version R15.037.

Parameters

v (int) – The integer to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteFloat32(self, v)

Write a float value to the hyperfile.

New in version R16.021.

Parameters

v (float) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteFloat64(self, v)

Write a double precision float value to the hyperfile.

New in version R15.037.

Parameters

v (float) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteVector(self, v)

Write a Vector to the hyperfile.

Parameters

v (c4d.Vector) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteVector32(self, v)

Write a Vector to the hyperfile.

New in version R16.021.

Parameters

v (c4d.Vector) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteVector64(self, v)

Write a double precision Vector to the hyperfile.

New in version R15.037.

Parameters

v (c4d.Vector) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteMatrix(self, v)

Write a Matrix to the hyperfile.

Parameters

v (c4d.Matrix) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteMatrix32(self, v)

Write a Matrix to the hyperfile.

New in version R16.021.

Parameters

v (c4d.Matrix) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteMatrix64(self, v)

Write a double precision Matrix to the hyperfile.

New in version R15.037.

Parameters

v (c4d.Matrix) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteBool(self, v)

Write a bool to the hyperfile.

Parameters

v (bool) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteTime(self, v)

Write a BaseTime to the hyperfile.

Parameters

v (c4d.BaseTime) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteString(self, v)

Write a string to the hyperfile.

Parameters

v (str) – The value to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteFilename(self, v)

Write a path to the hyperfile.

Parameters

v (str) – The path to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteImage(self, v, format, data, savebits=SAVEBIT_ALPHA)

Write an image to the hyperfile.

Parameters
  • v (c4d.bitmaps.BaseBitmap) – The bitmap to write to the hyperfile.

  • format (int) –

    The image format:

    FILTER_TIF

    TIFF.

    FILTER_TGA

    TGA.

    FILTER_BMP

    BMP.

    FILTER_IFF

    IFF.

    FILTER_JPG

    JPEG.

    FILTER_PICT

    PICT.

    FILTER_PSD

    PSD.

    FILTER_RLA

    RLA.

    FILTER_RPF

    RPF.

    FILTER_B3D

    BodyPaint 3D.

    FILTER_TIF_B3D

    TIFF BodyPaint 3D.

    FILTER_PSB

    PSB.

    FILTER_AVI

    AVI Movie.

    FILTER_MOVIE

    Quicktime Movie.

    FILTER_QTVRSAVER_PANORAMA

    QTVR Panorama.

    FILTER_QTVRSAVER_OBJECT

    QTVR Object.

    FILTER_HDR

    HDR.

    FILTER_EXR_LOAD

    EXR (Load).

    FILTER_EXR

    EXR.

    FILTER_PNG

    PNG.

    FILTER_IES

    IES.

    FILTER_B3DNET

    BodyPaint 3D NET. Private.

    FILTER_DPX

    DPX.

    FILTER_DDS

    New in version R19: DDS.

  • data (c4d.BaseContainer) –

    A container with additional format settings, or None.

    SAVEBIT_NONE

    None.

    SAVEBIT_ALPHA

    Save the alpha channel(s) in the file. (For filter plugins, do not save an alpha channel if this is not set.)

    SAVEBIT_MULTILAYER

    Save multiple layers.

    SAVEBIT_USESELECTEDLAYERS

    Use selected layers.

    SAVEBIT_16BITCHANNELS

    Use 16-bit channels.

    SAVEBIT_GREYSCALE

    Save in grayscale mode.

    SAVEBIT_INTERNALNET

    Private.

    SAVEBIT_DONTMERGE

    Avoid merging of layers in BodyPaint 3D files.

    SAVEBIT_32BITCHANNELS

    Use 32-bit channels.

    SAVEBIT_SAVERENDERRESULT

    Private.

    SAVEBIT_FIRSTALPHA_ONLY

    Private.

  • savebits (int) –

    The save bits:

    SAVEBIT_NONE

    None.

    SAVEBIT_ALPHA

    Save the alpha channel(s) in the file. (For filter plugins, do not save an alpha channel if this is not set.)

    SAVEBIT_MULTILAYER

    Save multiple layers.

    SAVEBIT_USESELECTEDLAYERS

    Use selected layers.

    SAVEBIT_16BITCHANNELS

    Use 16-bit channels.

    SAVEBIT_GREYSCALE

    Save in grayscale mode.

    SAVEBIT_INTERNALNET

    Private.

    SAVEBIT_DONTMERGE

    Avoid merging of layers in BodyPaint 3D files.

    SAVEBIT_32BITCHANNELS

    Use 32-bit channels.

    SAVEBIT_SAVERENDERRESULT

    Private.

    SAVEBIT_FIRSTALPHA_ONLY

    Private.

Return type

bool

Returns

Success of writing the image.

HyperFile.WriteContainer(self, v)

Write the settings in a BaseContainer to the hyperfile.

Parameters

v (c4d.BaseContainer) – The container to write to the hyperfile.

Return type

bool

Returns

Success of writing the value.

HyperFile.WriteMemory(self, data)

Write a block of memory to the hyperfile.

Note

Only use this when you need to, be aware that the byte sequences will not be platform independent.

Parameters

data (bytearray) – The data to write to the hyperfile.

Return type

bool

Returns

Success of writing the data.

HyperFile.WriteData(self, v)

Write data to the container.

Note

Please check the constructor of GeData in the C++ SDK to see what type this method accepts.

Parameters

v (any) – The data.

Return type

bool

Returns

Success of writing the value.

HyperFile.ReadChar(self)

Read a character from the hyperfile.

Return type

int

Returns

The character or None if reading failed.

HyperFile.ReadUChar(self)

Read an unsigned character from the hyperfile.

Return type

int

Returns

The unsigned character or None if reading failed.

HyperFile.ReadInt16(self)

Read a signed word from the hyperfile.

New in version R15.037.

Return type

int

Returns

The unsigned word or None if reading failed.

HyperFile.ReadUInt16(self)

Read an unsigned word from the hyperfile.

New in version R15.037.

Return type

int

Returns

The unsigned word or None if reading failed.

HyperFile.ReadInt32(self)

Read an int from the hyperfile.

New in version R15.037.

Return type

int

Returns

The unsigned int or None if reading failed.

HyperFile.ReadUInt32(self)

Read an unsigned int from the hyperfile.

New in version R15.037.

Return type

int

Returns

The unsigned int or None if reading failed.

HyperFile.ReadInt64(self)

Read a double precision int from the hyperfile.

New in version R15.037.

Return type

int

Returns

The value or None if reading failed.

HyperFile.ReadUInt64(self)

Read a double precision unsigned int from the hyperfile.

New in version R16.021.

Return type

int

Returns

The value or None if reading failed.

HyperFile.ReadFloat(self)

Read a float from the hyperfile.

New in version R15.037.

Return type

float

Returns

The float or None if reading failed.

HyperFile.ReadFloat32(self)

Read a float from the hyperfile.

New in version R16.021.

Return type

float

Returns

The float or None if reading failed.

HyperFile.ReadFloat64(self)

Read a double precision float from the hyperfile.

New in version R15.037.

Return type

float

Returns

The float or None if reading failed.

HyperFile.ReadVector(self)

Read a Vector from the hyperfile.

Return type

c4d.Vector

Returns

The vector or None if reading failed.

HyperFile.ReadVector32(self)

Read a Vector from the hyperfile.

New in version R16.021.

Return type

c4d.Vector

Returns

The vector or None if reading failed.

HyperFile.ReadVector64(self)

Read a double precision Vector from the hyperfile.

New in version R15.037.

Return type

c4d.Vector

Returns

The vector or None if reading failed.

HyperFile.ReadMatrix(self)

Read a Matrix from the hyperfile.

Return type

c4d.Matrix

Returns

The matrix or None if reading failed.

HyperFile.ReadMatrix32(self)

Read a Matrix from the hyperfile.

New in version R16.021.

Return type

c4d.Matrix

Returns

The matrix or None if reading failed.

HyperFile.ReadMatrix64(self)

Read a double precision Matrix from the hyperfile.

New in version R15.037.

Return type

c4d.Matrix

Returns

The matrix or None if reading failed.

HyperFile.ReadBool(self)

Read a bool from the hyperfile.

Return type

bool

Returns

The bool or None if reading failed.

HyperFile.ReadTime(self)

Read a BaseTime from the hyperfile.

Return type

c4d.BaseTime

Returns

The time or None if reading failed.

HyperFile.ReadString(self)

Read a string from the hyperfile.

Return type

str

Returns

The string or None if reading failed.

HyperFile.ReadFilename(self)

Read a path from the hyperfile.

Return type

str

Returns

The path or None if reading failed.

HyperFile.ReadImage(self)

Read a bitmap from the hyperfile.

Return type

c4d.bitmaps.BaseBitmap

Returns

The bitmap or None if reading failed.

HyperFile.ReadContainer(self)

Read a container from the hyperfile.

Return type

c4d.bitmaps.BaseBitmap

Returns

The container or None if reading failed.

HyperFile.ReadMemory(self)

Read a block of memory from the hyperfile.

Note

Only use this when you need to, be aware that the byte sequences will not be platform independent.

Return type

bytes

Returns

The value or None if reading failed.

HyperFile.ReadData(self)

Read a data from the hyperfile.

Note

Please check the constructor of GeData in the C++ SDK to see what type this method accepts.

Return type

Any

Returns

The value or None if reading failed.

HyperFile.GetError(self)

Get the error from the last hyperfile operation.

Return type

int

Returns

The error number.

HyperFile.SetError(self, err)

Set the error value for this hyperfile.

Parameters

err (int) – The error number.

HyperFile.ReadValueHeader(self)

Read the value header from the file. This is only necessary in combination with loops.

Example:

import c4d



def ReadSettings(op, hf, level):

    while hf.ReadValueHeader() == c4d.HYPERFILEVALUE_START:

        chunk = hf.ReadChunkStart()

        if not chunk:

            return False



        id = chunk["id"]

        if id == 2:

            i1 = hf.ReadInt32()

            i2 = hf.ReadInt32()

            # do_here

        elif id == 3:

            i1 = hf.ReadInt32()

            i2 = hf.ReadInt32()

            i3 = hf.ReadInt32()

            # do_here



        hf.SkipToEndChunk()  # never forget this at the end

        if id == 0:

            break



    test = hf.ReadString()

    # do here

    return True

Return type

int

Returns

The header value or None:

HYPERFILEVALUE_NONE

None.

HYPERFILEVALUE_START

Marks the start of a chunk.

HYPERFILEVALUE_STOP

Marks the end of a chunk.

HYPERFILEVALUE_CSTOP

Marks the end of a container. Internal.

HYPERFILEVALUE_CHAR

Integer.

HYPERFILEVALUE_UCHAR

Integer.

HYPERFILEVALUE_INT16

Integer.

HYPERFILEVALUE_UINT16

Integer.

HYPERFILEVALUE_INT32

Integer.

HYPERFILEVALUE_UINT32

Integer.

HYPERFILEVALUE_INT64

Integer.

HYPERFILEVALUE_UINT64

Integer.

HYPERFILEVALUE_FLOAT

Float.

HYPERFILEVALUE_FLOAT32

Float.

HYPERFILEVALUE_FLOAT64

Float.

HYPERFILEVALUE_TIME

BaseTime.

HYPERFILEVALUE_VECTOR

Vector.

HYPERFILEVALUE_VECTOR32

Vector.

HYPERFILEVALUE_VECTOR64

Vector.

HYPERFILEVALUE_MATRIX

Matrix.

HYPERFILEVALUE_MATRIX32

Matrix.

HYPERFILEVALUE_MATRIX64

Matrix.

HYPERFILEVALUE_MEMORY

Memory.

HYPERFILEVALUE_IMAGE

Image.

HYPERFILEVALUE_STRING

String.

HYPERFILEVALUE_FILENAME

String.

HYPERFILEVALUE_CONTAINER

BaseContainer.

HYPERFILEVALUE_ALIASLINK

BaseList2D.

HyperFile.SkipValue(self, h)

Skip a given type of value.

Parameters

h (int) –

The hyper file value to skip:

HYPERFILEVALUE_NONE

None.

HYPERFILEVALUE_START

Marks the start of a chunk.

HYPERFILEVALUE_STOP

Marks the end of a chunk.

HYPERFILEVALUE_CSTOP

Marks the end of a container. Internal.

HYPERFILEVALUE_CHAR

Integer.

HYPERFILEVALUE_UCHAR

Integer.

HYPERFILEVALUE_INT16

Integer.

HYPERFILEVALUE_UINT16

Integer.

HYPERFILEVALUE_INT32

Integer.

HYPERFILEVALUE_UINT32

Integer.

HYPERFILEVALUE_INT64

Integer.

HYPERFILEVALUE_UINT64

Integer.

HYPERFILEVALUE_FLOAT

Float.

HYPERFILEVALUE_FLOAT32

Float.

HYPERFILEVALUE_FLOAT64

Float.

HYPERFILEVALUE_TIME

BaseTime.

HYPERFILEVALUE_VECTOR

Vector.

HYPERFILEVALUE_VECTOR32

Vector.

HYPERFILEVALUE_VECTOR64

Vector.

HYPERFILEVALUE_MATRIX

Matrix.

HYPERFILEVALUE_MATRIX32

Matrix.

HYPERFILEVALUE_MATRIX64

Matrix.

HYPERFILEVALUE_MEMORY

Memory.

HYPERFILEVALUE_IMAGE

Image.

HYPERFILEVALUE_STRING

String.

HYPERFILEVALUE_FILENAME

String.

HYPERFILEVALUE_CONTAINER

BaseContainer.

HYPERFILEVALUE_ALIASLINK

BaseList2D.

Return type

bool

Returns

True if the value was of the given header type and it was skipped, otherwise False.

HyperFile.WriteChunkStart(self, id, level)

Write a chunk marker into the file indicating the beginning of a new chunk of data.

Note

Chunks should only be used if absolutely necessary.
If a plugin uses chunks badly then the file structure can become corrupted.
Parameters
  • id (int) – The ID for the chunk.

  • level (int) – If you want to write additional information you can increase the level this allows you to easily save/read new values.

Return type

bool

Returns

Success of writing the chunk identification.

HyperFile.WriteChunkEnd(self)

Write a chunk ending marker into the file.

Return type

bool

Returns

Success of writing the chunk end.

HyperFile.ReadChunkStart(self)

Read a chunks identification from the file.

import c4d



hf = c4d.storage.HyperFile()



chunk = hf.ReadChunkStart()

if chunk is None:

    return



id = chunk["id"]  # Chunk ID, int

level = chunk["level"]  # Chunk Level, int

Return type

dict{id: int, level: int}

Returns

The identification or None on failure.

HyperFile.ReadChunkEnd(self)

Read a chunks end marker from the file.

Return type

bool

Returns

Success of reading the chunk end.

HyperFile.SkipToEndChunk(self)

Move the file pointer to the end of the chunk.

Note

This should always be called after finishing reading your values from this chunk.

Return type

bool

Returns

Success of finding the end of the chunk.

HyperFile.GetDocument(self)

Gets the active document for the hyper file operation.

Note

Can be None, for example when saving layouts.

Return type

c4d.documents.BaseDocument

Returns

The document or None.

HyperFile.GetFileVersion(self)

Get the version of Cinema 4D that wrote the file.

Note

Only valid during reading a Cinema 4D scene, object, material etc.

Return type

int

Returns

The file version.

HyperFile.GetFilterFlags(self)

Gets the filter flags, the value is valid only during a Load or a Merge.

New in version R21.108.

Return type

int

Returns

The filter flags:

SCENEFILTER_NONE

None.

SCENEFILTER_OBJECTS

Load/save objects.

SCENEFILTER_MATERIALS

Load/save materials.

SCENEFILTER_DIALOGSALLOWED

Flag to inform a plugin that a dialog can be displayed. If this flag is not set then no dialogs must be opened.

SCENEFILTER_PROGRESSALLOWED

Flag to inform a plugin that a progress bar can be displayed. The progress bar can be set by calling StatusSetBar().

SCENEFILTER_MERGESCENE

Flag to inform a plugin that this is a merge operation, i.e. the document that is inserted to is an existing scene.

SCENEFILTER_NONEWMARKERS

Objects loaded from disk will keep their markers.

SCENEFILTER_SAVECACHES

For melange export only. Caches of objects will also be written (only supported by Cinema 4D format). This is the same as the global option “Save Polygon Objects for Melange Exchange”.

SCENEFILTER_NOUNDO

Use together with SCENEFILTER_MERGESCENE to avoid that undos are created for the merge operation.

SCENEFILTER_SAVE_BINARYCACHE

Save the binary compiled shaders with the scene (only for Cinema 4D format).

SCENEFILTER_IDENTIFY_ONLY

Do not load the whole document, identify it only.

SCENEFILTER_ONLY_RENDERDATA

Only load render settings. If this flag is set, SCENEFILTER_OBJECTS and SCENEFILTER_MATERIALS are ignored.

SCENEFILTER_IGNOREMISSINGPLUGINSINNONACTIVERENDERDATA

Ignore all missing plugins which are part of a non-active render data.

SCENEFILTER_IGNOREXREFS

New in version R16.038: Avoid that included X-Refs will be loaded.

SCENEFILTER_DONTCORRECTOUTPUTFORMAT

Do not change unknown output formats in render settings.