예제 #1
0
def exportProxy24(obj, plist, fp):
    proxy = mh2proxy.readProxyFile(obj, plist, True)
    if not proxy:
        return
    faces = mh2proxy.oldStyleFaces(obj)
    tmpl = open("shared/mhx/templates/proxy24.mhx", "rU")
    for line in tmpl:
        words = line.split()
        if len(words) == 0:
            fp.write(line)
        elif words[0] == 'mesh':
            fp.write("mesh %s %s\n" % (proxy.name, proxy.name))
        elif words[0] == 'object':
            fp.write("object %s Mesh %s\n" % (proxy.name, proxy.name))
        elif words[0] == 'v':
            for bary in proxy.realVerts:
                (x, y, z) = mh2proxy.proxyCoord(bary)
                fp.write("v %.4g %.4g %.4g ;\n" % (x, -z, y))
        elif words[0] == 'f':
            for (f, g) in proxy.faces:
                fp.write("    f")
                for v in f:
                    fp.write(" %d" % v)
                fp.write(" ;\n")
            fn = 0
            for mat in proxy.materials:
                fp.write("    fx %d %d 1 ;\n" % (fn, mat))
                fn += 1
        elif words[0] == 'vt':
            for f in proxy.texFaces:
                fp.write("    vt")
                for v in f:
                    uv = proxy.texVerts[v]
                    fp.write(" %.4g %.4g" % (uv[0], uv[1]))
                fp.write(" ;\n")
        elif words[0] == 'vertgroup':
            copyVertGroups("shared/mhx/templates/vertexgroups-24.mhx", fp,
                           proxy)
        elif words[0] == 'shapekey':
            fp.write("  ShapeKey Basis Sym\n  end ShapeKey\n")
            copyShapeKeys("shared/mhx/templates/shapekeys-bodylanguage25.mhx",
                          fp, proxy, False)
            copyShapeKeys("shared/mhx/templates/shapekeys-extra24.mhx", fp,
                          proxy, False)
            copyShapeKeys("shared/mhx/templates/shapekeys-body25.mhx", fp,
                          proxy, False)
            writeIpo(fp)
        else:
            fp.write(line)
    tmpl.close()
    return
예제 #2
0
def exportRawData(obj, fp):
    for v in obj.verts:
        fp.write("v %.4g %.4g %.4g ;\n" % (v.co[0], v.co[1], v.co[2]))

    for uv in obj.texco:
        fp.write("vt %.4g %.4g ;\n" % (uv[0], uv[1]))

    faces = mh2proxy.oldStyleFaces(obj)
    for f in faces:
        fp.write("f")
        #print(f)
        for v in f:
            fp.write(" %i/%i " % (v[0], v[1]))
        fp.write(";\n")