Guest User

Untitled

a guest
Nov 23rd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.88 KB | None | 0 0
  1. diff -r 5883d1d37ab8 src/luxrender/export/__init__.py
  2. --- a/src/luxrender/export/__init__.py  Thu Sep 08 21:15:26 2011 -0700
  3. +++ b/src/luxrender/export/__init__.py  Mon Sep 12 23:45:06 2011 +0200
  4. @@ -289,6 +289,42 @@
  5.             next_matrix *= mathutils.Matrix.Scale(anim_scale[2], 4, mathutils.Vector([0,0,1]))
  6.        
  7.         return next_matrix
  8. +   elif obj.parent != None and obj.parent.type == 'ARMATURE' and obj.parent.animation_data.action != None and len(obj.parent.animation_data.action.fcurves)>0:
  9. +       print('**** object_anim_matrix ***')
  10. +       next_frame = scene.frame_current + frame_offset
  11. +      
  12. +       # get the parent bone
  13. +       if obj.parent_type != 'BONE':
  14. +           return False
  15. +      
  16. +       print(obj.matrix_local)
  17. +      
  18. +       bone = obj.parent.pose.bones[obj.parent_bone]
  19. +      
  20. +       anim_location = bone.location.copy()
  21. +       anim_rotation = bone.rotation_euler.copy()
  22. +       anim_scale    = bone.scale.copy()
  23. +      
  24. +       for fc in obj.parent.animation_data.action.fcurves:
  25. +           if fc.data_path.endswith('location'):
  26. +               anim_location[fc.array_index] = fc.evaluate(next_frame)
  27. +           if fc.data_path.endswith('rotation_euler'):
  28. +               anim_rotation[fc.array_index] = fc.evaluate(next_frame)
  29. +           if fc.data_path.endswith('scale'):
  30. +               anim_scale[fc.array_index] = fc.evaluate(next_frame)
  31. +      
  32. +       next_matrix  = mathutils.Matrix.Translation( mathutils.Vector((anim_location.x, -anim_location.z, anim_location.y)) )
  33. +       anim_rotn_e = mathutils.Euler(anim_rotation)
  34. +       anim_rotn_e.make_compatible(bone.rotation_euler)
  35. +       anim_rotn_e = anim_rotn_e.to_matrix().to_4x4()
  36. +       next_matrix *= anim_rotn_e
  37. +      
  38. +       if not ignore_scale:
  39. +           next_matrix *= mathutils.Matrix.Scale(anim_scale[0], 4, mathutils.Vector([1,0,0]))
  40. +           next_matrix *= mathutils.Matrix.Scale(anim_scale[1], 4, mathutils.Vector([0,1,0]))
  41. +           next_matrix *= mathutils.Matrix.Scale(anim_scale[2], 4, mathutils.Vector([0,0,1]))
  42. +      
  43. +       return next_matrix
  44.     else:
  45.         return False
Add Comment
Please, Sign In to add comment