SFM/Animating with Python

Note! This information is very hack-y, and quite possibly wrong

Warning:This information is for advanced users only. Errors in Python scripting can seriously mess up your SFM session. In addition, the content on this page has been developed by someone with very little experience messing around with Source, SFM, and graphics programming in general. This stuff could very well irreparably mess up your scene. The dragons found here are basically the Python Script Command's dragons, but drunk AND pissed-off. Proceed with utmost caution.

How animation works

Animation is controlled by 'controls' and curves that denote how these controls change over time in SFM. Turns out, these curves are stored in the objects themselves, and you can see the data in the Element Viewer.

For instance, let's mess around with the animation curves of the Heavy. Load up the heavy model, then examine it in the Element Viewer. You can see the curves for the happybig motion, for instance, under heavy1->controls->happybig->channel->log->layers->float log, where you'll see the times and values array, which will give you the values that define the keyframes for the animation curve. Cool, right? But how do we mess with them?

Messing with some curves

Note: there's probably a better way to do this - there's some functions exposed here: