underworlds.tools package

Submodules

underworlds.tools.loader module

class underworlds.tools.loader.ModelLoader
fill_node_details(assimp_node, underworlds_node, assimp_model, custom_root=None, scale=1.0)
load(filename, ctx=None, world='base', root=None, only_meshes=False, scale=1.0)

Loads a Collada (or any Assimp compatible model) file in the world.

The kinematic chains are added to the world’s geometric state. The meshes are added to the meshes repository.

A new ‘load’ event is also added in the world timeline.

Parameters:
  • path (string) – the path (relative or absolute) to the Collada resource
  • ctx (Context) – an existing underworlds context. If not provided, a new one is created (named ‘model loader’)
  • world (string) – the target world for the creation of nodes
  • root (Node) – if given, the loaded nodes will be parented to this node instead of the scene’s root.
  • only_meshes (bool) – if true, no node is created. Only the

meshes are pushed to the server. :param float scale : scale of the model :returns: the list of loaded underworlds nodes.

load_meshes(filename, ctx=None, scale=1.0)

Pushes meshes from any Assimp-compatible 3D model to the server’s mesh repository.

A new ‘load’ event is also added in the world timeline.

Parameters:
  • path (string) – the path (relative or absolute) to the 3D model
  • ctx (Context) – an existing underworlds context. If not provided, a new one is created (named ‘model loader’)

:param float scale : scale of the model :returns: a dictionary {mesh name: mesh ID}

See:load loads the meshes and creates corresponding nodes.
node_boundingbox(node)

Returns the AABB bounding box of an ASSIMP node. Be careful: this is the untransformed bounding box, ie, the bounding box of the mesh in the node frame.

recur_node(assimp_node, model, level=0)

Module contents