I keep getting an error when running this. Without the first for loop it does exactly what I needed, but i need it to work on all selected objects, or objects in scene. I am still very new to python. any help is appreciated.
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 not in keyframes: keyframes.append(kp.co) 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
Here is the error I am getting
Traceback (most recent call last): File "<blender_console>", line 4, in <module> AttributeError: 'NoneType' object has no attribute 'action'
I seem to have the same problem as this looping through selected objects one at a time but his solution did not work, or I dont fully understand. appreciate any input or direction.