0
$\begingroup$

enter image description here

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

$\endgroup$
  • $\begingroup$ Hi. What do you mean by 'printable form'? $\endgroup$ – Ray Mairlot May 22 at 0:31
2
$\begingroup$

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'

| improve this answer | |
$\endgroup$
  • $\begingroup$ Are you serious? $\endgroup$ – batFINGER May 22 at 13:44
0
$\begingroup$

actually figured it out

bpy.data.objects['Ivan_rig'].pose.bones['TORSO'].rotation_axis_angle
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.