3
$\begingroup$

I create an script that loads a .json file, which contains the joins and bones positions, and create a skeleton with IK based on that information. Everything works as it should be, however, when I am in pose mode, I can rotate my selected bone trough the the python API with the following command:

bpy.ops.transform.rotate(value=radians(-45), axis=(1,0,0))

The following image shows the result of the rotation on my torso:

rotation applied

the command above will rotate my selected bone as I wish. The problem is with the translate function, when I translate the bone trough the User Interface, everything works perfectly (even the Inverse Kinematics), so I was wondering what command should I perform in my script to achieve the same effect in translation that I achieve with the mouse (clicking G, then move the mouse cursor, left click), like the following image:

desired effect

So I am really looking foward for a way to achieve this effect trough python code, without the UI interaction. By the way, the following command does not work (I do not know why tough) bpy.ops.transform.translate(value=(1,0,-5)).

Just another question that could solve all of my problems, is there a way to see what commands is the blender UI applying to the skeleton so I could just copy the command of whatever I am doing to the script to achieve whatever I desire?

Thank you so much.

$\endgroup$

1 Answer 1

2
$\begingroup$

Is there a way to see what commands is the blender UI applying to the skeleton so I could just copy the command of whatever I am doing to the script to achieve whatever I desire?

Yes, you can run blender with the --debug flags. For example:

./blender --debug-wm

or

./blender --debug-all
$\endgroup$
1
  • $\begingroup$ Yes, indeed that shows the translation command, however, if I apply the same command in code it does not seem to translate the bone, it's weird! Thank you very much! $\endgroup$ Aug 26, 2015 at 5:20

You must log in to answer this question.

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