I am an absolute beginner, please forgive me if this is a basic question. I am using Blender 2.91.
So I have n objects one in the middle and others surrounding it and the one in the middle is the parent of everything else. I am rotating the middle one using keyframes that results in the others revolving around it. Now I am playing it using python and have a handler for frame change. Here I want to extract object properties like location and position of each object for each frame.
Currently I am using obj.rotation_euler and obj.location to fetch the properties, but I get same values for all frames. (I am doing this inside the handler, so I presume it has the current frame properties in the ‘scene’ param?)
So can you please tell me how to extract these properties per frame. Note, I need to do some mathematical calculation with the values , if that makes any difference.
Will be grateful for any help.
Edit 1 :
def process_obj_location(scene):
if scene.frame_current in frame_read_counter:
return
print(f"\nProcessing object location for frame : {str(scene.frame_current)}")
# for obj in bpy.context.scene.objects:
for obj in scene.objects:
if obj.type == 'MESH':
location = obj.location
object_instance = scene_objects_dict.get(obj.name, None)
object_instance.set_location(location)
frame_read_counter.append(scene.frame_current)
print(f"Finished processing locations for frame {str(scene.frame_current)}")
bpy.app.handlers.frame_change_post.append(process_obj_location)
@
operator) local coordinates bymatrix_world
property of the object. $\endgroup$