# Deform Action Modifiers

I wrote this script to replace the deform action modifiers from 2.4x, since they are not included in 2.6x and are not accessible from Python. I thought I’d post it here since others might find it useful. I release this script under the GNU General Public License.

This script does not work exactly the same way as action modifiers of 2.4x. For example, instead of being applied in the NLA editor, it simply creates a new action. Also, once the armature moves to the end of the curve, it stays in place there instead of moving in a straight line off the curve. There is no way to make it only apply rotation in a certain plane, so if a character is walking up a slope, it will walk perpindicular to the slope.

The function that does the deformation is MakeDeformedAction (line 142). The arguments are as follows:

• SourceAct: String - The name of the source action being modified
• NewAct: String - The name of the new action being created
• Armature: String - The name of the armature object
• bones: List of strings - A list of the bones being modified
• forth: List of floats - The foreward direction in the source action. For example, if a walkcycle is being modified, this variable is the direction that the character walks in the source action.
• bezier: List of lists - List representing the bezier curve (see example below)
• repeat: Integer - The number of times the action repeats
• step: Integer - The number of units the armature moves for each repitition
• start: Integer - The first frame of the source action being used
• end: Integer - The last frame of the source action being used
• rot: List of floats - A list representing an Euler representing the way the armature will be rotated when the new action is used
• delta: Integer - The number of times to iterate along the curve when calculating its distance. The larger delta is, the longer the script will take to run, but the closer the approximation will be.

An example of a list representing a bezier:
[ [ [0.0,1.0,0.0] , [0.0,0.0,0.0] , [0.0,-1.0,0.0] ] , [ [-1.0,-3.0,0.0] , [-2.0,-3.0,0.0] , [-3.0,-3.0,0.0] ] ]

The function MakeDeformedAction does not directly look at a bezier curve in Blender. It only accepts a list representing a bezier curve. However, the function bezierMenu does look at a bezier curve from Blender. This script only works with bezier curves and not nurbs curves because I could only figure out the mathematics of bezier curves.

### Attachments

bezier.blend (147 KB)

Sorry, that script does not work in 2.6x, only in 2.49b. I have now attached a new file that includes a version that works in 2.6x. There was also a bug in the 2.49b version where it could try to normalize a zero vector. I have included an edited version in this new attachment that fixes this bug. Be sure to toggle the console window when using this script because it prints an interactive menu there.

### Attachments

bezier_scripts.blend (627 KB)