diff --git a/xmodel.py b/xmodel.py index 8143a76..465fc1a 100644 --- a/xmodel.py +++ b/xmodel.py @@ -253,6 +253,27 @@ def save(self, file, version, index_offset, vert_tok_suffix=""): vert_tok_suffix=vert_tok_suffix) file.write("\n") + def isValid(self): + ''' + Checks to make sure that the face consists of 3 vertices, + all of which refer to different vertex indices + ''' + if(len(self.indices) != 3): + return False + + indices = [index.vertex for index in self.indices] + + if indices[0] == indices[1]: + return False + + if indices[0] == indices[2]: + return False + + if indices[1] == indices[2]: + return False + + return True + class Material(object): __slots__ = (