Skip to content

Instantly share code, notes, and snippets.

@zeffii
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/5734a1e9502bf92feffd to your computer and use it in GitHub Desktop.
Save zeffii/5734a1e9502bf92feffd to your computer and use it in GitHub Desktop.
import bpy
def pack_frame_info():
f = bpy.context.scene.frame_current
dp_str = []
dp_str.append(str(f))
for obj in bpy.data.objects:
mat = obj.matrix_world
loc = mat.to_translation()
rot = mat.to_3x3().to_quaternion()
scale = obj.dimensions
apt = {
'obj': obj.name,
'qtX': round(rot.x,3),
'qtY': round(rot.y,3),
'qtZ': round(rot.z,3),
'qtW': round(rot.w,3),
'loX': round(loc.x,3),
'loY': round(loc.y,3),
'loZ': round(loc.z,3),
'scX': round(scale.x,3),
'scY': round(scale.y,3),
'scZ': round(scale.z,3)
}
j = '{obj} {loX} {loY} {loZ} {qtX} {qtY} {qtZ} {qtW} {scX} {scY} {scZ}'.format(**apt)
dp_str.append(j)
return ','.join(dp_str)
k = pack_frame_info()
print(k)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment