Well, either you blender copy is mischievous and lying to you, or you are asking it the wrong thing…think of ‘ctrl’ + ‘spacebar’ as truth serum for mischievous lying Blender copies that need to be put into timeout. :evilgrin: Ok, truth time for me, I’ve never used python with an armature before but this is what is so great about autocomplete in the console (ctrl + spacebar is autocomplete)
I added an armature with one bone, I went to edit mode and extruded it several times so I had 4 bones. I didn’t know what extrude would do, but luckily and logically, hitting e caused a new bone to spring out of the previous one and each new bone became a child of the one before it. Then I went to pose mode.
in the console…without the lines starting with #. I typed.
#the armature object
my_armature = bpy.context.object
#the bone within the armature data
my_bone = my_armature.data.bones['Bone.001']
now…in the console, I type “my_bone.” and then ‘ctrl’ + ‘spacebar’ and see what it has
>>> my_bone.
as_pointer(
basename
bbone_in
bbone_out
bbone_segments
bbone_x
bbone_z
bl_rna
callback_add(
callback_remove(
center
children
children_recursive
children_recursive_basename
driver_add(
driver_remove(
envelope_distance
envelope_weight
evaluate_envelope(
get(
head
head_local
head_radius
hide
hide_select
id_data
is_property_hidden(
is_property_set(
items(
keyframe_delete(
keyframe_insert(
keys(
layers
length
matrix
matrix_local
name
parent
parent_index(
parent_recursive
path_from_id(
path_resolve(
rna_type
select
select_head
select_tail
show_wire
tail
tail_local
tail_radius
translate(
type_recast(
use_connect
use_cyclic_offset
use_deform
use_envelope_multiply
use_inherit_rotation
use_inherit_scale
use_local_location
values(
vector
x_axis
y_axis
z_axis
indeed, there is no “rotation_euler”…so that’s good, Blender didn’t lie to you, I owe it an apology. You will probably want to check out the “matrix” and “martix_local” properties if you want to set them by hand in this way. Eg
my_bone.matrix = my_calculated_matrix
when you do it this way, it doesnt have to be selected, you are manually setting the data to something. If however, you want to say rotate it by _____ from where it is, and calculating the matrix is a pain (which it would be for me because who paid attention in middle school?)
#deselect all the other ones if they are
bpy.ops.pose.select_all(action = 'DESELECT')
#make the bone I want selected
my_bone.select = True
#Rotate it....
bpy.ops.transform.rotate(
and now press ‘ctrl’ + ‘spacebar’ to learn about the rotate operator syntax which I will leave as an exercise for you. As a heads up, the rotate operator sytax is a little bit weird, just use all the commas that look like they shouldn’t be there and you will be fine
THe difference is that here, we are calling an operator to modify an objects data. It knows what to work on based on what is selected and/or active.