Created
August 17, 2015 17:45
-
-
Save zeffii/f237f3885159911c41f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
def pack_frame_info(idx): | |
f = bpy.context.scene.frame_current | |
dp_str = [] | |
dp_str.append(str(f)) | |
for obj in bpy.data.objects: | |
if not (tuple(True if i==idx else False for i in range(20)) == obj.layers[:]): | |
continue | |
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(3) | |
print(k) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment