All pastes #369571 Raw Edit

AF Camera Motion

public python v1 · immutable
#369571 ·published 2007-02-23 22:41 UTC
rendered paste body
import Blender as B#	Take the vals:SC = B.Scene.GetCurrent()SCR = SC.getRenderingContext()ObjSelect = SC.objects.activeorigName = ObjSelect.nameSizeX = SCR.sizeXSizeY = SCR.sizeYAspectX = float(SCR.aspectRatioX())AspectY = float(SCR.aspectRatioY())Aspect = AspectX / AspectY #	WTF should I add here exactly?FrameA = B.Get('curframe')FrameP = B.Get('staframe')FrameF = B.Get('endframe')FrameRate = SCR.fps#	Inicialazing ListsLocX,LocY,LocZ,RotX,RotY,RotZ = [],[],[],[],[],[]#-----------------------------------------------------#                    CREATING LISTS#	Moves to the starting frameB.Set('curframe', FrameP)FrameA = FramePwhile FrameA < (FrameF + 1):	B.Set('curframe', FrameA)		#	Worldspace matrix	mat= ObjSelect.mat		LocX.append (mat.translationPart().x)	LocZ.append (mat.translationPart().y)	LocY.append (-mat.translationPart().z)		RotX.append (mat.toEuler().x)	RotZ.append (mat.toEuler().y)	RotY.append (-mat.toEuler().z)		FrameA += 1#-------------------------------------------------------Range = FrameF-FrameP+1#	File writing starts HERE!File = open ('AfterEffectsExporter.txt','w')#	The headerFile.write ('Adobe After Effects 7.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 ('\nTransform	Position\n\	Frame	X pixels	Y pixels	Z pixels')for i in range (Range):	File.write ('\n	%i	%f	%f	%f	' % (i+1,LocX[i], LocY[i], LocZ[i]))#	Write Rot values -----------------------------------#	Z valuesFile.write('\n\nTransform	Rotation\n	Frame	degrees')for i in range (Range):	File.write('\n	%i	%f' % (i+1, RotZ[i]))#	X valuesFile.write('\n\nTransform	X Rotation\n	Frame	degrees')for i in range (Range):	File.write('\n	%i	%f' % (i+1, RotX[i]))#	Y valuesFile.write('\n\nTransform	Y Rotation\n	Frame	degrees')for i in range (Range):	File.write('\n	%i	%f' % (i+1, RotY[i]))#	THE END -----------------------------------File.write('\n\n\nEnd of Keyframe Data\n')B.Set('curframe', FrameP) # Back to starting Frameprint "\nExporting Done!\nYour file is located in \Blender's root folder, now send bug reports to ZanQdo"