My Blender knowledge base is two days of watching youtube videos so I apologize if I use the wrong terms. I downloaded a model from here: https://github.com/LeszekSwirski/eyemodel/blob/master/eyemodel/Swirski-EyeModel.blend

It uses animations but I wanted to ignore the animations and control the eye movement from a script so that I can render each frame with a position marker.

I wrote a simple script to control the direction the eyes look. The Armature Head: eyetargetparent is linked to the bones in the eyes and eyelids such that if I move it the eyes and eyelids move appropriately.

import bpy  
import os

scene = bpy.context.scene  
armature = bpy.data.objects['Armature Head']  
eye_target = armature.pose.bones['eyetargetparent']  

for rx in range(-1,2,1):  
   for rz in range(-1,2,1):  
      eye_file = 'eye_{}_{}.png'.format(rx,rz)  
      filepath = os.path.join(os.path.dirname(bpy.data.filepath),eye_file)  

The script seems to be OK, but I get an error that the "Head" from PoseBone is read only.

Python API: Transformation from `Bone` bind pose to `PoseBone` using SQT

Each PoseBone holds the transformation matrix to transform the position of the bone in its' bind pose to it's position in the current frame. This transformation can be accessed through the scale, rotation_quaternion and location properties

When i click on the eyetargetparent none of the locks in transform are set.

I did try some random fixes based on similar stuff I found but none worked.
I tried to remove the parent in object mode.
I tried deleting all the animations in case they were preventing changes.
I made sure the skeleton is in pose position, not rest.

One strange note. If I try to use a mouse to drag around the eyetargetparent, it wont move but I can move it by enabling object gizmos in pose mode. However twice I was searching for solutions and for some reason moving the eyetargetparent by mouse started working but each time saving the file and reopening cause it to not work again. In one of those cases it was by removing constraints. But I saved and reopened and the constraints were not there but moving by mouse still did not work.

So my question is:
Is there some other way I should be controlling the movement of eyetargetparent to not hit this limitation? And if not, is there a way to find the posebone represented by eyetargetparent and make it not read only?

Based on my searching I believe it has to do with constraints and I have a general understanding of the differences between bone constraints, and pose constraints but it isn't clear to me how to get a list of either to figure out which this could be. The organization isn't really clear to me and a lot of the answers I see on line are based on shortcut keys that only seem to be valid in certain views and it isn't always clear what view to even try them. Any nudge in the right direction would be greatly appreciated.

I am running blender 3.2.0 on Ubuntu 18.04.6 LTS with an NVIDIA Graphics card.

  • 2
    $\begingroup$ You need change the rotation and scale of the posebone blender.stackexchange.com/questions/265213/… $\endgroup$
    – X Y
    Jun 24, 2022 at 18:33
  • $\begingroup$ Thank you for the quick response. I will try it. $\endgroup$ Jun 24, 2022 at 20:53
  • $\begingroup$ Thank you so much. The link you pointed me to helped me realise two mistakes I was making. $\endgroup$ Jun 24, 2022 at 21:05

1 Answer 1


UPDATED: I found an additional cleaner way to do what I wanted.

armature = bpy.data.objects['Armature Head']  
eye_target_pose = armature.pose.bones['eyetargetparent']  
eye_target_pose.location = Vector((rx,0,rz)) 

This has two benefits. The location is an exact location instead of a offset from the current location. And I can call it direclty instead of the currently active element.

OLD Answer: Thank you so Much X Y for Pointing me in the right direction! My issue was related to trying to call a translate of a pose. I really needed to do a translate of the bone. And because I was trying to do a translate of the pose it only passed the location vector which was not sufficient.

The fixed code is:

import bpy  
import math  
from mathutils import Vector  
import OS  

scene = bpy.context.scene    
armature = bpy.data.objects['Armature Head']  
eye_target = armature.data.bones['eyetargetparent'] # NOTICE THIS CHANGED  

for rx in range(-1,2,1):  
   for rz in range(-1,2,1):  
eye_target.select=True  #this was added    
#the below function was swapped for old function  
proportional_size=0.069, use_proportional_connected=False,  

... Rest stays same

Switching to the bone, and selecting the bone allowed me to use the transform which included the necessary orient_matrix. And since I am not rotating the matrix all stay fixed. which simplifies everything.


This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .