Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sel_objs = [obj for obj in bpy.context.selected_objects]
- for obj in sel_objs:
- obj.select = True
- ob = bpy.context.active_object
- action = ob.animation_data.action
- keyframes = []
- for fcu in action.fcurves:
- for kp in fcu.keyframe_points:
- if kp.co[0] not in keyframes:
- keyframes.append(kp.co[0])
- with open('blender_data.txt' , 'w') as f:
- for i in range(len(keyframes)):
- k = keyframes[i]
- bpy.context.scene.frame_set(k)
- f.write(ob.name + ', ')
- f.write(str(float(ob.location.x)) + ', ' + str(float(ob.location.y)) + ', ' + str(float(ob.location.z)) + ', ')
- f.write(str(float(ob.scale.x)) + ', ' + str(float(ob.scale.y)) + ', ' + str(float(ob.scale.z)) + ', ')
- f.write('%s n' % (k))
- obj.select = False
- Traceback (most recent call last):
- File "<blender_console>", line 4, in <module>
- AttributeError: 'NoneType' object has no attribute 'action'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement