So, I am writing a set of scripts to help me out with manual rigging in Blender. But I came across a problem when trying to assign constraints to 2 different groups of bones that I store in separate lists.
I store my deform and target bones in two separate lists using these lines of code:
def get_selected_pose_bones(self):
"""Get selected pose bones and store them in the list"""
selection = bpy.context.selected_pose_bones
self.pose_bones = []
for bone in selection:
self.pose_bones.append(bone)
return self.pose_bones
#in rest of my functions I use:
def_bones = self.get_selected_pose_bones()
tgt_bones = self.get_selected_pose_bones()
and do all the necessary operations with those. But when it comes to assigning copy_transforms constraints I get stuck.
Basically, in pose mode I need to make the first bone in the list active and while it being active assign a copy_transform constraint, then I will need to assign a first bone from the second list as a target of the first bone's copy transform constraint. I have zero clue how to do that.
If someone dealt with something like this I would appreciate your help.