def test_export_path(self): m = g.get_mesh('fuze.obj') g.check_fuze(m) with g.TemporaryDirectory() as d: file_path = g.os.path.join(d, 'fz.obj') m.export(file_path) r = g.trimesh.load(file_path) g.check_fuze(r)
def test_fuze(self): # create a local web server to test remote assets with g.serve_meshes() as address: # see if web resolvers work tex = g.trimesh.exchange.load.load_remote(url=address + '/fuze.obj', process=False) g.check_fuze(tex) # see if web + zip resolvers work scene = g.trimesh.exchange.load.load_remote(url=address + '/fuze.zip', process=False) # zip files get loaded into a scene assert len(scene.geometry) == 1 # scene should just be a fuze bottle g.check_fuze(next(iter(scene.geometry.values()))) # obj with texture, assets should be loaded # through a FilePathResolver m = g.get_mesh('fuze.obj', process=False) g.check_fuze(tex) # obj with texture, assets should be loaded # through a ZipResolver into a scene scene = g.get_mesh('fuze.zip', process=False) # zip files get loaded into a scene assert len(scene.geometry) == 1 m = next(iter(scene.geometry.values())) g.check_fuze(m) # the PLY should have textures defined m = g.get_mesh('fuze.ply', process=False) g.check_fuze(m) # ASCII PLY should have textures defined m = g.get_mesh('fuze_ascii.ply', process=False) g.check_fuze(m) # textured meshes should subdivide OK-ish s = m.subdivide() assert len(s.visual.uv) == len(s.vertices) # load without doing the vertex separation # will look like garbage but represents original # and skips "disconnect vertices with different UV" b = g.get_mesh('fuze.ply', process=False, fix_texture=False) assert len(b.vertices) == 502 assert len(b.visual.uv) == 502