Get a pose bone's rotation *after* constraints/modifiers?

MakeHuman python API, python plugins, etc

Moderator: joepal

Get a pose bone's rotation *after* constraints/modifiers?

Postby joepal » Sat Jan 23, 2021 3:29 pm

I'm struggling a bit.

I have an arm rig which is in pose mode. The arm is a chain with four bones with an ik constraint, connected to a shoulder which is outside the ik chain:

* shoulder (unaffected by IK)
* upper arm 1 (last bone in IK chain)
* upper arm 2
* lower arm 1
* lower arm 2 (has IK constraint)

Now I want to know the rotation of "upper arm 1" relative to its rest position, in *local* space. That is, disregarding its parent's rotation and disregaring the whole armature's rotation. If the ik chain hasn't shifted the bone at all from its rest position, this should be (0, 0, 0) XYZ rotation.

Looking at https://docs.blender.org/api/current/bp ... eBone.html I have tried the following:

* rotation_euler / rotation_quaternion: These don't work since they are *before* constraints/modifiers and I want the rotation *after* constraints/modifier
* matrix.to_euler() / matrix.to_quaternion(): This sounds as what I want, but the matrix is in object space, not local space. Maybe there is a clever way to convert it to local space?

So question: how do I find a pose bone's rotation relative to its rest position in local space, including the effect of any modifier/constraint?
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4465
Joined: Wed Jun 04, 2008 11:20 am

Re: Get a pose bone's rotation *after* constraints/modifiers

Postby fake_Person » Sat Jan 23, 2021 5:20 pm

hmm
may I have a picture, ( out don't have to)
sorry your big brain words hurt me.
you can rotate a boned that is yellow in pose mode (yellow being Ik. like for the lower arm 2)
you can still interact with yellow bones.
you can reset the rotations of the bones with ALT+ R

if this didn't help I'm scenery sorry

i dont know python yet
14 year old deadbeat http://www.makehumancommunity.org/forum/ucp.php?i=profile&mode=signature#
User avatar
fake_Person
 
Posts: 111
Joined: Mon Nov 30, 2020 9:17 pm


Return to Python scripts

Who is online

Users browsing this forum: No registered users and 1 guest

cron