Previous topic

collada

Next topic

collada.DaeBrokenRefError

This Page

collada.Collada

class collada.Collada(filename=None, ignore=None, aux_file_loader=None, zip_filename=None)

Bases: object

This is the main class used to create and load collada documents

__init__(filename=None, ignore=None, aux_file_loader=None, zip_filename=None)

Load collada data from filename or file like object.

Parameters:
  • filename – String containing path to filename to open or file-like object. Uncompressed .dae files are supported, as well as zip file archives. If this is set to None, a new collada instance is created.
  • ignore (list) – A list of collada.DaeError types that should be ignored when loading the collada document. Instances of these types will be added to errors after loading but won’t be raised. Only used if filename is not None.
  • aux_file_loader (function) – Referenced files (e.g. texture images) are loaded from disk when reading from the local filesystem and from the zip archive when loading from a zip file. If these files are coming from another source (e.g. database) and/or you’re loading with StringIO, set this to a function that given a filename, returns the binary data in the file. If filename is None, you must set this parameter if you want to load auxiliary files.
  • zip_filename (str) – If the file being loaded is a zip archive, you can set this parameter to indicate the file within the archive that should be loaded. If not set, a file that ends with .dae will be searched.

Methods

__init__([filename, ignore, ...]) Load collada data from filename or file like object.
handleError(error)
ignoreErrors(*args) Add exceptions to the mask for ignoring or clear the mask if None given.
save() Saves the collada document back to xmlnode
geometries

A list of collada.geometry.Geometry objects. Can also be indexed by id

controllers

A list of collada.controller.Controller objects. Can also be indexed by id

animations

A list of collada.animation.Animation objects. Can also be indexed by id

lights

A list of collada.light.Light objects. Can also be indexed by id

cameras

A list of collada.camera.Camera objects. Can also be indexed by id

images

A list of collada.material.CImage objects. Can also be indexed by id

effects

A list of collada.material.Effect objects. Can also be indexed by id

materials

A list of collada.material.Effect objects. Can also be indexed by id

nodes

A list of collada.scene.Node objects. Can also be indexed by id

scenes

A list of collada.scene.Scene objects. Can also be indexed by id

errors

List of collada.DaeError objects representing errors encounterd while loading collada file

scene

The default scene. This is either an instance of collada.scene.Scene or None.

assetInfo

Instance of collada.asset.Asset containing asset information

xmlnode

ElementTree representation of the collada document

ignoreErrors(*args)

Add exceptions to the mask for ignoring or clear the mask if None given.

You call c.ignoreErrors(e1, e2, ... ) if you want the loader to ignore those exceptions and continue loading whatever it can. If you want to empty the mask so all exceptions abort the load just call c.ignoreErrors(None).

save()

Saves the collada document back to xmlnode

write(file)

Writes out the collada document to a file. Note that this also calls save() so avoid calling both methods to save performance.

Parameters:file – Either the file name to write to or a file-like object