Warning
This module is not yet fully implemented, and is certainly not yet useful in its current state.
Bases: pyffi.object_models.xsd.FileFormat
This class implements the DAE format.
Bases: pyffi.object_models.Data
A class to contain the actual collada data.
Get the collada version, as integer (for instance, 1.4.1 would be 0x01040100).
Returns: | The version, as integer. |
---|
Quickly checks whether the stream appears to contain collada data. Resets stream to original position. If the stream turns out to be collada, L{getVersion} is guaranteed to return the version.
Call this function if you simply wish to check that a file is a collada file without having to parse it completely.
Parameters: | stream (file) – The file to inspect. |
---|---|
Returns: | True if stream is collada, False otherwise. |
Read collada data from stream.
Parameters: | stream (file) – The file to read from. |
---|
Write collada data to stream.
Parameters: | stream (file) – The file to write to. |
---|
>>> daedata = DaeFormat.Data()
>>> print(daedata.collada)
<pyffi.formats.dae.Collada object at ...>
>>> # check and read dae file
>>> stream = open('tests/dae/cube.dae', 'rb')
>>> daedata = DaeFormat.Data()
>>> daedata.read(stream)
Traceback (most recent call last):
...
NotImplementedError
>>> # get DAE file root element
>>> #print(daedata.getRootElement())
>>> stream.close()
>>> for stream, data in DaeFormat.walkData('tests/dae'):
... try:
... # the replace call makes the doctest also pass on windows
... print("reading %s" % stream.name.replace("\\", "/"))
... data.read(stream)
... except Exception:
... print("Warning: read failed due corrupt file, corrupt format description, or bug.")
reading tests/dae/cube.dae
Warning: read failed due corrupt file, corrupt format description, or bug.
>>> daedata = DaeFormat.Data()
>>> from tempfile import TemporaryFile
>>> stream = TemporaryFile()
>>> daedata.write(stream)
Traceback (most recent call last):
...
NotImplementedError