Example #1
0
def write_collada_scene(world,
                        dae_filename,
                        scale=1,
                        options=None,
                        flat=False,
                        color_generator=None):
    """
    """
    assert isinstance(world, World)
    if flat:
        name_all_elements(world.getbodies(), True)
    else:
        nonflatlist = [j.frames[1] for j in world.getjoints()]
        name_all_elements(nonflatlist, True)
    name_all_elements(world.itermovingsubframes(), True)

    if color_generator is None:
        color_generator = ColorGenerator(nb_colors=len(world.getbodies()))

    world.update_geometric()

    drawer = Drawer(pydaenimColladaDriver(dae_filename, scale, options), flat,
                    color_generator)
    world.parse(drawer)
    drawer.finish()
Example #2
0
def write_collada_scene(world, dae_filename, scale=1, options=None, flat=False, color_generator=None):
    """Write a visual description of the scene in a collada file.

    :param world: the world to convert
    :type world: :class:`arboris.core.World` instance
    :param dae_filename: path of the output collada scene file
    :type dae_filename: str
    :param scale: the scale of the world
    :type scale: float
    :param options: the options to set the world drawing
    :type options: dict
    :param flat: if True, each body is a child of the ground. Otherwise
                 the hierarchy is copied from arboris
    :type flat: bool

    """
    assert isinstance(world, World)
    if flat:
        name_all_elements(world.getbodies(), True)
    else:
        nonflatlist = [j.frames[1] for j in world.getjoints()]
        name_all_elements(nonflatlist, True)
    name_all_elements(world.itermovingsubframes(), True)
    
    if color_generator is None:
        color_generator = ColorGenerator( nb_colors=len(world.getbodies()) )
    
    world.update_geometric()
    
    drawer = Drawer(DaenimColladaDriver(dae_filename, scale, options), flat, color_generator)
    world.parse(drawer)
    drawer.finish()
Example #3
0
def write_collada_scene(world, dae_filename, scale=1, options=None, flat=False, color_generator=None):
    """
    """
    assert isinstance(world, World)
    if flat:
        name_all_elements(world.getbodies(), True)
    else:
        nonflatlist = [j.frames[1] for j in world.getjoints()]
        name_all_elements(nonflatlist, True)
    name_all_elements(world.itermovingsubframes(), True)

    if color_generator is None:
        color_generator = ColorGenerator(nb_colors=len(world.getbodies()))

    world.update_geometric()

    drawer = Drawer(pydaenimColladaDriver(dae_filename, scale, options), flat, color_generator)
    world.parse(drawer)
    drawer.finish()
Example #4
0
def write_collada_scene(world,
                        dae_filename,
                        scale=1,
                        options=None,
                        flat=False,
                        color_generator=None):
    """Write a visual description of the scene in a collada file.

    :param world: the world to convert
    :type world: :class:`arboris.core.World` instance
    :param dae_filename: path of the output collada scene file
    :type dae_filename: str
    :param scale: the scale of the world
    :type scale: float
    :param options: the options to set the world drawing
    :type options: dict
    :param flat: if True, each body is a child of the ground. Otherwise
                 the hierarchy is copied from arboris
    :type flat: bool

    """
    assert isinstance(world, World)
    if flat:
        name_all_elements(world.getbodies(), True)
    else:
        nonflatlist = [j.frames[1] for j in world.getjoints()]
        name_all_elements(nonflatlist, True)
    name_all_elements(world.itermovingsubframes(), True)

    if color_generator is None:
        color_generator = ColorGenerator(nb_colors=len(world.getbodies()))

    world.update_geometric()

    drawer = Drawer(DaenimColladaDriver(dae_filename, scale, options), flat,
                    color_generator)
    world.parse(drawer)
    drawer.finish()