def export_collada(mesh, **kwargs):
    '\n    Export a mesh or a list of meshes as a COLLADA .dae file.\n\n    Parameters\n    -----------\n    mesh: Trimesh object or list of Trimesh objects\n        The mesh(es) to export.\n\n    Returns\n    -----------\n    export: str, string of COLLADA format output\n    '
    meshes = mesh
    if (not isinstance(mesh, (list, tuple, set, np.ndarray))):
        meshes = [mesh]
    c = collada.Collada()
    nodes = []
    for (i, m) in enumerate(meshes):
        uv = None
        colors = None
        mat = _unparse_material(None)
        if m.visual.defined:
            if (m.visual.kind == 'texture'):
                mat = _unparse_material(m.visual.material)
                uv = m.visual.uv
            elif (m.visual.kind == 'vertex'):
                colors = (m.visual.vertex_colors / 255.0)[:, :3]
        c.effects.append(mat.effect)
        c.materials.append(mat)
        vertices = collada.source.FloatSource('verts-array', m.vertices.flatten(), ('X', 'Y', 'Z'))
        normals = collada.source.FloatSource('normals-array', m.vertex_normals.flatten(), ('X', 'Y', 'Z'))
        input_list = collada.source.InputList()
        input_list.addInput(0, 'VERTEX', '#verts-array')
        input_list.addInput(1, 'NORMAL', '#normals-array')
        arrays = [vertices, normals]
        if (uv is not None):
            texcoords = collada.source.FloatSource('texcoords-array', uv.flatten(), ('U', 'V'))
            input_list.addInput(2, 'TEXCOORD', '#texcoords-array')
            arrays.append(texcoords)
        if (colors is not None):
            idx = 2
            if uv:
                idx = 3
            colors = collada.source.FloatSource('colors-array', colors.flatten(), ('R', 'G', 'B'))
            input_list.addInput(idx, 'COLOR', '#colors-array')
            arrays.append(colors)
        geom = collada.geometry.Geometry(c, uuid.uuid4().hex, uuid.uuid4().hex, arrays)
        indices = np.repeat(m.faces.flatten(), len(arrays))
        matref = u'material{}'.format(i)
        triset = geom.createTriangleSet(indices, input_list, matref)
        geom.primitives.append(triset)
        c.geometries.append(geom)
        matnode = collada.scene.MaterialNode(matref, mat, inputs=[])
        geomnode = collada.scene.GeometryNode(geom, [matnode])
        node = collada.scene.Node(u'node{}'.format(i), children=[geomnode])
        nodes.append(node)
    scene = collada.scene.Scene('scene', nodes)
    c.scenes.append(scene)
    c.scene = scene
    b = io.BytesIO()
    c.write(b)
    b.seek(0)
    return b.read()
Export a mesh or a list of meshes as a COLLADA .dae file.

Parameters
-----------
mesh: Trimesh object or list of Trimesh objects
    The mesh(es) to export.

Returns
-----------
export: str, string of COLLADA format output
def export_collada(mesh, **kwargs):
    '\n    Export a mesh or a list of meshes as a COLLADA .dae file.\n\n    Parameters\n    -----------\n    mesh: Trimesh object or list of Trimesh objects\n        The mesh(es) to export.\n\n    Returns\n    -----------\n    export: str, string of COLLADA format output\n    '
    meshes = mesh
    if (not isinstance(mesh, (list, tuple, set, np.ndarray))):
        meshes = [mesh]
    c = collada.Collada()
    nodes = []
    for (i, m) in enumerate(meshes):
        uv = None
        colors = None
        mat = _unparse_material(None)
        if m.visual.defined:
            if (m.visual.kind == 'texture'):
                mat = _unparse_material(m.visual.material)
                uv = m.visual.uv
            elif (m.visual.kind == 'vertex'):
                colors = (m.visual.vertex_colors / 255.0)[:, :3]
        c.effects.append(mat.effect)
        c.materials.append(mat)
        vertices = collada.source.FloatSource('verts-array', m.vertices.flatten(), ('X', 'Y', 'Z'))
        normals = collada.source.FloatSource('normals-array', m.vertex_normals.flatten(), ('X', 'Y', 'Z'))
        input_list = collada.source.InputList()
        input_list.addInput(0, 'VERTEX', '#verts-array')
        input_list.addInput(1, 'NORMAL', '#normals-array')
        arrays = [vertices, normals]
        if (uv is not None):
            texcoords = collada.source.FloatSource('texcoords-array', uv.flatten(), ('U', 'V'))
            input_list.addInput(2, 'TEXCOORD', '#texcoords-array')
            arrays.append(texcoords)
        if (colors is not None):
            idx = 2
            if uv:
                idx = 3
            colors = collada.source.FloatSource('colors-array', colors.flatten(), ('R', 'G', 'B'))
            input_list.addInput(idx, 'COLOR', '#colors-array')
            arrays.append(colors)
        geom = collada.geometry.Geometry(c, uuid.uuid4().hex, uuid.uuid4().hex, arrays)
        indices = np.repeat(m.faces.flatten(), len(arrays))
        matref = u'material{}'.format(i)
        triset = geom.createTriangleSet(indices, input_list, matref)
        geom.primitives.append(triset)
        c.geometries.append(geom)
        matnode = collada.scene.MaterialNode(matref, mat, inputs=[])
        geomnode = collada.scene.GeometryNode(geom, [matnode])
        node = collada.scene.Node(u'node{}'.format(i), children=[geomnode])
        nodes.append(node)
    scene = collada.scene.Scene('scene', nodes)
    c.scenes.append(scene)
    c.scene = scene
    b = io.BytesIO()
    c.write(b)
    b.seek(0)
    return b.read()