def writeShapeKey(fp, name, shape, mesh, config):
    if (len(shape.verts) == 0):
        log.debug(('Shapekey %s has zero verts. Ignored' % name))
        return
    progress = Progress()
    progress(0)
    target = mesh.coord.copy()
    target[:] += config.offset
    target[shape.verts] += shape.data[np.s_[...]]
    target = rotateCoord((config.scale * target), config)
    nVerts = len(target)
    fp.write(((((('    <geometry id="%sMeshMorph_%s" name="%s">\n' % (mesh.name, name, name)) + '      <mesh>\n') + ('        <source id="%sMeshMorph_%s-positions">\n' % (mesh.name, name))) + ('          <float_array id="%sMeshMorph_%s-positions-array" count="%d">\n' % (mesh.name, name, (3 * nVerts)))) + '           '))
    fp.write(''.join([('%.4f %.4f %.4f ' % tuple(co)) for co in target]))
    fp.write(((((((((('\n' + '          </float_array>\n') + '          <technique_common>\n') + ('            <accessor source="#%sMeshMorph_%s-positions-array" count="%d" stride="3">\n' % (mesh.name, name, nVerts))) + '              <param name="X" type="float"/>\n') + '              <param name="Y" type="float"/>\n') + '              <param name="Z" type="float"/>\n') + '            </accessor>\n') + '          </technique_common>\n') + '        </source>\n'))
    progress(0.3)
    nFaces = len(mesh.fvert)
    fp.write((((((('        <vertices id="%sMeshMorph_%s-vertices">\n' % (mesh.name, name)) + ('          <input semantic="POSITION" source="#%sMeshMorph_%s-positions"/>\n' % (mesh.name, name))) + '        </vertices>\n') + ('        <polylist count="%d">\n' % nFaces)) + ('          <input semantic="VERTEX" source="#%sMeshMorph_%s-vertices" offset="0"/>\n' % (mesh.name, name))) + '          <vcount>'))
    fp.write(''.join(['4 ' for fv in mesh.fvert]))
    fp.write((('\n' + '          </vcount>\n') + '          <p>'))
    fp.write(''.join([('%d %d %d %d ' % tuple(fv)) for fv in mesh.fvert]))
    fp.write((((('\n' + '          </p>\n') + '        </polylist>\n') + '      </mesh>\n') + '    </geometry>\n'))
    progress(1)
def writeShapeKey(fp, name, shape, mesh, config):
    if (len(shape.verts) == 0):
        log.debug(('Shapekey %s has zero verts. Ignored' % name))
        return
    progress = Progress()
    progress(0)
    target = mesh.coord.copy()
    target[:] += config.offset
    target[shape.verts] += shape.data[np.s_[...]]
    target = rotateCoord((config.scale * target), config)
    nVerts = len(target)
    fp.write(((((('    <geometry id="%sMeshMorph_%s" name="%s">\n' % (mesh.name, name, name)) + '      <mesh>\n') + ('        <source id="%sMeshMorph_%s-positions">\n' % (mesh.name, name))) + ('          <float_array id="%sMeshMorph_%s-positions-array" count="%d">\n' % (mesh.name, name, (3 * nVerts)))) + '           '))
    fp.write(.join([('%.4f %.4f %.4f ' % tuple(co)) for co in target]))
    fp.write(((((((((('\n' + '          </float_array>\n') + '          <technique_common>\n') + ('            <accessor source="#%sMeshMorph_%s-positions-array" count="%d" stride="3">\n' % (mesh.name, name, nVerts))) + '              <param name="X" type="float"/>\n') + '              <param name="Y" type="float"/>\n') + '              <param name="Z" type="float"/>\n') + '            </accessor>\n') + '          </technique_common>\n') + '        </source>\n'))
    progress(0.3)
    nFaces = len(mesh.fvert)
    fp.write((((((('        <vertices id="%sMeshMorph_%s-vertices">\n' % (mesh.name, name)) + ('          <input semantic="POSITION" source="#%sMeshMorph_%s-positions"/>\n' % (mesh.name, name))) + '        </vertices>\n') + ('        <polylist count="%d">\n' % nFaces)) + ('          <input semantic="VERTEX" source="#%sMeshMorph_%s-vertices" offset="0"/>\n' % (mesh.name, name))) + '          <vcount>'))
    fp.write(.join(['4 ' for fv in mesh.fvert]))
    fp.write((('\n' + '          </vcount>\n') + '          <p>'))
    fp.write(.join([('%d %d %d %d ' % tuple(fv)) for fv in mesh.fvert]))
    fp.write((((('\n' + '          </p>\n') + '        </polylist>\n') + '      </mesh>\n') + '    </geometry>\n'))
    progress(1)