Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. sel_objs = [obj for obj in bpy.context.selected_objects]
  2. for obj in sel_objs:
  3. obj.select = True
  4. ob = bpy.context.active_object
  5. action = ob.animation_data.action
  6. keyframes = []
  7. for fcu in action.fcurves:
  8. for kp in fcu.keyframe_points:
  9. if kp.co[0] not in keyframes:
  10. keyframes.append(kp.co[0])
  11. with open('blender_data.txt' , 'w') as f:
  12. for i in range(len(keyframes)):
  13. k = keyframes[i]
  14. bpy.context.scene.frame_set(k)
  15. f.write(ob.name + ', ')
  16. f.write(str(float(ob.location.x)) + ', ' + str(float(ob.location.y)) + ', ' + str(float(ob.location.z)) + ', ')
  17. f.write(str(float(ob.scale.x)) + ', ' + str(float(ob.scale.y)) + ', ' + str(float(ob.scale.z)) + ', ')
  18. f.write('%s n' % (k))
  19. obj.select = False
  20.  
  21. Traceback (most recent call last):
  22. File "<blender_console>", line 4, in <module>
  23. AttributeError: 'NoneType' object has no attribute 'action'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement