From b892c01a99bbbd932a9e1fb9f6c71dc79b71fb60 Mon Sep 17 00:00:00 2001 From: SE2Dev Date: Sun, 5 Aug 2018 14:24:16 -0400 Subject: [PATCH 1/2] Add Face.isValid() Added a new function to check if a face is valid --- xmodel.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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__ = ( From 79a9a955e2287a5c89be44c9944099832f1465e2 Mon Sep 17 00:00:00 2001 From: SE2Dev Date: Sun, 5 Aug 2018 14:25:25 -0400 Subject: [PATCH 2/2] Bump Version from 0.2.1 -> 0.3.0 --- __init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index c89cec3..6367179 100644 --- a/__init__.py +++ b/__init__.py @@ -4,4 +4,4 @@ from .xanim import Anim from .sanim import SiegeAnim -version = (0, 2, 1) # Version specifier for PyCoD +version = (0, 3, 0) # Version specifier for PyCoD