Guest User

Untitled

a guest
Dec 20th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. def parseG1MS(currentPosition,bs):
  2. jointDataOffset = bs.read('I')[0]
  3. conditionNumber = bs.read('H')[0]
  4. bs.read('H')[0] #unknown
  5. jointCount = bs.read('H')[0]
  6. jointIndicesCount = bs.read('H')[0]
  7. bs.read('I') #unknown, last UShort always at 0 ?
  8. if(debug):
  9. print("Skeleton with " + str(jointCount) + " bones and " + str(jointIndicesCount) + " indices")
  10.  
  11. if(conditionNumber != 0):
  12. bs.seek(currentPosition + jointDataOffset)
  13. for i in range(jointCount):
  14. #read data
  15. bs.read('3f') #scale
  16. parentID=bs.read('i')[0]
  17. quaternionRotation=bs.read('4f')
  18. position=bs.read('3f')
  19. bs.read('f')
  20. #prepare bone transform
  21. boneMatrixTransform=NoeQuat(quaternionRotation).toMat43().inverse()
  22. boneMatrixTransform[3] = NoeVec3(position)
  23. #create the bone
  24. bone = NoeBone(i, 'bone_'+str(i),boneMatrixTransform,None,parentID)
  25. #add it to the bone list
  26. boneList.append(bone)
  27. #space change
  28. for bone in boneList:
  29. parentId = bone.parentIndex
  30. if parentId != -1:
  31. bone.setMatrix(bone.getMatrix()*boneList[parentId].getMatrix())
  32. return 1
Add Comment
Please, Sign In to add comment