4.21. mayabinary — Reading Maya Binary files

This module contains the MBReader class which can be used as a base class for reading Maya Binary (*.mb) files. The class parses the structure of the file and invokes a callback method for every chunk found in the file. The actual decoding of the chunk data has to be done in a derived class.

4.21.1. MBReader class

The MBReader class reads Maya Binary files and calls appropriate methods which have to be implemented in a derived class. A Maya Binary file is composed of chunks that contain the actual data. There can be data chunks that contain the actual data and group chunks that contain the data chunks.

class cgkit.mayabinary.MBReader

Creates an instance of the reader.

The class is derived from the IFFReader class (defined in the mayaiff module).

MBReader.filename

The file name (if it could be obtained). This may be used for generating warning or error messages.

MBReader.read(file)

Read the content of a file. file is either a file like object that can be used to read the content of the file or the name of a file.

MBReader.abort()

Aborts reading the current file. This method can be called in handler methods to abort reading the file.

MBReader.onBeginGroup(chunk)

Callback that is called whenever a new group tag begins. chunk is a GroupChunk object containing information about the group chunk.

MBReader.onEndGroup(chunk)

Callback that is called whenever a group goes out of scope. chunk is a GroupChunk object containing information about the group chunk (it is the same instance that was passed to onBeginGroup()).

MBReader.onDataChunk(chunk)

Callback that is called for each data chunk. chunk is a Chunk object that contains information about the chunk and that can be used to read the actual chunk data.

Table Of Contents

Previous topic

4.20. mayaascii — Reading Maya ASCII files

Next topic

4.22. mayaiff — Reading Maya IFF files

This Page