Skip to content

Instantly share code, notes, and snippets.

@xDShot
Created April 11, 2017 17:08
Show Gist options
  • Save xDShot/d302e0b4aedc094daccde37f3c41d853 to your computer and use it in GitHub Desktop.
Save xDShot/d302e0b4aedc094daccde37f3c41d853 to your computer and use it in GitHub Desktop.
import bpy
active_armature = bpy.data.objects['v_pist_deagle_csco_reference_skeleton']
target_armature = bpy.data.objects['v_deagle_ref_deonly_skeleton']
mah_bois = [
"v_weapon.Bip01_R_Forearm",
"v_weapon.Bip01_R_ForeTwist",
"v_weapon.Bip01_R_Hand",
"v_weapon.Bip01_R_Finger4",
"v_weapon.Bip01_R_Finger41",
"v_weapon.Bip01_R_Finger42",
"v_weapon.Bip01_R_Finger0",
"v_weapon.Bip01_R_Finger01",
"v_weapon.Bip01_R_Finger02",
"v_weapon.Bip01_R_Finger1",
"v_weapon.Bip01_R_Finger11",
"v_weapon.Bip01_R_Finger12",
"v_weapon.Bip01_R_Finger2",
"v_weapon.Bip01_R_Finger21",
"v_weapon.Bip01_R_Finger22",
"v_weapon.Bip01_R_Finger3",
"v_weapon.Bip01_R_Finger31",
"v_weapon.Bip01_R_Finger32",
"v_weapon.Bip01_L_Forearm",
"v_weapon.Bip01_L_Hand",
"v_weapon.Bip01_L_Finger0",
"v_weapon.Bip01_L_Finger01",
"v_weapon.Bip01_L_Finger02",
"v_weapon.Bip01_L_Finger1",
"v_weapon.Bip01_L_Finger11",
"v_weapon.Bip01_L_Finger12",
"v_weapon.Bip01_L_Finger2",
"v_weapon.Bip01_L_Finger21",
"v_weapon.Bip01_L_Finger22",
"v_weapon.Bip01_L_Finger3",
"v_weapon.Bip01_L_Finger31",
"v_weapon.Bip01_L_Finger32",
"v_weapon.Bip01_L_Finger4",
"v_weapon.Bip01_L_Finger41",
"v_weapon.Bip01_L_Finger42",
"v_weapon.Bip01_L_ForeTwist",
#"v_weapon.deagle_parent",
#"v_weapon.deagle_slide",
#"v_weapon.deagle_trigger",
#"v_weapon.deagle_clip",
#"v_weapon.deagle_hammer"
]
#for bone in mah_bois: # Uncomment this line to iterate through defined bone list instead of selected
for bone in bpy.context.selected_pose_bones:
#active_bone = active_armature.pose.bones[bone]
bone.constraints.new(type='COPY_LOCATION')
bone.constraints.new(type='COPY_ROTATION')
for constr in bone.constraints:
constr.target = target_armature
constr.subtarget = bone.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment