Skip to content

Instantly share code, notes, and snippets.

@pixaline
Created February 12, 2018 15:42
Show Gist options
  • Save pixaline/ed22a4263952338c84cd0ada2fb310c1 to your computer and use it in GitHub Desktop.
Save pixaline/ed22a4263952338c84cd0ada2fb310c1 to your computer and use it in GitHub Desktop.
# [["name1", "name2"], ["name3", "name4"]]
def fixBones(boneArray):
for anim in bpy.data.actions:
for fc in anim.fcurves:
d = fc.data_path
if d.rpartition(".")[2] == "scale":
anim.fcurves.remove(fc)
else:
for i in boneArray:
o = str.format('"{}"', i[0])
n = str.format('"{}"', i[1])
if o in d:
d = d.replace(o, n)
fc.data_path = d
if fc.group and i[0] in fc.group.name:
fc.group.name = fc.group.name.replace(i[0], i[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment