39 def has_header(self): |
39 def has_header(self): |
40 return self.header and not isinstance(self.header, header.BadHeader) |
40 return self.header and not isinstance(self.header, header.BadHeader) |
41 def find_first_header_object(self, object_type): |
41 def find_first_header_object(self, object_type): |
42 return self.find_header_object(object_type, 0) |
42 return self.find_header_object(object_type, 0) |
43 def find_header_object(self, object_type, n): |
43 def find_header_object(self, object_type, n): |
44 return self.body[self.header.occurrences[object_type][n]] |
44 try: |
|
45 return self.body[self.header.occurrences[object_type][n]] |
|
46 except IndexError: |
|
47 raise KeyError(str.format( |
|
48 '{type} not found in header', |
|
49 type = object_type |
|
50 )) |
45 |
51 |
46 def model_vertices( |
52 def model_vertices( |
47 model, |
53 model, |
48 transformation_matrix = None, |
54 transformation_matrix = None, |
49 file_cache = None, |
55 file_cache = None, |