Esempio n. 1
0
    def save(self, **kwargs):
        self.ctm.addAttrib(self.aux, "auxdat")
        self.ctm.addAttrib(self.mni, "mnicoords")
        self.ctm.save(**kwargs)

        ctm = CTMfile(self.tf.name)
        return ctm.getMesh(), self.tf.read()
Esempio n. 2
0
def read_pack(ctmfile):
    fname = os.path.splitext(ctmfile)[0]
    jsfile = json.load(open(fname + ".json"))
    offset = jsfile["offsets"]

    meshes = []

    with open(ctmfile, "r") as ctmfp:
        ctmfp.seek(0, 2)
        offset.append(ctmfp.tell())

        for start, end in zip(offset[:-1], offset[1:]):
            ctmfp.seek(start)
            tf = tempfile.NamedTemporaryFile()
            tf.write(ctmfp.read(end - start))
            tf.seek(0)
            ctm = CTMfile(tf.name, "r")
            pts, polys, norms = ctm.getMesh()
            meshes.append((pts, polys))
    return meshes
Esempio n. 3
0
def read_pack(ctmfile):
    fname = os.path.splitext(ctmfile)[0]
    jsfile = json.load(open(fname + ".json"))
    offset = jsfile['offsets']

    meshes = []

    with open(ctmfile, 'r') as ctmfp:
        ctmfp.seek(0, 2)
        offset.append(ctmfp.tell())

        for start, end in zip(offset[:-1], offset[1:]):
            ctmfp.seek(start)
            tf = tempfile.NamedTemporaryFile()
            tf.write(ctmfp.read(end - start))
            tf.seek(0)
            ctm = CTMfile(tf.name, "r")
            pts, polys, norms = ctm.getMesh()
            meshes.append((pts, polys))

    return meshes
Esempio n. 4
0
    def save(self, **kwargs):
        self.ctm.addAttrib(self.aux, 'auxdat')
        self.ctm.save(**kwargs)

        ctm = CTMfile(self.tf.name)
        return ctm.getMesh(), self.tf.read()
Esempio n. 5
0
    def save(self, **kwargs):
        self.ctm.addAttrib(self.aux, 'auxdat')
        self.ctm.save(**kwargs)

        ctm = CTMfile(self.tf.name)
        return ctm.getMesh(), self.tf.read()