So i want to print each coordinate of XYZ individually along with the rotation and location. I found some code online structured like this for printing key frame data but i'm not sure how to get it to print individually.
def get_keyframes(obj_list):
keyframes = []
for obj in obj_list:
anim = obj.animation_data
if anim is not None and anim.action is not None:
for fcu in anim.action.fcurves:
for keyframe in fcu.keyframe_points:
x, y = keyframe.co
if x not in keyframes:
keyframes.append((math.ceil(x)))
return keyframes
keys = get_keyframes(selection)
selection = bpy.context.selected_objects
This defines the keys. So lets say i want to define each coodinate as a variable:
for obj in enumerate(selection):
XRot = round(keys.rotation_euler.x, 3)
ZRot = round(keys.rotation_euler.z, 3)
YRot = round(keys.rotation_euler.y, 3)
xloc = round(keys.location.x, 3)
yloc = round(keys.location.y, 3)
zloc = round(keys.location.z, 3)
EachKeyFrame = [key for key in keys]
for keys in enumerate(EachKeyFrame):
print(str(ZRot))
I've tried this although it gives a "AttributeError: 'tuple' object has no attribute 'rotation_euler'" error.
I've also tried ints like this but gives the same error.
for obj in enumerate(selection):
XRot = round(keys.rotation_euler[0], 3)
ZRot = round(keys.rotation_euler[1], 3)
YRot = round(keys.rotation_euler[2], 3)
xloc = round(keys.location[0], 3)
yloc = round(keys.location[1], 3)
zloc = round(keys.location[2], 3)
EachKeyFrame = [key for key in keys]
for keys in enumerate(EachKeyFrame):
print(str(ZRot))