Working on a mech-suit character that has both servo-driven joints and organic muscle overlays on the same rig, and the interpolation defaults were driving me crazy. Blender defaults everything to Bezier, which is great for organic limb curves but completely wrong for pistons and hinges that should snap linearly between target positions. Visibility channels are even worse. You obviously don't want in-between values on something that's either shown or hidden.
Every time I'd key the mechanical parts I'd have to box-select in the graph editor, switch interpolation, and redo it all over again after any retiming pass. So I wrote a script to handle it automatically using regex patterns on bone names.
Rules are a list of (pattern, interpolation_type) pairs, first match wins:
import bpy
import re
BONE_INTERP_RULES = [
(r'^mech_|^piston_|^hinge_|_IK$', 'LINEAR'),
(r'^vis_|^blink_|^eye_lid', 'CONSTANT'),
(r'.*', 'BEZIER'), # fallback for everything else
]
def apply_interp_rules(action):
if not action or not action.fcurves:
return
for fcurve in action.fcurves:
if not fcurve.data_path.startswith('pose.bones'):
continue
match = re.match(r'pose\.bones\["(.+?)"\]', fcurve.data_path)
if not match:
continue
bone_name = match.group(1)
for pattern, interp_type in BONE_INTERP_RULES:
if re.search(pattern, bone_name):
for kp in fcurve.keyframe_points:
kp.interpolation = interp_type
break
for action in bpy.data.actions:
apply_interp_rules(action)
print("Done.")
Runs across all actions in the file, which is what I wanted. Consistent behavior everywhere without having to think about it per-session. Scope it to a single action easily if that fits your workflow better.
Current limitation: doesn't handle non-bone FCurves, so shape keys, object-level properties, and custom props are all out. The data path format is different and would need its own matching logic. Fine for bone-heavy rigs but worth knowing if your setup is more complex.
Curious how others handle mixed interpolation rigs. Do you just set it manually after every key pass? Is there a per-bone interpolation default hiding somewhere in Blender's preferences that I've completely missed?