We shipped 20 tracks, where each track had a variety of ribbons, and each ribbon had its own respective direction, road segments, and setdressing. The placement of camera cranes varied quite significantly between ribbons, and since they were some of the closest road-side assets for any given track, it was important that their animations looked good. Earlier in development, it was intended that we'd have unique crane animations specific for each 'ModelInstance' in each ribbon. We didn't have support for state-machined animations, at least not before my deadline, so I had to make loops which were good enough to fool the player into thinking that they were actually dynamic, and I had to make a lot of them.
I wanted to assess whether we could/should generate ribbon-specific content during build time, since it was a waste of time to do a turn-specific animations if Environment Team was still moving these cranes around. To be more specific, I wanted auto-generate the MAX animations and then export the MAX to GLF to GSF. To that end, I decided to make this script.
This loads a TRACK XML, parses its reference tree to get the road spline and any crane 'ModelInstances', and merges these into a temporary MAX file. Then, it assigns the cranes a basic 'Left' or 'Right' animation (depending on the ribbon direction), and it applies various constraints to the panning part of the armature. Afterwards, it assigns a 'LookAt' constraint to the upper-most, tilting section of the crane, relative to a 'dummy' object which slides along a nearby section of the road spline. Lastly, it calls our 3ds Max animation utilities to export a new animation, and then we call another script to export it into a game-ready format.