136 lines
7.7 KiB
Python
136 lines
7.7 KiB
Python
import bpy
|
|
import math
|
|
|
|
def rename_bones(obj):
|
|
namelist = [
|
|
("J_Bip_C_Chest", "mixamorig:Spine1"),
|
|
("J_Bip_C_UpperChest","mixamorig:Spine2"),
|
|
("J_Bip_C_Head","mixamorig:Head"),
|
|
("J_Bip_C_Neck","mixamorig:Neck"),
|
|
("J_Bip_C_Spine","mixamorig:Spine"),
|
|
("J_Bip_C_Hips","mixamorig:Hips"),
|
|
("J_Bip_L_UpperLeg","mixamorig:LeftUpLeg"),
|
|
("J_Bip_R_UpperLeg","mixamorig:RightUpLeg"),
|
|
("J_Bip_L_LowerLeg","mixamorig:LeftLeg"),
|
|
("J_Bip_R_LowerLeg","mixamorig:RightLeg"),
|
|
("J_Bip_R_Foot","mixamorig:RightFoot"),
|
|
("J_Bip_L_Foot","mixamorig:LeftFoot"),
|
|
("J_Bip_R_ToeBase","mixamorig:RightToeBase"),
|
|
("J_Bip_L_ToeBase","mixamorig:LeftToeBase"),
|
|
("J_Bip_L_Shoulder","mixamorig:LeftShoulder"),
|
|
("J_Bip_R_Shoulder","mixamorig:RightShoulder"),
|
|
("J_Bip_L_UpperArm","mixamorig:LeftArm"),
|
|
("J_Bip_R_UpperArm","mixamorig:RightArm"),
|
|
("J_Bip_L_LowerArm","mixamorig:LeftForeArm"),
|
|
("J_Bip_R_LowerArm","mixamorig:RightForeArm"),
|
|
("J_Bip_L_Hand","mixamorig:LeftHand"),
|
|
("J_Bip_R_Hand","mixamorig:RightHand"),
|
|
|
|
("J_Bip_L_Thumb1","mixamorig:LeftHandThumb1"),
|
|
("J_Bip_R_Thumb1","mixamorig:RightHandThumb1"),
|
|
("J_Bip_L_Thumb2","mixamorig:LeftHandThumb2"),
|
|
("J_Bip_R_Thumb2","mixamorig:RightHandThumb2"),
|
|
("J_Bip_L_Thumb3","mixamorig:LeftHandThumb3"),
|
|
("J_Bip_R_Thumb3","mixamorig:RightHandThumb3"),
|
|
|
|
("J_Bip_L_Index1","mixamorig:LeftHandIndex1"),
|
|
("J_Bip_R_Index1","mixamorig:RightHandIndex1"),
|
|
("J_Bip_L_Index2","mixamorig:LeftHandIndex2"),
|
|
("J_Bip_R_Index2","mixamorig:RightHandIndex2"),
|
|
("J_Bip_L_Index3","mixamorig:LeftHandIndex3"),
|
|
("J_Bip_R_Index3","mixamorig:RightHandIndex3"),
|
|
|
|
("J_Bip_L_Middle1","mixamorig:LeftHandMiddle1"),
|
|
("J_Bip_R_Middle1","mixamorig:RightHandMiddle1"),
|
|
("J_Bip_L_Middle2","mixamorig:LeftHandMiddle2"),
|
|
("J_Bip_R_Middle2","mixamorig:RightHandMiddle2"),
|
|
("J_Bip_L_Middle3","mixamorig:LeftHandMiddle3"),
|
|
("J_Bip_R_Middle3","mixamorig:RightHandMiddle3"),
|
|
|
|
("J_Bip_L_Ring1","mixamorig:LeftHandRing1"),
|
|
("J_Bip_R_Ring1","mixamorig:RightHandRing1"),
|
|
("J_Bip_L_Ring2","mixamorig:LeftHandRing2"),
|
|
("J_Bip_R_Ring2","mixamorig:RightHandRing2"),
|
|
("J_Bip_L_Ring3","mixamorig:LeftHandRing3"),
|
|
("J_Bip_R_Ring3","mixamorig:RightHandRing3"),
|
|
|
|
("J_Bip_L_Little1","mixamorig:LeftHandPinky1"),
|
|
("J_Bip_R_Little1","mixamorig:RightHandPinky1"),
|
|
("J_Bip_L_Little2","mixamorig:LeftHandPinky2"),
|
|
("J_Bip_R_Little2","mixamorig:RightHandPinky2"),
|
|
("J_Bip_L_Little3","mixamorig:LeftHandPinky3"),
|
|
("J_Bip_R_Little3","mixamorig:RightHandPinky3"),
|
|
|
|
("J_Adj_L_FaceEye","Eye.L"),
|
|
("J_Adj_R_FaceEye","Eye.R"),
|
|
("J_Sec_L_Bust1","Bust1.L"),
|
|
("J_Sec_R_Bust1","Bust1.R"),
|
|
("J_Sec_L_Bust2","Bust2.L"),
|
|
("J_Sec_R_Bust2","Bust2.R"),
|
|
|
|
]
|
|
|
|
for name, newname in namelist:
|
|
# get the pose bone with name
|
|
pb = obj.pose.bones.get(name)
|
|
# continue if no bone of that name
|
|
if pb is None:
|
|
continue
|
|
# rename
|
|
pb.name = newname
|
|
|
|
bpy.ops.object.mode_set(mode = 'EDIT')
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftShoulder'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftArm'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftForeArm'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHand'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightShoulder'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightArm'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightForeArm'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHand'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftUpLeg'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightUpLeg'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftLeg'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightLeg'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftFoot'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftToeBase'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightFoot'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightToeBase'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHandThumb1'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHandThumb2'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHandThumb3'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHandThumb1'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHandThumb2'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHandThumb3'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHandIndex1'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHandIndex2'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHandIndex3'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHandIndex1'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHandIndex2'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHandIndex3'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHandMiddle1'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHandMiddle2'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHandMiddle3'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHandMiddle1'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHandMiddle2'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHandMiddle3'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHandRing1'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHandRing2'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHandRing3'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHandRing1'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHandRing2'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHandRing3'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHandPinky1'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHandPinky2'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:LeftHandPinky3'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHandPinky1'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHandPinky2'].roll=+math.radians(180)
|
|
bpy.context.object.data.edit_bones['mixamorig:RightHandPinky3'].roll=+math.radians(180)
|
|
|
|
|
|
|
|
bpy.ops.object.mode_set(mode='OBJECT')
|
|
return {'FINISHED'}
|
|
|
|
|