☰
 
Image

GH_BoneSwitchAutoStep

By: hungs59

Published: Oct 8 2026, 17:04

Downloads: 30
Automatically enforce Step interpolation on bones and switch - no more manual key tweaking.
Type: LayerScript Script Version: Created for Moho: 14.3
Category: Bones
Last Updated: Oct 21 2026, 06:34
GH Switch Auto Step — Automatic Step Interpolation for Switch Bones

Have you ever animated mouth shapes or hand poses with bone controls, then scrubbed the timeline and watched them slide between poses instead of snapping into place?
The cause is often Smooth interpolation. Fixing it means selecting the bones, finding their keyframes, and changing them to Step—and it is easy to miss a few.
GH Switch Auto Step takes care of that cleanup automatically. Attach it to a Bone Layer, and it enforces Step interpolation on animation keys belonging to bones whose names contain “switch”.
By default, name matching is case-insensitive: “MouthSwitch”, “handswitch”, and “SWITCH” all match. The script processes the main timeline only, leaving Actions and Smart Bone Actions untouched.
It is useful for mouth shapes, hand poses, and other bone controls that should snap between distinct poses and hold their values.

Features

• Automatic Step interpolation: Processes bone angle, position, and scale, including separate X/Y position channels.
• Frame-0 correction: Changes frame-0 keys from Step to Linear. Other interpolation modes at frame 0 remain unchanged.
• Automatic starting pose: If a channel has a key after frame 1 but no key at frame 1, the script creates a frame-1 key using that channel’s frame-0 value.
• Preserves your edits: Existing key values are never overwritten. You can edit the frame-1 pose, and the script keeps your changes while enforcing Step interpolation.
• Preserves other key settings: Existing key metadata, such as tags, interval, hold, and flags, is retained when interpolation changes.
• Main timeline only: Actions and Smart Bone Actions are skipped.
• Built-in re-entry protection and error handling.

Installation

1. Download GH_SwitchAutoStep.lua.
2. In Moho, select the Bone Layer and open Layer Settings → General → Embedded script.
3. Select the .lua file.
4. Give the target bones names containing “switch”, such as MouthSwitch or HandSwitch.
5. Animate normally. The script applies its rules whenever Moho evaluates the layer. If the change does not appear immediately, change frames to trigger another evaluation.


Keep the Lua file in a stable location, preferably alongside your project. If the layer already uses another embedded script, the scripts need to be combined before attaching this one.


What’s New in v1.3

This update improves the handling of the default pose and the beginning of the animation:

• Frame 0 is no longer forced to Step. If an earlier version changed it to Step, the script now changes it to Linear automatically.
• Step interpolation starts at frame 1. Negative-frame keys remain untouched.
• A missing frame-1 key is created when needed. If a channel contains animation after frame 1, its frame-0 value is copied to a new Step key at frame 1.
• Existing frame-1 poses are respected. The script does not replace their values, including values you edit manually.
• These rules apply separately to each animation channel, including split X/Y position channels.

Notes

• Keys from frame 1 onward are always forced to Step. Manually changing their interpolation to Smooth or Linear will be overridden the next time the script runs.
• If you delete a frame-1 key while later keys remain, the script recreates it using the current frame-0 value.
• The source includes two name-matching options: case-insensitive matching is enabled; a case-sensitive alternative is provided in a comment block.
• Switching name-matching options or removing the embedded script does not restore previous interpolation settings.
This script, and all other scripts on this site are distributed as free software under the GNU General Public License 3.0 or later.

Don't know how to install scripts in Moho? ‼ View instructions ‼

Downloads History:

Last 30 days:

Last 36 months:

×