Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def parseG1MS(currentPosition,bs):
- jointDataOffset = bs.read('I')[0]
- conditionNumber = bs.read('H')[0]
- bs.read('H')[0] #unknown
- jointCount = bs.read('H')[0]
- jointIndicesCount = bs.read('H')[0]
- bs.read('I') #unknown, last UShort always at 0 ?
- if(debug):
- print("Skeleton with " + str(jointCount) + " bones and " + str(jointIndicesCount) + " indices")
- if(conditionNumber != 0):
- bs.seek(currentPosition + jointDataOffset)
- for i in range(jointCount):
- #read data
- bs.read('3f') #scale
- parentID=bs.read('i')[0]
- quaternionRotation=bs.read('4f')
- position=bs.read('3f')
- bs.read('f')
- #prepare bone transform
- boneMatrixTransform=NoeQuat(quaternionRotation).toMat43().inverse()
- boneMatrixTransform[3] = NoeVec3(position)
- #create the bone
- bone = NoeBone(i, 'bone_'+str(i),boneMatrixTransform,None,parentID)
- #add it to the bone list
- boneList.append(bone)
- #space change
- for bone in boneList:
- parentId = bone.parentIndex
- if parentId != -1:
- bone.setMatrix(bone.getMatrix()*boneList[parentId].getMatrix())
- return 1
Add Comment
Please, Sign In to add comment