Skip to content

Commit

Permalink
Add Face.isValid()
Browse files Browse the repository at this point in the history
Added a new function to check if a face is valid
  • Loading branch information
SE2Dev committed Aug 5, 2018
1 parent 6dbcb43 commit b892c01
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions xmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = (
Expand Down

0 comments on commit b892c01

Please sign in to comment.