Ejemplo n.º 1
0
 def test_geoms_have_material_dict(self):
     obj_1 = read_wavefront(self.script_dir + "/wavefronts/untitled.obj")
     obj_2 = read_wavefront(self.script_dir + "/wavefronts/two_complete_meshes.obj")
     for geom in obj_1.object_list:
         self.assertTrue(geom.material_name != '')
         self.assertTrue(isinstance(geom.material, Mtl))
         self.assertTrue(geom.material.Kd is not None)
Ejemplo n.º 2
0
 def __init__(self, file_name):
     """
     Reads Wavefront (.obj) files created in Blender to build ratcave.graphics Mesh objects.
     :param file_name: .obj file to read (assumes an accompanying .mtl file has the same base file name.)
     :type file_name: str
     :return:
     :rtype: WavefrontReader
     """
     self.file_name = file_name
     self.bodies = read_wavefront(file_name)
     self.textures = {}
def test_geoms_have_material_dict(fn):
    geoms = read_wavefront(fn)
    for geom in geoms.values():
        assert 'material' in geom
        assert isinstance(geom['material'], dict)
        assert 'Kd' in geom['material']
def test_all_materials_extracted(fn, count):
    geoms = read_wavefront(fn)
    assert len(geoms) == count
Ejemplo n.º 5
0
 def test_all_materials_extracted(self):
     obj_1 = read_wavefront(self.script_dir + "/wavefronts/untitled.obj")
     obj_2 = read_wavefront(self.script_dir + "/wavefronts/two_complete_meshes.obj")
     self.assertTrue(len(obj_1.object_list) == 1)
     self.assertTrue(len(obj_2.object_list) == 2)