Shuvit game master repo. http://shuvit.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ragdoll_bone_consts.py 1.0KB

123456789101112131415161718192021222324252627282930313233
  1. import bpy
  2. #context & scene for testing
  3. context = bpy.context
  4. scene = context.scene
  5. #active pose bone as example
  6. #bone = context.active_pose_bone
  7. bone2 = None
  8. # other armature other bone
  9. arm2 = scene.objects.get("Char4")
  10. shoe = scene.objects.get("Char4:Shoes02.L")
  11. bone_list = ["foot.ik.R", "foot.ik.L", "hips", "root", "spine", "spine-1", "chest", "chest-1", "clavicle.L", "clavicle.R", "deltoid.L", "deltoid.R", "upper_arm.fk.L", "upper_arm.fk.R", "forearm.fk.L", "forearm.fk.R", "hand.fk.L", "hand.fk.R", "neck", "head", "master"]
  12. for b in bone_list:
  13. bone = arm2.pose.bones.get(b)
  14. if arm2 is not None:
  15. bone2 = arm2.pose.bones.get("Shoes02.L")
  16. #print('got', bone2)
  17. # give it a copy rotation constraint
  18. if bone is not None:
  19. crc = bone.constraints.new('COPY_ROTATION')
  20. crc.target = shoe
  21. crc.name = "rd_cr"
  22. crc.influence = 0
  23. crc = bone.constraints.new('COPY_LOCATION')
  24. crc.target = shoe
  25. crc.name = "rd_cl"
  26. crc.influence = 0