def copyMeshFile249(obj, tmpl, fp):
    inZone = False
    skip = False
    mainMesh = False

    for line in tmpl:
        words= line.split()
        skipOne = False

        if len(words) == 0:
            pass
        elif words[0] == 'end':
            if words[1] == 'object' and mainMesh:
                fp.write(line)
                skipOne = True
                fp.write("#endif\n")
                mainMesh = False
                fp.write("#if useProxy\n")
                for plist in the.Config.proxyList:
                    if plist.useMhx:
                        exportProxy24(obj, plist, fp)
                fp.write("#endif\n")
            elif words[1] == 'mesh' and mainMesh:
                fp.write("  ShapeKey Basis Sym\n  end ShapeKey\n")
                copyShapeKeys("shared/mhx/templates/shapekeys-facial25.mhx", fp, None, False)    
                copyShapeKeys("shared/mhx/templates/shapekeys-extra24.mhx", fp, None, False)    
                copyShapeKeys("shared/mhx/templates/shapekeys-body25.mhx", fp, None, False)    
                writeIpo(fp)
                fp.write(line)
                skipOne = True
                fp.write("#endif\n")
                mainMesh = False
                inZone = False
                skip = False
        elif words[0] == 'mesh' and words[1] == 'HumanMesh':
            inZone = True
            mainMesh = True
            fp.write("#if useMesh\n")
        elif words[0] == 'object' and words[1] == '%sMesh' % the.Human:
            mainMesh = True
            fp.write("#if useMesh\n")
        elif words[0] == 'vertgroup':
            mhx_main.copyVertGroups("shared/mhx/templates/vertexgroups-24.mhx", fp, None)    
            skipOne = True
            skip = False
        elif words[0] == 'v' and inZone:
            if not skip:
                exportRawData(obj, fp)
                skip = True
        elif words[0] == 'f' and skip:
            skip = False
            skipOne = True

        if not (skip or skipOne):
            fp.write(line)
    
    return
def exportProxy24(obj, plist, fp):
    proxy = mh2proxy.readProxyFile(obj, plist, True)
    if not proxy:
        return
    faces = mhx_main.loadFacesIndices(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 %.6g %.6g %.6g ;\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(" %.6g %.6g" %(uv[0], uv[1]))
                fp.write(" ;\n")
        elif words[0] == 'vertgroup':
            mhx_main.copyVertGroups("shared/mhx/templates/vertexgroups-24.mhx", fp, proxy)    
        elif words[0] == 'shapekey':
            fp.write("  ShapeKey Basis Sym\n  end ShapeKey\n")
            if mhx_main.BODY_LANGUAGE:
                copyShapeKeys("shared/mhx/templates/shapekeys-bodylanguage25.mhx", fp, proxy, False)    
            else:
                copyShapeKeys("shared/mhx/templates/shapekeys-facial25.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