def construct(self, mesh): header = mesh["properties"] faces = mesh["faces"] vertices = mesh["mesh"] self.Header.construct(header) self.Header.blockSize = len(Mod3Vertex(self.Header.blocktype)) self.Faces = [Mod3Face() for _ in faces] for modface, blenface in zip(self.Faces, faces): modface.construct(blenface) self.Vertices = [Mod3Vertex(self.Header.blocktype) for _ in vertices] for modvert, blenvert in zip(self.Vertices,vertices): modvert.construct(blenvert)
def marshall(self, data): self.Header.marshall(data) position = data.tell() data.seek((self.vertexOffset+self.Header.vertexOffset)+(self.Header.blockSize*(self.Header.vertexSub+self.Header.vertexBase))) self.Vertices = [Mod3Vertex(self.Header.blocktype) for _ in range(self.Header.vertexCount)] for vert in self.Vertices: vert.marshall(data) self.Faces = [Mod3Face() for _ in range(self.Header.faceCount//3)] data.seek(self.faceOffset+self.Header.faceOffset*2) for face in self.Faces: face.marshall(data) data.seek(position)