If you are like me and can't keep moving until you understand how this works, I wrote an explanation for myself that might help you out:
- As crissamarr said, go to File > User Preferences > File and enable Auto Run Python Scripts for the Gauge to work
- Now, when you move a slider on the gauge, the cube will stretch
- Switch to the Animation Screen layout (it's just my preference to see things more easily)
- Go to the Graph Editor window
- Make sure the Mouse toggle button at the bottom bar is deactivated to show all the channels of all the objects in the left panel of the Graph editor
- There is a dropdown that says F-Curve, open that dropdown and select Drivers to show the animation scripts
- Select any channel from the left
- Open the (N) panel and select the Drivers tab to see the content of the script
- Now that you know where to find the info, let's see how each gauge slider works
-
Gauge's Bend_Control
- This slider bends the cube like a bean to the left or right
- This slider directly controls the Cube_curve object. TheCube object bends with the Cube_curve object because TheCube has a Curve modifier with Cube_curve as the object
- To make the slider control the curve, two keyframes were inserted for the Cube_curve object
- Keyframe 1: the Angle field of the SimpleDeform modifier of the curve
- The purpose of the slider is to update this SimpleDeform angle easily by limiting the Z movement of the slider
- In the Drivers tab of the (N) panel in the Graph editor, you can see the script to control the angle of the SimpleDeform modifier on the curve
- The expresion is: var * -1
- This means that the value of the Angle field of the SimpleDeform modifier for the selected frame will be the result of that expression. The specific result for the expression can be seen in the "Driver Value" section of the driver
- The var value for the expression is found below the Add Variable button
- The var value is of type Transform Channel and is called var. The Object to obtain the value from is Bend_Control (which is the slider object), and then the specific transform channel wanted is specified: Z Location and Transform Space.
- If you move the Bend_Control object on the 3D viewport, you'll see that its Z location value will be exactly the same as the one shown in the "Value:" section of the variable definition
- Keyframe 2: the X location of the curve
- From the way I see it, updating the X location value was needed to offset the curved when deformed by the SimpleDeform modifier to keep it centered
- The expression is a little bit more complicated. It's result will be the value of the X location for the selected frame: 0.011 - (var * 0.45)
- The var value is of type Single Property and is called var, the Property is the Cube_curve and the specific Path to find the value to use as var is modifiers["SimpleDeform"].angle
-
Gauge's SquashControl1
- This slider stretches the cube vertically and squashes it horizontally
- This slider directly controls TheCube object
- To make the slider control the cube, two keyframes were inserted for TheCube object
- Keyframe 1: Value (Stretch)
- If you go to the Properties panel > Data tab > Shape Keys section, you'll find several Shape Keys created
- This keyframe was created inserting a keyframe for the Stretch shape key
- As you can see in the Graph editor, the expression is simply the value of the var
- The var value comes from the Z location of the SquashControl1 object
- If you want to manually modify the value of the shape key to see how it affects the mesh, you'll have to remove the driver in the Graph Editor by clicking the button Remove Driver in the Drivers tab. Otherwise, you won't be able to modify it
- Keyframe 2: Value (Squash1)
- Same logic as the Value (Stretch) keyframe, but the expression is: var * -1
-
Gauge's SquashControl2
- Same logic as SquashControl1
-
Rotator1 and Rotator2
- These are simple empty objects that act as the parents of the CubeMaster object through the use Child Of object constraints
- The CubeMaster object has two Child Of object constraints, one for Rotator1 and another one for Rotator2
- As you would expect for any object with a parent, when you rotate the Rotator1 object, its child (CubeMaster) is also rotated. The same happens with Rotator2
-
And why does the Gauge seems to follow TheCube?
- Because the Gauge object also has a Child Of object constraint. This object constraint sets the CubeMaster as the parent of the Gauge
- The Gauge only follows TheCube in the X axis because the rest of the transformations are unchecked in the Child Of constraint, so only the transformation in the X axis is allowed