0

summary
How do I activate a bone in pose mode with Python?

Specifically what I want to do

  1. I have many bones that have child of constraints.
  2. During the process of setting characters, I often need to click Clear Inverse / Set Inverse buttons of those constraints one by one for all, so I want to write a script for batch processing.
  3. Below is the code I wrote. I've got a list of bones I want to iterate over and the code for Clear Inverse and Set Inverse is also available, but I'm not sure how to activate the bones to apply the operation to.
    What code should I write on the commented line?
import bpy
my_bone_list = bpy.context.selected_pose_bones
for i in my_bone_list : 
    # Activate the bone assigned to variable i from my_bone_list by the loop
    bpy.ops.constraint.childof_clear_inverse(constraint="Child Of", owner='BONE')
    bpy.ops.constraint.childof_set_inverse(constraint="Child Of", owner='BONE')

Thank you in advance.

J. SungHoon
  • 2,196
  • 11
  • 36

0 Answers0