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_constraints_2.py 914B

1234567891011121314151617181920212223242526272829303132
  1. import bpy
  2. context = bpy.context
  3. BoneList = ["upper_arm.fk.R", "upper_arm.fk.L", "head", "neck", "clavicle.R", "clavicle.L", "deltoid.R", "deltoid.L", "forearm.fk.R", "forearm.fk.L", "hand.fk.R", "hand.fk.L", "chest", "spine-1", "spine", "root", "hips", "foot.ik.R", "foot.ik.L"]
  4. TargetBone = "Char4:Shoes02.R"
  5. for BoneName in BoneList:
  6. bpy.data.objects["Char4"].data.bones[BoneName].select = True
  7. print(context.selected_pose_bones)
  8. for pb in context.selected_pose_bones:
  9. cl = (pb.constraints.get("rd_cl")
  10. or pb.constraints.new(type='COPY_LOCATION'))
  11. # set some properties
  12. cl.name = "rd_cl"
  13. cl.target = bpy.data.objects[TargetBone]
  14. cl.influence = 0
  15. cr = (pb.constraints.get("rd_cr")
  16. or pb.constraints.new(type='COPY_ROTATION'))
  17. # set some properties
  18. cr.name = "rd_cr"
  19. cr.target = bpy.data.objects[TargetBone]
  20. cr.influence = 0