From c45c8d758a599ba2febde832f88470044d67decb Mon Sep 17 00:00:00 2001 From: _ <_> Date: Sun, 13 May 2018 09:54:57 -0700 Subject: [PATCH] Added getuvs() --- bindings/py3devil1.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bindings/py3devil1.py b/bindings/py3devil1.py index 127c2bf..9a14667 100755 --- a/bindings/py3devil1.py +++ b/bindings/py3devil1.py @@ -140,6 +140,9 @@ class UVs(ctypes.Structure): ("v", ctypes.c_short) ] + def __str__(self): + return "(%s, %s)" % (str(self.u), str(self.v)) + class BoneIndexes(ctypes.Structure): _pack_ = 1 _fields_ = [ @@ -372,6 +375,10 @@ class MEsh: length = self.cstruct.b.contents.bd.contents.numVertex return self.cstruct.b.contents.vd.normals[:length] + def getuvs(self): + length = self.cstruct.b.contents.bd.contents.numVertex + return self.cstruct.b.contents.vd.u[:length] + #--------------------------------------+ # Regular Python #--------------------------------------+ @@ -460,11 +467,17 @@ if __name__ == "__main__": m = MEsh(0, data) m.show() p = m.getpositions() + print("positions:") for point in p: print(point) n = m.getnormals() + print("normals:") for point in n: print(point) + u = m.getuvs() + print("uvs:") + for point in u: + print(point) #---------------------------------------+ # main() mainx()