Ejemplo n.º 1
0
 def test_import_hetero_empty(self, scene_paths, out_dir, hetero_mesh_path):
     """Test that imports empty mesh when importing heterogeneous mesh with empty handler"""
     mesh = usd.import_meshes(
         hetero_mesh_path, ['/Root'],
         heterogeneous_mesh_handler=usd.heterogeneous_mesh_handler_empty)
     for attr in mesh:
         assert len(attr[0]) == 0
Ejemplo n.º 2
0
def import_kitchen_set(kitchen_set_usd):
    # The Kitchen Set example organizes assets in a particular way. Since we want to import complete objects and not
    # not each separate part of an object, we'll find all the paths that are named :code:`Geom`:
    scene_paths = usd.get_scene_paths(kitchen_set_usd, r'.*/Geom$')

    # The meshes in this dataset have a heterogeneous topology, meaning the number of vertices 
    # for each polygon varies. To deal with those, we'll pass in a handler function that will 
    # homogenize those meshes to homogenous triangle meshes.
    usd_meshes = usd.import_meshes(
        file_path=kitchen_set_usd,
        scene_paths=scene_paths,
        heterogeneous_mesh_handler=usd.heterogeneous_mesh_handler_naive_homogenize
    )
    return usd_meshes
Ejemplo n.º 3
0
 def test_import_hetero_fail(self, scene_paths, out_dir, hetero_mesh_path):
     """Test that import fails when importing heterogeneous mesh without handler"""
     with pytest.raises(usd.NonHomogeneousMeshError):
         usd.import_meshes(hetero_mesh_path, ['/Root'])