Here's the maxscript code. It's a bit of a mess but I'll clean it up in a future version.
Code: Select all
utility AsaExp "AsaExp" ( group "About" ( label lab1 "Animation Script Exporter" label lab2 "Version 0.1 Beta" label lab3 "by Martijn Buijs" label lab4 "Copyright TresCom, 2003" ) group "Export" ( checkbox chkForcedRate "Forced Framerate" enabled: false checked: true button cmdExport "Export Animation" ) on cmdExport pressed do ( filename = getSaveFileName caption:"Export Animation" types:"Animation Script (*.asa)|*.asa|Text Files (*.txt)|*.txt|All Files (*.*)|*.*" if filename != undefined then ( fileobj = createfile filename format "version 2\n" to: fileobj if chkForcedRate.checked then ( format "forced_rate %\n\n" frameRate to: fileobj ) else ( format "forced_rate 0\n\n" to: fileobj ) for i=1 to objects.count do ( ExpObj objects[i] chkForcedRate.checked ) close fileobj ) ) ) fn WriteFrames obj = ( for j=animationRange.start to animationRange.end do ( sliderTime = j format "frame %\n" ((j/160) as integer) to: fileobj format "pos % % %\n" obj.position.x obj.position.y obj.position.z to: fileobj format "rot % % % %\n" obj.rotation.x obj.rotation.y obj.rotation.z obj.rotation.w to: fileobj format "scale %\n\n" ((obj.scale.x + obj.scale.y + obj.scale.z) / 3) to: fileobj ) ) fn ExpObj obj forcedrate = ( --MaxScript is a bit buggy :-( --Workaround starts here... if (superclassof(obj) == GeometryClass) do ( format "object %\n\n" obj.name to: fileobj ) --...and ends here. case superclassof(obj) of ( GeometryClass: --format "object %\n\n" obj.name to: fileobj --this crashes for some weird reason, see workaround above if forcedrate then ( WriteFrames obj ) else ( --WriteKeyFrames obj ) camera: if classof(obj) == FreeCamera do ( format "object Camera\n\n" obj.name to: fileobj if forcedrate then ( WriteFrames obj ) else ( --WriteKeyFrames obj ) ) ) format "end_object\n\n" to: fileobj )
Works with all primitives and meshes (Geometry class to be exact). What it does is loop thru all objects and prints the position, rotation, scale (averaged x,y,z scale) for each frame. That means that bone systems, noise controllers (for camera shake for example) and other helpers/tools in MAX can be used to animate them.
Haven't implemented keyframes. Would make the animation scripts smaller, but it doesn't work for non-linear trajectories.
Also, MAX's camera rotations (FreeCamera only) don't apear be like that of other nodes and I haven't figured out how it does work.
It's pretty cool to animate stuff like this...