Skip to content

Instantly share code, notes, and snippets.

@eelstork
Created September 20, 2015 06:30
Show Gist options
  • Save eelstork/6b2944d74ec9dd229938 to your computer and use it in GitHub Desktop.
Save eelstork/6b2944d74ec9dd229938 to your computer and use it in GitHub Desktop.
Convert Mixamo rig bone names (as imported to Blender via FBX) to standard Blender bone names. This is especially use if your mesh uses the 'mirror' modifier. 1 - Backup your Blend. 2 - In action editor disconnect any animation connected to the rig. 3 - Paste the script in a text window and select "run script". 4 - Notice that all bone names are…
# IMPORTANT: make sure no animation is assigned
# to the rig before you run this script,
# otherwise linked animation data will be corrupted.
import bpy
# ----------------------------------
# Mixamo left/right bone names start with 'Left'/'Right'
# Instead we apply Blender's standard .L/.R suffix
# and get rid of long suffix
# ----------------------------------
def makeStandardBoneName(x):
x = x[10:]
if 'Left' in x:
x = x[4:]+".L"
if 'Right' in x:
x = x[5:]+".R"
return x
# ----------------------------------
# Standardize bone names.
# ----------------------------------
for armature in bpy.data.armatures:
for bone in armature.bones:
n = bone.name
if 'mixamorig:' in n:
bone.name = makeStandardBoneName(n)
# ----------------------------------
# Convert animation channel names
# ----------------------------------
for action in bpy.data.actions:
for curve in action.fcurves:
p = curve.data_path
if 'mixamorig:' in p:
e = p.split("\"")
x = makeStandardBoneName(e[1])
curve.data_path = e[0]+"\""+x+"\""+e[2]
@gummby8
Copy link

gummby8 commented Sep 3, 2018

Life saver. Thank you sir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment