import Blender as B # Take the vals: ObjSelect = B.Object.GetSelected()[0] origName = ObjSelect.name SC = B.Scene.GetCurrent() SCR = SC.getRenderingContext() SizeX = SCR.sizeX SizeY = SCR.sizeY AspectX = float(SCR.aspectRatioX()) AspectY = float(SCR.aspectRatioY()) Aspect = 1.4222 # WTF should I add here exactly? FrameA = B.Get('curframe') FrameP = B.Get('staframe') FrameF = B.Get('endframe') FrameRate = SCR.fps # Inicialazing Lists LocX = [] LocY = [] LocZ = [] RotX = [] RotY = [] RotZ = [] #----------------------------------------------------- # CREATING LISTS # Moves to the starting frame B.Set('curframe', FrameP) FrameA = FrameP while FrameA < (FrameF + 1): B.Set('curframe', FrameA) # Worldspace matrix mat= ObjSelect.mat LocX.append (mat.translationPart().x) LocY.append (mat.translationPart().y) LocZ.append (mat.translationPart().z) RotX.append (-mat.toEuler().x) RotY.append (-mat.toEuler().y) RotZ.append (-mat.toEuler().z) FrameA += 1 #------------------------------------------------------- # File writing starts HERE! File = open ('AfterEffectsExporter.txt','w') # The header File.write ('Adobe After Effects 5.0 Keyframe Data\n\n\ Units Per Second %i\n\ Source Width %i\n\ Source Height %i\n\ Source Pixel Aspect Ratio %.4f\n\ Comp Pixel Aspect Ratio %.4f\n\ '%(FrameRate, SizeX, SizeY, Aspect, Aspect)) # Loc and Rot values are writen in an entirely diferent way, how clever... # Write Loc values ----------------------------------- File.write ('\nPosition\n\ Frame X pixels Y pixels Z pixels') for i in range (FrameF-FrameP): File.write ('\n %i %f %f %f ' % (i,LocX[i], LocY[i], LocZ[i])) # Write Rot values ----------------------------------- # Z values File.write('\n\nZ Rotation\n Frame degrees') for i in range (FrameF-FrameP): File.write('\n %i %f' % (i, RotZ[i])) # X values File.write('\n\nX Rotation\n Frame degrees') for i in range (FrameF-FrameP): File.write('\n %i %f' % (i, RotX[i])) # Y values File.write('\n\nY Rotation\n Frame degrees') for i in range (FrameF-FrameP): File.write('\n %i %f' % (i, RotY[i])) # THE END ----------------------------------- File.write('\n\n\nEnd of Keyframe Data\n') B.Set('curframe', FrameP) print "\nExporting Done!\nYour file is located in \ Blender root folder, now send bug reports to ZanQdo"