Пример #1
0
def prettyPrintAnm(filename, start=0, stop=-1, returnStr = True, **options):
    header, animation= lolAnimation.importANM(filename)
    headerStr = ""
    if(options['PRINT_HEADER']):
        headerStr += "filetype:%s\nThree:%d\nmagic:%d\n" % (header['filetype'], 
            header['three'], header['magic'])
        headerStr += "numBones:%d\nnumFrames:%d\nfps:%d\n\n" % (header['numBones'],
                header['numFrames'],header['fps'])


    anmStr = ""
    if(options['PRINT_FRAMES']):
        if stop == -1:
            stop = header['numBones']

        for boneIdx, name in enumerate(animation):
            
            if (boneIdx< start) or (boneIdx>=stop):
                continue
            bone = animation[name] 
            boneType = animation[name]['boneType']
            #for f in range(header['numFrames']):
            for f in range(1):
                anmStr += \
                        "%d\ttype:%d\tname:%s\t\t"%(f, boneType, name)
                anmStr += \
                        "\tpos:(%f,%f,%f)"%(bone['pos'][f][0],bone['pos'][f][1],bone['pos'][f][2])
                anmStr +=\
                        "\tquat:(%f,%f,%f,%f)\n"%(bone['quat'][f][0],bone['quat'][f][1],bone['quat'][f][2],
                                bone['quat'][f][3])
    if returnStr == True:
        return headerStr+anmStr
    else:
        print(headerStr+anmStr)
Пример #2
0
def prettyPrintAnm(filename, start=0, stop=-1, returnStr=True, **options):
    header, animation = lolAnimation.importANM(filename)
    headerStr = ""
    if (options['PRINT_HEADER']):
        headerStr += "filetype:%s\nThree:%d\nmagic:%d\n" % (
            header['filetype'], header['three'], header['magic'])
        headerStr += "numBones:%d\nnumFrames:%d\nfps:%d\n\n" % (
            header['numBones'], header['numFrames'], header['fps'])

    anmStr = ""
    if (options['PRINT_FRAMES']):
        if stop == -1:
            stop = header['numBones']

        for boneIdx, name in enumerate(animation):

            if (boneIdx < start) or (boneIdx >= stop):
                continue
            bone = animation[name]
            boneType = animation[name]['boneType']
            #for f in range(header['numFrames']):
            for f in range(1):
                anmStr += \
                        "%d\ttype:%d\tname:%s\t\t"%(f, boneType, name)
                anmStr += \
                        "\tpos:(%f,%f,%f)"%(bone['pos'][f][0],bone['pos'][f][1],bone['pos'][f][2])
                anmStr +=\
                        "\tquat:(%f,%f,%f,%f)\n"%(bone['quat'][f][0],bone['quat'][f][1],bone['quat'][f][2],
                                bone['quat'][f][3])
    if returnStr == True:
        return headerStr + anmStr
    else:
        print(headerStr + anmStr)
Пример #3
0
import lolAnimation

anmFilename = '/var/tmp/downloads/lol/DATA/Characters/Nasus/Animations/Nasus_Laugh.anm'

animation = lolAnimation.importANM(anmFilename)

for frame in animation:
    print(frame['L_toe'])