1

enter image description here

how can I get the value of this value as in printable form.

Raspberry
  • 425
  • 1
  • 5
  • 11

2 Answers2

3

Calculate the matrix world of the pose bone.

An objects matrix world contains its global transform in relation to scene (0, 0, 0) and the global X, Y and Z axes.

See How to get world-space matrix of any pose bone?

This will give the global Y Euler rotation of pose bone TORSO. The value of the 'VAR' variable in driver in question.

import bpy

from math import degrees


ivan = bpy.data.objects["Ivan_rig"]
torso = ivan.pose.bones['TORSO']

# torso global matrix

mw = ivan.matrix_world @ torso.matrix

# angle

angle = mw.to_euler().y

print(f"{angle} ({degrees(angle)})")
print(torso.rotation_axis_angle[:])

Output matching driver as shown

enter image description here

-0.3148045539855957 (-18.036972314872912)

where the driver variable value is angle = -0.3148

Re your answer, it's demonstrably incorrect. The property is a 4d (angle, axis.x, axis.y, axis.z) Result from example above.

(0.0, 0.0, 1.0, 0.0)

default value because my pose bone is not in axis angle rotation mode. Even if it was the angle part would only be global Z rotation when axis is global Z.

Need to convert to global coordinates and convert to Euler to see the WORLD space rotation Y value of driver using this.

Often would use context, eg select the torso bone

torso = context.active_pose_bone

If using 2.7x or prior replace @ with * to avoid TypeError: Element-wise multiplication: not supported between 'Matrix' and 'Vector'

batFINGER
  • 84,216
  • 10
  • 108
  • 233
0

actually figured it out

bpy.data.objects['Ivan_rig'].pose.bones['TORSO'].rotation_axis_angle
Raspberry
  • 425
  • 1
  • 5
  • 11