Example #1
0
def readUvVert(file):
    line = ascii_ops.readline(file)
    values = ascii_ops.splitValues(line)
    x = (ascii_ops.getFloat(values[0]))  # X pos
    y = (ascii_ops.getFloat(values[1]))  # Y pos
    coords = [x, y]
    return coords
def readUvVert(file):
    line = ascii_ops.readline(file)
    values = ascii_ops.splitValues(line)
    x = (ascii_ops.getFloat(values[0]))  # X pos
    y = (ascii_ops.getFloat(values[1]))  # Y pos
    coords = [x, y]
    return coords
def readXYZ(file):
    line = ascii_ops.readline(file)
    values = ascii_ops.splitValues(line)
    x = (ascii_ops.getFloat(values[0]))  # X pos
    y = (ascii_ops.getFloat(values[1]))  # Y pos
    z = (ascii_ops.getFloat(values[2]))  # Z pos
    coords = [x, y, z]
    return coords
Example #4
0
def readXYZ(file):
    line = ascii_ops.readline(file)
    values = ascii_ops.splitValues(line)
    x = (ascii_ops.getFloat(values[0]))  # X pos
    y = (ascii_ops.getFloat(values[1]))  # Y pos
    z = (ascii_ops.getFloat(values[2]))  # Z pos
    coords = [x, y, z]
    return coords
def read4Float(file):
    line = ascii_ops.readline(file)
    values = ascii_ops.splitValues(line)
    values = fillArray(values, 4, 0)
    x = (ascii_ops.getFloat(values[0]))
    y = (ascii_ops.getFloat(values[1]))
    z = (ascii_ops.getFloat(values[2]))
    w = (ascii_ops.getFloat(values[3]))
    coords = [x, y, z, w]
    return coords
Example #6
0
def read4Float(file):
    line = ascii_ops.readline(file)
    values = ascii_ops.splitValues(line)
    values = fillArray(values, 4, 0)
    x = (ascii_ops.getFloat(values[0]))
    y = (ascii_ops.getFloat(values[1]))
    z = (ascii_ops.getFloat(values[2]))
    w = (ascii_ops.getFloat(values[3]))
    coords = [x, y, z, w]
    return coords
def poseData(string):
    poseData = {}
    poseList = string.split('\n')
    for bonePose in poseList:
        if bonePose:
            pose = bonePose.split(':')

            boneName = pose[0]
            dataList = fillArray(pose[1].split(), 9, 1)
            rotDelta = Vector((
                ascii_ops.getFloat(dataList[0]),
                ascii_ops.getFloat(dataList[1]),
                ascii_ops.getFloat(dataList[2])))
            coordDelta = Vector((
                ascii_ops.getFloat(dataList[3]),
                ascii_ops.getFloat(dataList[4]),
                ascii_ops.getFloat(dataList[5])))
            scale = Vector((
                ascii_ops.getFloat(dataList[6]),
                ascii_ops.getFloat(dataList[7]),
                ascii_ops.getFloat(dataList[8])))

            bonePose = xps_types.XpsBonePose(
                boneName, coordDelta, rotDelta, scale)
            poseData[boneName] = bonePose
    return poseData
Example #8
0
def poseData(string):
    poseData = {}
    poseList = string.split('\n')
    for bonePose in poseList:
        if bonePose:
            pose = bonePose.split(':')

            boneName = pose[0]
            dataList = fillArray(pose[1].split(), 9, 1)
            rotDelta = Vector((
                ascii_ops.getFloat(dataList[0]),
                ascii_ops.getFloat(dataList[1]),
                ascii_ops.getFloat(dataList[2])))
            coordDelta = Vector((
                ascii_ops.getFloat(dataList[3]),
                ascii_ops.getFloat(dataList[4]),
                ascii_ops.getFloat(dataList[5])))
            scale = Vector((
                ascii_ops.getFloat(dataList[6]),
                ascii_ops.getFloat(dataList[7]),
                ascii_ops.getFloat(dataList[8])))

            bonePose = xps_types.XpsBonePose(
                boneName, coordDelta, rotDelta, scale)
            poseData[boneName] = bonePose
    return poseData
Example #9
0
def makeRenderType(meshFullName):
    mat = meshFullName.split("_")
    maxLen = 8
    # Complete the array with None
    mat = mat + [None] * (maxLen - len(mat))

    renderType = RenderType()

    renderGroupNum = 7
    meshName = 'mesh'
    specularity = 1
    texRepeater1 = 0
    texRepeater2 = 0

    renderGroupFloat = ascii_ops.getFloat(mat[0])
    # meshName = mat[1]
    # specularityFloat = ascii_ops.getFloat(mat[2])
    # texRepeater1Float = ascii_ops.getFloat(mat[3])
    # texRepeater2Float = ascii_ops.getFloat(mat[4])

    if math.isnan(renderGroupFloat):
        renderGroupNum = 6
        meshName = mat[0]
        specularityFloat = ascii_ops.getFloat(mat[1])
        texRepeater1Float = ascii_ops.getFloat(mat[2])
        texRepeater2Float = ascii_ops.getFloat(mat[3])
    else:
        renderGroupNum = int(renderGroupFloat)
        meshName = mat[1]
        specularityFloat = ascii_ops.getFloat(mat[2])
        texRepeater1Float = ascii_ops.getFloat(mat[3])
        texRepeater2Float = ascii_ops.getFloat(mat[4])

    if specularityFloat and not math.isnan(specularityFloat):
        specularity = specularityFloat
    if texRepeater1Float and not math.isnan(texRepeater1Float):
        texRepeater1 = texRepeater1Float
    if texRepeater2Float and not math.isnan(texRepeater2Float):
        texRepeater2 = texRepeater2Float
    if mat[5]:
        renderType.val4 = mat[5]

    renderType.renderGroupNum = renderGroupNum
    renderType.meshName = meshName
    renderType.specularity = specularity
    renderType.texRepeater1 = texRepeater1
    renderType.texRepeater2 = texRepeater2

    return renderType
Example #10
0
def makeRenderType(meshFullName):
    mat = meshFullName.split("_")
    maxLen = 8
    # Complete the array with None
    mat = mat + [None] * (maxLen - len(mat))

    renderType = RenderType()

    renderGroupNum = 7
    meshName = 'mesh'
    specularity = 1
    texRepeater1 = 0
    texRepeater2 = 0

    renderGroupFloat = ascii_ops.getFloat(mat[0])
    # meshName = mat[1]
    # specularityFloat = ascii_ops.getFloat(mat[2])
    # texRepeater1Float = ascii_ops.getFloat(mat[3])
    # texRepeater2Float = ascii_ops.getFloat(mat[4])

    if math.isnan(renderGroupFloat):
        renderGroupNum = 6
        meshName = mat[0]
        specularityFloat = ascii_ops.getFloat(mat[1])
        texRepeater1Float = ascii_ops.getFloat(mat[2])
        texRepeater2Float = ascii_ops.getFloat(mat[3])
    else:
        renderGroupNum = int(renderGroupFloat)
        meshName = mat[1]
        specularityFloat = ascii_ops.getFloat(mat[2])
        texRepeater1Float = ascii_ops.getFloat(mat[3])
        texRepeater2Float = ascii_ops.getFloat(mat[4])

    if specularityFloat and not math.isnan(specularityFloat):
        specularity = specularityFloat
    if texRepeater1Float and not math.isnan(texRepeater1Float):
        texRepeater1 = texRepeater1Float
    if texRepeater2Float and not math.isnan(texRepeater2Float):
        texRepeater2 = texRepeater2Float
    if mat[5]:
        renderType.val4 = mat[5]

    renderType.renderGroupNum = renderGroupNum
    renderType.meshName = meshName
    renderType.specularity = specularity
    renderType.texRepeater1 = texRepeater1
    renderType.texRepeater2 = texRepeater2

    return renderType
def readBoneWeight(file):
    line = ascii_ops.readline(file)
    values = ascii_ops.splitValues(line)
    values = fillArray(values, 4, 0)
    weights = [ascii_ops.getFloat(val) for val in values]
    return weights
Example #12
0
def readBoneWeight(file):
    line = ascii_ops.readline(file)
    values = ascii_ops.splitValues(line)
    values = fillArray(values, 4, 0)
    weights = [ascii_ops.getFloat(val) for val in values]
    return weights