Skip to content

Instantly share code, notes, and snippets.

@naelstrof
Forked from eelstork/mixamoToBlenderBoneNames.py
Created September 7, 2018 20:57
Show Gist options
  • Save naelstrof/d2747f7838ef2f0fb626a420ef50c8ce to your computer and use it in GitHub Desktop.
Save naelstrof/d2747f7838ef2f0fb626a420ef50c8ce 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]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment