def _FixBoneLength(self):
for childBone in self.children:
if (self._bone is not None) and (self._bone.parent.fget() is not None):
mt = mathutils.Matrix.Translation(mathutils.Vector((self.f.t.x, self.f.t.y, self.f.t.z)))
mx = mathutils.Matrix.Rotation(self.f.rx, 4, 'X')
my = mathutils.Matrix.Rotation(self.f.ry, 4, 'Y')
mz = mathutils.Matrix.Rotation(self.f.rz, 4, 'Z')
parentVec = vect_normalize((self._bone.position)*self._bone.transform.inverted() -
(self._bone.parent.fget().position)*self._bone.parent.fget().transform.inverted())
mTransform = (mx * my * mz * mt)
boneVec2 = vect_normalize((vect_normalize(self._bone.dir)) * mTransform)
print(str(parentVec) + ":" + str(boneVec2))
childBone._FixBoneLength()
评论列表
文章目录