I need to understand how to script a batch change to bone constraints like copy location, limit distance etc.
I have a couple of hundred bones, with a set of constraints on them. It took forever to set up and I need to tweak them.
A friend who has written scripts for me before gave me a solution to one problem. I've tried adjusting the code he wrote to do something else but I've written something wrong. I don't know the syntax and proper context.
I tried changing my friend's code in the text editor:
armature = "Armature.001"
arm = bpy.data.armatures[armature]
for bone in bpy.context.object.pose.bones:
bone.bone.select = True
arm.bones.active = bone.bone
for constraint in bpy.context.active_pose_bone.constraints:
if "Copy YZ only" in constraint.name:
CopyLocationConstraint.use_y = True
I understand what this SHOULD do but don't see the relevance of some of these lines of code. I need some assistance to find what I am missing.
The next bit I need to change is a distance value on transformation constraints (to_max_y = 2cm?). I guess the solution is similar but I need to learn how to word changes like this correctly.
I've spent hours reading examples online but still need help.