I have an armature where Automatic IK is enabled. I want to move my bone in pose mode using python instead of grabbing it using mouse. I tried the below but it didn't work as it says tail location is a read only. How I can move the bone's tail to a certain location in the scene without stretching the bone and in pose mode not edit mode?
import bpy
ob = bpy.data.objects['Armature']
ob.pose.bones['Bone.002'].tail = bpy.context.scene.cursor_location
I've also tried selecting the bone in Pose Mode then using ops.transform.translate
but it didn't move the bone to the cursor:
bpy.ops.transform.translate(value=bpy.context.scene.cursor_location, constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
As shown below I can do this manually by selecting the bone and grabbing it to the correct position while auto-ik is enabled without resizing or stretching the bones:
bpy.ops.pose.visual_transform_apply()
, then delete empty and constraint. $\endgroup$